Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrSendNotification = errors.New("send notification")
ErrSendNotification signals that the notifier failed to send a notification.
Functions ¶
func Disable ¶ added in v0.24.0
func Disable(n *Notify)
Disable is an Option function that disables the Notify instance. It is enabled by default.
func Enable ¶ added in v0.24.0
func Enable(n *Notify)
Enable is an Option function that enables the Notify instance. This is the default behavior.
func Send ¶ added in v0.21.0
Send calls the underlying notification services to send the given subject and message to their respective endpoints.
func UseServices ¶ added in v0.21.0
func UseServices(service ...Notifier)
UseServices adds the given service(s) to the Notifier's services list.
Types ¶
type Notifier ¶
Notifier defines the behavior for notification services.
The Send function simply sends a subject and a message string to the internal destination Notifier.
E.g. for telegram.Telegram it sends the message to the specified group chat.
type Notify ¶
type Notify struct { Disabled bool // contains filtered or unexported fields }
Notify is the central struct for managing notification services and sending messages to them.
func Default ¶ added in v0.21.0
func Default() *Notify
Default returns the standard Notify instance used by the package-level send function.
func New ¶
func New() *Notify
New returns a new instance of Notify. It returns a new Notify instance with default options. By default, the Notify instance is enabled.
func NewWithOptions ¶ added in v0.24.0
NewWithOptions returns a new instance of Notify with the given options. If no options are provided, it returns a new Notify instance with default options. By default, the Notify instance is enabled.
func (*Notify) Send ¶
Send calls the underlying notification services to send the given subject and message to their respective endpoints.
func (*Notify) UseServices ¶ added in v0.5.1
UseServices adds the given service(s) to the Notifier's services list.
func (*Notify) WithOptions ¶ added in v0.24.0
WithOptions applies the given options to the Notify instance. If no options are provided, it returns the Notify instance unchanged.
type Option ¶ added in v0.24.0
type Option func(*Notify)
Option is a function that can be used to configure a Notify instance. It is used by the WithOptions and NewWithOptions functions. It's a function because it's a bit more flexible than using a struct. The only required parameter is the Notify instance itself.
Directories ¶
Path | Synopsis |
---|---|
service
|
|
bark
Package bark provides a service for sending messages to bark.
|
Package bark provides a service for sending messages to bark. |
plivo
Package plivo provides message notification integration for Plivo.
|
Package plivo provides message notification integration for Plivo. |
syslog
Package syslog provides message notification integration for local or remote syslogs.
|
Package syslog provides message notification integration for local or remote syslogs. |
whatsapp
Package whatsapp provides message notification integration for WhatsApp.
|
Package whatsapp provides message notification integration for WhatsApp. |