telegramauth

package
v0.0.0-...-6b47566 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

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) Name

func (th *TelegramHandler) Name() string

Name of the provider

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL