Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type DeliveryFunc ¶
DeliveryFunc delivers the notification. The first return param indicates whether a retry can be attempted (i.e. a temporary error), and the second returns any error that may have arisen. If (false, nil) is returned, that is considered a successful dispatch.
type InboxHandler ¶ added in v2.21.0
type InboxHandler struct {
// contains filtered or unexported fields
}
InboxHandler is responsible for dispatching notification messages to the Coder Inbox.
func NewInboxHandler ¶ added in v2.21.0
func NewInboxHandler(log slog.Logger, store InboxStore, ps pubsub.Pubsub) *InboxHandler
func (*InboxHandler) Dispatcher ¶ added in v2.21.0
func (s *InboxHandler) Dispatcher(payload types.MessagePayload, titleTmpl, bodyTmpl string, _ template.FuncMap) (DeliveryFunc, error)
type InboxStore ¶ added in v2.21.0
type InboxStore interface {
InsertInboxNotification(ctx context.Context, arg database.InsertInboxNotificationParams) (database.InboxNotification, error)
}
type SMTPHandler ¶
type SMTPHandler struct {
// contains filtered or unexported fields
}
SMTPHandler is responsible for dispatching notification messages via SMTP. NOTE: auth and TLS is currently *not* enabled in this initial thin slice. TODO: implement DKIM/SPF/DMARC? https://github.com/emersion/go-msgauth
func NewSMTPHandler ¶
func NewSMTPHandler(cfg codersdk.NotificationsEmailConfig, log slog.Logger) *SMTPHandler
func (*SMTPHandler) Dispatcher ¶
func (s *SMTPHandler) Dispatcher(payload types.MessagePayload, titleTmpl, bodyTmpl string, helpers template.FuncMap) (DeliveryFunc, error)
type WebhookHandler ¶
type WebhookHandler struct {
// contains filtered or unexported fields
}
WebhookHandler dispatches notification messages via an HTTP POST webhook.
func NewWebhookHandler ¶
func NewWebhookHandler(cfg codersdk.NotificationsWebhookConfig, log slog.Logger) *WebhookHandler
func (*WebhookHandler) Dispatcher ¶
func (w *WebhookHandler) Dispatcher(payload types.MessagePayload, titleMarkdown, bodyMarkdown string, _ template.FuncMap) (DeliveryFunc, error)
type WebhookPayload ¶
type WebhookPayload struct { Version string `json:"_version"` MsgID uuid.UUID `json:"msg_id"` Payload types.MessagePayload `json:"payload"` Title string `json:"title"` TitleMarkdown string `json:"title_markdown"` Body string `json:"body"` BodyMarkdown string `json:"body_markdown"` }
WebhookPayload describes the JSON payload to be delivered to the configured webhook endpoint.