mirror of
https://github.com/nikoksr/notify.git
synced 2024-12-14 10:23:19 +02:00
27 lines
614 B
Go
27 lines
614 B
Go
package notify
|
|
|
|
import (
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
const defaultDisabled = false // Notifier is enabled by default
|
|
|
|
// Notify is the central struct for managing notification services and sending messages to them.
|
|
type Notify struct {
|
|
Disabled bool
|
|
notifiers []Notifier
|
|
}
|
|
|
|
// ErrSendNotification signals that the notifier failed to send a notification.
|
|
var ErrSendNotification = errors.New("send notification")
|
|
|
|
// New returns a new instance of Notify. Defaulting to being not disabled.
|
|
func New() *Notify {
|
|
notifier := &Notify{
|
|
Disabled: defaultDisabled,
|
|
notifiers: []Notifier{},
|
|
}
|
|
|
|
return notifier
|
|
}
|