{"modulePath":"github.com/tgbotkit/runtime","version":"v0.1.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package webhook\n\nPackage webhook provides an implementation of UpdateSource using Telegram webhooks.\n\n## Constants\n\n```go\nconst (\n\t// HeaderTelegramBotAPISecretToken is the header used by Telegram to send the secret token.\n\tHeaderTelegramBotAPISecretToken = \"X-Telegram-Bot-Api-Secret-Token\"\n)\n```\n\n## Types\n\n```go\ntype OptOptionsSetter func(o *Options)\n```\n\n```go\nfunc WithAllowedUpdates(opt []string) OptOptionsSetter\n```\n\n```go\nfunc WithBufferSize(opt int) OptOptionsSetter\n```\n\n```go\nfunc WithClient(opt client.ClientWithResponsesInterface) OptOptionsSetter\n```\n\n```go\nfunc WithDropPendingUpdates(opt bool) OptOptionsSetter\n```\n\n```go\nfunc WithMaxBodyBytes(opt int64) OptOptionsSetter\n```\n\n```go\nfunc WithMaxConnections(opt int) OptOptionsSetter\n```\n\n```go\nfunc WithToken(opt string) OptOptionsSetter\n```\n\n```go\nfunc WithUrl(opt string) OptOptionsSetter\n```\n\n```go\nfunc WithWebhookRegistrationEnabled(enabled bool) OptOptionsSetter\n```\nWithWebhookRegistrationEnabled controls whether Start configures the Telegram webhook.\n\n```go\ntype Options struct {\n\t// contains filtered or unexported fields\n}\n```\nOptions is the options for the Webhook handler.\n\n```go\nfunc NewOptions(\n\toptions ...OptOptionsSetter,\n) Options\n```\n\n```go\nfunc (o *Options) Validate() error\n```\n\n```go\ntype Webhook struct {\n\t// contains filtered or unexported fields\n}\n```\nWebhook implements http.Handler to receive incoming updates via an outgoing webhook.\n\n```go\nfunc New(opts Options) (*Webhook, error)\n```\nNew creates a new Webhook handler.\n\n```go\nfunc (h *Webhook) ServeHTTP(w http.ResponseWriter, r *http.Request)\n```\nServeHTTP implements http.Handler interface. It validates the request, decodes the update, and sends it to the updates channel.\n\n```go\nfunc (h *Webhook) SetWebhook(ctx context.Context) error\n```\nSetWebhook sets the outgoing webhook for the bot.\n\n```go\nfunc (h *Webhook) Start(ctx context.Context) error\n```\nStart satisfies the lifecycle.Lifecycle interface. The context is used only for the startup timeout.\n\n```go\nfunc (h *Webhook) Stop(_ context.Context) error\n```\nStop satisfies the lifecycle.Lifecycle interface. The context is used only for the shutdown timeout.\n\n```go\nfunc (h *Webhook) UpdateChan() \u003c-chan client.Update\n```\nUpdateChan returns the updates channel.\n\n","path":"github.com/tgbotkit/runtime/webhook","name":"webhook","synopsis":"Package webhook provides an implementation of UpdateSource using Telegram webhooks.","isRedistributable":true}
