mirror of
https://github.com/nikoksr/notify.git
synced 2024-11-28 08:39:13 +02:00
30 lines
794 B
Go
30 lines
794 B
Go
//go:generate go install github.com/golangci/golangci-lint/cmd/golangci-lint
|
|
//go:generate go install mvdan.cc/gofumpt/gofumports
|
|
//go:generate go install github.com/daixiang0/gci
|
|
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
|
|
}
|