Thanks to visit codestin.com
Credit goes to pkg.go.dev

dispatch

package
v2.21.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2025 License: AGPL-3.0 Imports: 35 Imported by: 0

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