Documentation
¶
Overview ¶
Package notify abstracts the notification backend so that HTTP handlers can be tested without performing real network calls.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SupportedSchemas ¶
func SupportedSchemas() []string
SupportedSchemas returns the notification URL schemas this build can deliver.
It is a static, network-free capability list (not tied to any Notifier instance), so meta endpoints can report it without depending on apprise-go directly — the dependency stays confined to this package.
Types ¶
type Apprise ¶
type Apprise struct{}
Apprise is the production Notifier backed by github.com/unraid/apprise-go.
func NewApprise ¶
func NewApprise() *Apprise
NewApprise returns a Notifier that delivers via apprise-go.
func (*Apprise) Notify ¶
func (a *Apprise) Notify(_ context.Context, urls []string, body string, opts Options) ([]Result, error)
Notify builds a fresh apprise client for the given URLs and sends body.
apprise-go's Send returns errors.Join(*apprise.TargetError...) on partial or total failure; we unwrap that to report a per-URL Result.
type Notifier ¶
type Notifier interface {
Notify(ctx context.Context, urls []string, body string, opts Options) ([]Result, error)
}
Notifier delivers a notification body to a set of Apprise URLs.
Implementations must be safe for concurrent use. The real implementation wraps github.com/unraid/apprise-go; tests inject a fake.
type Options ¶
type Options struct {
Title string // optional message title
Type string // info|success|warning|failure (empty = info)
InputFormat string // text|markdown|html (empty = text)
}
Options carries the per-notification settings shared by every backend.
type Result ¶
type Result struct {
URL string // the (unmasked) target URL
Service string // service name derived from the URL scheme
OK bool // whether delivery succeeded
Message string // human readable detail (error text on failure)
}
Result describes the outcome of delivering to a single target URL.