dispatch

package
v2.37.10 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: AGPL-3.0 Imports: 38 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrValidationNoFromAddress = xerrors.New("'from' address not defined")
	ErrValidationNoToAddress   = xerrors.New("'to' address(es) not defined")
	ErrValidationNoSmarthost   = xerrors.New("'smarthost' address not defined")
	ErrValidationNoHello       = xerrors.New("'hello' not defined")
)

Functions

This section is empty.

Types

type DeliveryFunc

type DeliveryFunc func(ctx context.Context, msgID uuid.UUID) (retryable bool, err error)

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 (*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 (*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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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