Add support for multiple instances of the same notifier type
This commit is contained in:
@@ -44,6 +44,10 @@ type Notification struct {
|
||||
// Type specifies which notifier should handle this notification
|
||||
Type NotificationType `json:"type"`
|
||||
|
||||
// Account specifies which named account/instance to use for this notifier type (optional)
|
||||
// If not specified, the default account for the notifier type will be used
|
||||
Account string `json:"account,omitempty"`
|
||||
|
||||
// Priority determines urgency and retry behavior
|
||||
Priority Priority `json:"priority"`
|
||||
|
||||
|
||||
@@ -21,14 +21,18 @@ type Notifier interface {
|
||||
|
||||
// NotifierFactory creates notifier instances based on configuration
|
||||
type NotifierFactory interface {
|
||||
// Create creates a notifier for the given type
|
||||
Create(notificationType NotificationType) (Notifier, error)
|
||||
// Create creates a notifier for the given type and account
|
||||
// If account is empty, the default account for the type will be used
|
||||
Create(notificationType NotificationType, account string) (Notifier, error)
|
||||
|
||||
// RegisterNotifier registers a custom notifier implementation
|
||||
RegisterNotifier(notificationType NotificationType, notifier Notifier) error
|
||||
RegisterNotifier(notificationType NotificationType, account string, notifier Notifier) error
|
||||
|
||||
// SupportedTypes returns all supported notification types
|
||||
SupportedTypes() []NotificationType
|
||||
|
||||
// GetAccounts returns all registered accounts for a given notification type
|
||||
GetAccounts(notificationType NotificationType) []string
|
||||
}
|
||||
|
||||
// NotificationService is the high-level service interface for managing notifications
|
||||
|
||||
Reference in New Issue
Block a user