Documentation
¶
Index ¶
- func Serve(cfg config.Config, version, commit string) error
- type Scheduler
- type Server
- func (s *Server) ClearTelegram(ctx context.Context, userID string) error
- func (s *Server) ConfigureTelegram(ctx context.Context, userID, botToken, allowedUserIDs string) (string, error)
- func (s *Server) Handler() http.Handler
- func (s *Server) Now() time.Time
- func (s *Server) TestTelegram(ctx context.Context, userID, chatID string) error
- type TelegramService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) ClearTelegram ¶
ClearTelegram stops the poller and removes all telegram config for the user.
func (*Server) ConfigureTelegram ¶
func (s *Server) ConfigureTelegram(ctx context.Context, userID, botToken, allowedUserIDs string) (string, error)
ConfigureTelegram validates a bot token, stores it encrypted along with the allowed sender ids, and (re)starts the user's long-poller. It is shared by the JSON API handler and the browser (/account) form so both paths keep encryption and poller lifecycle in one place.
type TelegramService ¶
type TelegramService interface {
ValidateToken(ctx context.Context, botToken string) (username string, err error)
SendTest(ctx context.Context, userID, chatID, text string) error
SendReminder(ctx context.Context, userID, chatID, text, taskID, buttonLabel string) error
StartForUser(ctx context.Context, userID string) error
StopForUser(userID string) error
StartAll(ctx context.Context) error
StopAll()
}
Click to show internal directories.
Click to hide internal directories.