dispatch

package
v2.18.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ValidationNoFromAddressErr = xerrors.New("'from' address not defined")
	ValidationNoToAddressErr   = xerrors.New("'to' address(es) not defined")
	ValidationNoSmarthostErr   = xerrors.New("'smarthost' address not defined")
	ValidationNoHelloErr       = 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 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