Documentation
¶
Overview ¶
Package notify defines email and SMS provider contracts and bounded SendGrid and Twilio adapters. Applications own consent, templates, suppression, credentials, delivery policy, and provider compliance.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmailProviderNotConfigured indicates that email delivery is unavailable. ErrEmailProviderNotConfigured = errors.New("notify: email provider is not configured") // ErrSMSProviderNotConfigured indicates that SMS delivery is unavailable. ErrSMSProviderNotConfigured = errors.New("notify: SMS provider is not configured") )
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client routes notifications through explicitly configured providers.
func NewClient ¶
func NewClient(email EmailProvider, sms SMSProvider) (*Client, error)
NewClient constructs a notification router with at least one provider.
type EmailMessage ¶
EmailMessage is a bounded email delivery request.
type EmailProvider ¶
type EmailProvider interface {
SendEmail(context.Context, EmailMessage) error
}
EmailProvider sends validated email messages.
type SMSMessage ¶
SMSMessage is a bounded SMS delivery request.
type SMSProvider ¶
type SMSProvider interface {
SendSMS(context.Context, SMSMessage) error
}
SMSProvider sends validated SMS messages.
type SendGridConfig ¶
type SendGridConfig struct {
APIKey string
FromEmail string
FromName string
Endpoint string
HTTPClient *http.Client
Timeout time.Duration
MaxBodyBytes int
AllowInsecureHTTP bool
}
SendGridConfig defines credentials, sender identity, transport, and request bounds.
type SendGridProvider ¶
type SendGridProvider struct {
// contains filtered or unexported fields
}
SendGridProvider sends email through the SendGrid HTTPS API.
func NewSendGridProvider ¶
func NewSendGridProvider(config SendGridConfig) (*SendGridProvider, error)
NewSendGridProvider validates configuration without sending a request.
func (*SendGridProvider) SendEmail ¶
func (provider *SendGridProvider) SendEmail(ctx context.Context, message EmailMessage) error
SendEmail validates and submits one bounded SendGrid request.
type TwilioConfig ¶
type TwilioConfig struct {
AccountSID string
AuthToken string
FromPhone string
MessagingServiceSID string
Endpoint string
HTTPClient *http.Client
Timeout time.Duration
MaxTextBytes int
AllowInsecureHTTP bool
}
TwilioConfig defines credentials, sender identity, transport, and request bounds.
type TwilioProvider ¶
type TwilioProvider struct {
// contains filtered or unexported fields
}
TwilioProvider sends SMS messages through the Twilio HTTPS API.
func NewTwilioProvider ¶
func NewTwilioProvider(config TwilioConfig) (*TwilioProvider, error)
NewTwilioProvider validates configuration without sending a request.
func (*TwilioProvider) SendSMS ¶
func (provider *TwilioProvider) SendSMS(ctx context.Context, message SMSMessage) error
SendSMS validates and submits one bounded Twilio request.