Documentation
¶
Overview ¶
Package registry provides provider registration functionality. This is a subpackage of app to avoid circular imports when providers register themselves via init().
Index ¶
- func IsChatProviderRegistered(name string) bool
- func IsEmailProviderRegistered(name string) bool
- func IsPushProviderRegistered(name string) bool
- func IsSMSProviderRegistered(name string) bool
- func RegisterChatProvider(name string, factory ChatProviderFactory)
- func RegisterEmailProvider(name string, factory EmailProviderFactory)
- func RegisterPushProvider(name string, factory PushProviderFactory)
- func RegisterSMSProvider(name string, factory SMSProviderFactory)
- type ChatConfig
- type ChatProviderFactory
- type CommonConfig
- type EmailConfig
- type EmailProviderFactory
- type MailpitConfig
- type PushConfig
- type PushProviderFactory
- type SMSConfig
- type SMSProviderFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsChatProviderRegistered ¶
IsChatProviderRegistered checks if a chat provider is registered.
func IsEmailProviderRegistered ¶
IsEmailProviderRegistered checks if an email provider is registered.
func IsPushProviderRegistered ¶
IsPushProviderRegistered checks if a push provider is registered.
func IsSMSProviderRegistered ¶
IsSMSProviderRegistered checks if an SMS provider is registered.
func RegisterChatProvider ¶
func RegisterChatProvider(name string, factory ChatProviderFactory)
RegisterChatProvider registers a chat provider factory.
func RegisterEmailProvider ¶
func RegisterEmailProvider(name string, factory EmailProviderFactory)
RegisterEmailProvider registers an email provider factory. Call this in your provider's init() function.
func RegisterPushProvider ¶
func RegisterPushProvider(name string, factory PushProviderFactory)
RegisterPushProvider registers a push provider factory.
func RegisterSMSProvider ¶
func RegisterSMSProvider(name string, factory SMSProviderFactory)
RegisterSMSProvider registers an SMS provider factory.
Types ¶
type ChatConfig ¶
type ChatConfig struct {
CommonConfig
FromPhone string
WebhookURL string
}
ChatConfig holds chat provider configuration.
type ChatProviderFactory ¶
type ChatProviderFactory func(cfg ChatConfig) (port.ChatSender, error)
ChatProviderFactory creates a chat provider from config.
func GetChatFactory ¶
func GetChatFactory(name string) (ChatProviderFactory, error)
GetChatFactory returns a chat provider factory by name.
type CommonConfig ¶
type CommonConfig struct {
APIKey string
APISecret string
Region string
BaseURL string
Extra map[string]string
}
CommonConfig shared fields across all providers.
type EmailConfig ¶
type EmailConfig struct {
CommonConfig
Domain string
FromEmail string
FromName string
}
EmailConfig holds email provider configuration.
type EmailProviderFactory ¶
type EmailProviderFactory func(cfg EmailConfig, mailpit MailpitConfig) (port.EmailSender, error)
EmailProviderFactory creates an email provider from config.
func GetEmailFactory ¶
func GetEmailFactory(name string) (EmailProviderFactory, error)
GetEmailFactory returns an email provider factory by name.
type MailpitConfig ¶
type MailpitConfig struct {
Enabled bool
}
MailpitConfig holds SMTP forwarding configuration.
type PushConfig ¶
type PushConfig struct {
CommonConfig
AppID string
Topic string
}
PushConfig holds push notification provider configuration.
type PushProviderFactory ¶
type PushProviderFactory func(cfg PushConfig) (port.PushSender, error)
PushProviderFactory creates a push provider from config.
func GetPushFactory ¶
func GetPushFactory(name string) (PushProviderFactory, error)
GetPushFactory returns a push provider factory by name.
type SMSConfig ¶
type SMSConfig struct {
CommonConfig
FromPhone string
}
SMSConfig holds SMS provider configuration.
type SMSProviderFactory ¶
SMSProviderFactory creates an SMS provider from config.
func GetSMSFactory ¶
func GetSMSFactory(name string) (SMSProviderFactory, error)
GetSMSFactory returns an SMS provider factory by name.