Documentation
¶
Index ¶
- type Options
- type PluginContext
- func (p *PluginContext) AuthByTelegramData(tgData forms.TelegramData) (*core.Record, *auth.AuthUser, error)
- func (p *PluginContext) AuthHandler(c *core.RequestEvent) error
- func (p *PluginContext) AuthHandlerTelegramData(c *core.RequestEvent, tgData *forms.TelegramData) error
- func (p *PluginContext) GetCollection() (*core.Collection, error)
- func (p *PluginContext) GetForm(optAuthRecord *core.Record) (*forms.RecordTelegramLogin, error)
- func (p *PluginContext) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// BotToken is a Telegram bot token.
// You can get it from @BotFather.
BotToken string
// CollectionKey is a collection key (name or id) for PocketBase auth collection.
CollectionKey string
}
Options defines optional struct to customize the default plugin behavior.
type PluginContext ¶ added in v0.15.1
type PluginContext struct {
// contains filtered or unexported fields
}
func CreateAndValidatePluginContext ¶ added in v0.15.1
func CreateAndValidatePluginContext(app core.App, options *Options) (*PluginContext, error)
func MustRegister ¶
func MustRegister(app core.App, options *Options) *PluginContext
MustRegister is a helper function to register plugin and panic if error occurred.
func Register ¶
func Register(app core.App, options *Options) (*PluginContext, error)
Register plugin in PocketBase app.
func (*PluginContext) AuthByTelegramData ¶ added in v0.15.1
func (p *PluginContext) AuthByTelegramData(tgData forms.TelegramData) (*core.Record, *auth.AuthUser, error)
AuthByTelegramData returns auth record and auth user by Telegram data.
func (*PluginContext) AuthHandler ¶ added in v0.15.1
func (p *PluginContext) AuthHandler(c *core.RequestEvent) error
func (*PluginContext) AuthHandlerTelegramData ¶ added in v0.15.2
func (p *PluginContext) AuthHandlerTelegramData( c *core.RequestEvent, tgData *forms.TelegramData, ) error
func (*PluginContext) GetCollection ¶ added in v0.15.1
func (p *PluginContext) GetCollection() (*core.Collection, error)
GetCollection returns PocketBase collection object for collection with name or id from options.CollectionKey.
func (*PluginContext) GetForm ¶ added in v0.15.1
func (p *PluginContext) GetForm(optAuthRecord *core.Record) (*forms.RecordTelegramLogin, error)
GetForm returns Telegram login form for collection with name or id from options.CollectionKey.
func (*PluginContext) Validate ¶ added in v0.15.1
func (p *PluginContext) Validate() error
Validate plugin options. Return error if some option is invalid.
Click to show internal directories.
Click to hide internal directories.