2024-03-11 12:16:48 +00:00
|
|
|
// Package notifier includes the interface to implement in a notifier
|
|
|
|
package notifier
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2024-03-13 12:33:18 +00:00
|
|
|
"github.com/Luzifer/go_helpers/v2/fieldcollection"
|
2024-03-11 12:16:48 +00:00
|
|
|
"github.com/emersion/go-vcard"
|
|
|
|
)
|
|
|
|
|
|
|
|
type (
|
|
|
|
// Notifier specifies what a Notifier can do
|
|
|
|
Notifier interface {
|
|
|
|
// SendNotification will be called with the contact and the
|
|
|
|
// time when the birthday actually is. The method is therefore
|
|
|
|
// also called when a notification in advance is configured and
|
2024-03-13 12:33:18 +00:00
|
|
|
// needs to properly format the notification for that. The settings
|
|
|
|
// passed through this call MUST NOT be stored.
|
|
|
|
SendNotification(settings *fieldcollection.FieldCollection, contact vcard.Card, when time.Time) error
|
|
|
|
|
|
|
|
// ValidateSettings is called after configuration load to validate
|
|
|
|
// the settings are suitable for the notifier and do not yield
|
|
|
|
// surprising errors when doing the real notifications
|
|
|
|
ValidateSettings(settings *fieldcollection.FieldCollection) error
|
2024-03-11 12:16:48 +00:00
|
|
|
}
|
|
|
|
)
|