Documentation
¶
Overview ¶
Package senders delivers a notification to one channel, chosen by the type of the connection addressing it.
Each sender speaks its channel's own HTTP API directly. There is no router abstraction and no third-party dispatch library: a channel is a URL, a payload shape and a status code, and naming them explicitly is both smaller and easier to debug than a layer that hides them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SupportsAttachments ¶
SupportsAttachments reports whether a channel can carry a file. Only SMTP can, so a caller asking to attach anywhere else is refused up front.
Types ¶
type Data ¶
type Data struct {
Title string
Message string
Properties map[string]string
Attachments []mail.Attachment
}
Data is the message to deliver.
Attachments are carried here but honoured only by SMTP — no chat channel accepts a file on its webhook. Callers must not silently rely on them elsewhere; ForConnection's documentation and the schedule spec's validation both say so, because a report that quietly failed to arrive is worse than one that refused to be configured.
type Discord ¶
type Discord struct{}
Discord posts through an incoming webhook, either given whole as the connection URL or assembled from a webhook id and token.
type Mattermost ¶
type Mattermost struct{}
Mattermost posts to an incoming webhook, with optional channel, username and icon overrides carried on the connection's properties.
func (*Mattermost) Send ¶
func (m *Mattermost) Send(ctx context.Context, conn *models.Connection, data Data) error
type Ntfy ¶
type Ntfy struct{}
Ntfy publishes to a topic, on ntfy.sh unless the connection names a host.
type Pushbullet ¶
type Pushbullet struct{}
Pushbullet pushes a note using the connection's access token.
func (*Pushbullet) Send ¶
func (p *Pushbullet) Send(ctx context.Context, conn *models.Connection, data Data) error
type Sender ¶
Sender delivers one message to one channel.
func ForConnection ¶
func ForConnection(conn *models.Connection) (Sender, error)
ForConnection returns the sender for a connection's type, or an error naming the type when there is none.
SMTP is deliberately absent: it is not a webhook, it is the only channel that carries attachments, and it is handled by the notification package's own SMTP path rather than here.