Documentation ¶
Index ¶
- type TelegramAPI
- type TelegramHandler
- func (th *TelegramHandler) AuthHandler(_ http.ResponseWriter, _ *http.Request)
- func (th *TelegramHandler) LoginHandler(w http.ResponseWriter, r *http.Request)
- func (th *TelegramHandler) LogoutHandler(w http.ResponseWriter, _ *http.Request)
- func (th *TelegramHandler) Name() string
- func (th *TelegramHandler) ProcessUpdate(ctx context.Context, textUpdate string) error
- func (th *TelegramHandler) Run(ctx context.Context) error
- func (th *TelegramHandler) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TelegramAPI ¶
type TelegramAPI interface { GetUpdates(ctx context.Context) (*telegramUpdate, error) Avatar(ctx context.Context, userID int) (string, error) Send(ctx context.Context, id int, text string) error BotInfo(ctx context.Context) (*botInfo, error) }
TelegramAPI is used for interacting with telegram API
func NewTelegramAPI ¶
func NewTelegramAPI(token string, client *http.Client) TelegramAPI
NewTelegramAPI returns initialized TelegramAPI implementation
type TelegramHandler ¶
type TelegramHandler struct { logger.L ProviderName string ErrorMsg, SuccessMsg string TokenService provider.TokenService AvatarSaver provider.AvatarSaver Telegram TelegramAPI // contains filtered or unexported fields }
TelegramHandler implements login via telegram
func (*TelegramHandler) AuthHandler ¶
func (th *TelegramHandler) AuthHandler(_ http.ResponseWriter, _ *http.Request)
AuthHandler does nothing since we don't have any callbacks
func (*TelegramHandler) LoginHandler ¶
func (th *TelegramHandler) LoginHandler(w http.ResponseWriter, r *http.Request)
LoginHandler generates and verifies login requests
func (*TelegramHandler) LogoutHandler ¶
func (th *TelegramHandler) LogoutHandler(w http.ResponseWriter, _ *http.Request)
LogoutHandler - GET /logout
func (*TelegramHandler) ProcessUpdate ¶
func (th *TelegramHandler) ProcessUpdate(ctx context.Context, textUpdate string) error
ProcessUpdate is alternative to Run, it processes provided plain text update from Telegram so that caller could get updates and send it not only there but to multiple sources
func (*TelegramHandler) Run ¶
func (th *TelegramHandler) Run(ctx context.Context) error
Run starts processing login requests sent in Telegram Blocks caller
func (*TelegramHandler) String ¶
func (th *TelegramHandler) String() string
String representation of the provider
Click to show internal directories.
Click to hide internal directories.