Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidChannel = errors.New("invalid or missing channel") ErrToRequired = errors.New("to address is required") ErrBodyRequired = errors.New("body or html_body is required") )
View Source
var ErrConfigPathRequired = errors.New("notification config path is required")
Functions ¶
This section is empty.
Types ¶
type ChannelType ¶
type ChannelType string
ChannelType identifies the delivery channel for a notification.
const ( ChannelSMS ChannelType = "sms" ChannelEmail ChannelType = "email" )
type Config ¶
type Config struct {
Path string
}
Config holds the file-based notifications subsystem configuration.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager routes notification requests to registered providers. It is safe for concurrent use after construction.
func NewManager ¶
NewManager loads the provider config from cfg.Path, configures each provider from its JSON blob, and returns a ready Manager. Returns an error if cfg is invalid, the config file cannot be read, a provider's key is missing from the file, or any provider's Configure call fails.
type Provider ¶
type Provider interface {
Type() ChannelType
Configure(cfg json.RawMessage) error
Send(ctx context.Context, req Request) error
}
Provider is implemented by each notification channel (email, SMS, etc.).
Click to show internal directories.
Click to hide internal directories.