Documentation
¶
Index ¶
- Variables
- type Adapter
- func (a *Adapter) SendCustom(ctx context.Context, appID xid.ID, templateKey, recipient string, ...) error
- func (a *Adapter) SendDirectEmail(ctx context.Context, appID xid.ID, recipient, subject, body string) error
- func (a *Adapter) SendDirectSMS(ctx context.Context, appID xid.ID, recipient, body string) error
- func (a *Adapter) SendEmailOTP(ctx context.Context, appID xid.ID, email, code string, expiryMinutes int) error
- func (a *Adapter) SendMFACode(ctx context.Context, appID xid.ID, recipient, code string, expiryMinutes int, ...) error
- func (a *Adapter) SendMagicLink(ctx context.Context, appID xid.ID, email, userName, magicLink string, ...) error
- func (a *Adapter) SendPasswordReset(ctx context.Context, appID xid.ID, email, userName, resetURL, resetCode string, ...) error
- func (a *Adapter) SendPhoneOTP(ctx context.Context, appID xid.ID, phone, code string) error
- func (a *Adapter) SendSecurityAlert(ctx context.Context, appID xid.ID, ...) error
- func (a *Adapter) SendVerificationEmail(ctx context.Context, appID xid.ID, ...) error
- func (a *Adapter) SendWelcomeEmail(ctx context.Context, appID xid.ID, email, userName, loginURL string) error
- type ChannelsResponse
- type Config
- type DashboardExtension
- func (e *DashboardExtension) DashboardWidgets() []ui.DashboardWidget
- func (e *DashboardExtension) ExtensionID() string
- func (e *DashboardExtension) NavigationItems() []ui.NavigationItem
- func (e *DashboardExtension) PreviewTemplate(c forge.Context) error
- func (e *DashboardExtension) RenderDashboardWidget(basePath string, currentApp *app.App) g.Node
- func (e *DashboardExtension) Routes() []ui.Route
- func (e *DashboardExtension) SaveNotificationSettings(c forge.Context) error
- func (e *DashboardExtension) ServeAnalyticsSettings(c forge.Context) error
- func (e *DashboardExtension) ServeCreateTemplate(c forge.Context) error
- func (e *DashboardExtension) ServeEditTemplate(c forge.Context) error
- func (e *DashboardExtension) ServeNotificationSettings(c forge.Context) error
- func (e *DashboardExtension) ServeNotificationsOverview(c forge.Context) error
- func (e *DashboardExtension) ServeProviderSettings(c forge.Context) error
- func (e *DashboardExtension) ServeTemplatesList(c forge.Context) error
- func (e *DashboardExtension) SetRegistry(registry *dashboard.ExtensionRegistry)
- func (e *DashboardExtension) SettingsPages() []ui.SettingsPage
- func (e *DashboardExtension) SettingsSections() []ui.SettingsSection
- func (e *DashboardExtension) TestProvider(c forge.Context) error
- func (e *DashboardExtension) TestSendTemplate(c forge.Context) error
- type EmailProviderConfig
- type ErrorResponse
- type Handler
- func (h *Handler) CreateABTestVariant(c forge.Context) error
- func (h *Handler) CreateProvider(c forge.Context) error
- func (h *Handler) CreateTemplate(c forge.Context) error
- func (h *Handler) CreateTemplateVersion(c forge.Context) error
- func (h *Handler) DeclareABTestWinner(c forge.Context) error
- func (h *Handler) DeleteProvider(c forge.Context) error
- func (h *Handler) DeleteTemplate(c forge.Context) error
- func (h *Handler) GetABTestResults(c forge.Context) error
- func (h *Handler) GetAppAnalytics(c forge.Context) error
- func (h *Handler) GetNotification(c forge.Context) error
- func (h *Handler) GetOrgAnalytics(c forge.Context) error
- func (h *Handler) GetProvider(c forge.Context) error
- func (h *Handler) GetTemplate(c forge.Context) error
- func (h *Handler) GetTemplateAnalytics(c forge.Context) error
- func (h *Handler) GetTemplateDefaults(c forge.Context) error
- func (h *Handler) GetTemplateVersion(c forge.Context) error
- func (h *Handler) HandleWebhook(c forge.Context) error
- func (h *Handler) ListNotifications(c forge.Context) error
- func (h *Handler) ListProviders(c forge.Context) error
- func (h *Handler) ListTemplateVersions(c forge.Context) error
- func (h *Handler) ListTemplates(c forge.Context) error
- func (h *Handler) PreviewTemplate(c forge.Context) error
- func (h *Handler) RenderTemplate(c forge.Context) error
- func (h *Handler) ResendNotification(c forge.Context) error
- func (h *Handler) ResetAllTemplates(c forge.Context) error
- func (h *Handler) ResetTemplate(c forge.Context) error
- func (h *Handler) RestoreTemplateVersion(c forge.Context) error
- func (h *Handler) SendNotification(c forge.Context) error
- func (h *Handler) TrackNotificationEvent(c forge.Context) error
- func (h *Handler) UpdateProvider(c forge.Context) error
- func (h *Handler) UpdateTemplate(c forge.Context) error
- type MailerSendConfig
- type MessageResponse
- type NotificationErrorResponse
- type NotificationListResponse
- type NotificationPreviewResponse
- type NotificationResponse
- type NotificationStatusResponse
- type NotificationTemplateListResponse
- type NotificationTemplateResponse
- type NotificationWebhookResponse
- type NotificationsResponse
- type Plugin
- func (p *Plugin) DashboardExtension() ui.DashboardExtension
- func (p *Plugin) GetService() *notification.Service
- func (p *Plugin) GetTemplateService() *TemplateService
- func (p *Plugin) ID() string
- func (p *Plugin) Init(authInst core.Authsome) error
- func (p *Plugin) Migrate() error
- func (p *Plugin) RegisterHooks(hookRegistry *hooks.HookRegistry) error
- func (p *Plugin) RegisterRoutes(router forge.Router) error
- func (p *Plugin) RegisterServiceDecorators(services *registry.ServiceRegistry) error
- type PluginOption
- func WithAddDefaultTemplates(add bool) PluginOption
- func WithAllowAppOverrides(allow bool) PluginOption
- func WithAutoSendWelcome(auto bool) PluginOption
- func WithDefaultConfig(cfg Config) PluginOption
- func WithDefaultLanguage(lang string) PluginOption
- func WithEmailProvider(provider, from, fromName string) PluginOption
- func WithRetryConfig(attempts int, delay time.Duration) PluginOption
- func WithSMSProvider(provider, from string) PluginOption
- type PostmarkConfig
- type ProvidersConfig
- type RateLimit
- type ResendConfig
- type SMSProviderConfig
- type SendWithTemplateRequest
- type StatusResponse
- type SuccessResponse
- type TemplateDefault
- type TemplateEngine
- type TemplateService
- func (s *TemplateService) RenderTemplate(ctx context.Context, templateID xid.ID, variables map[string]interface{}) (subject, body string, err error)
- func (s *TemplateService) SendDirect(ctx context.Context, appID xid.ID, notifType notification.NotificationType, ...) (*notification.Notification, error)
- func (s *TemplateService) SendEmail(ctx context.Context, appID xid.ID, templateKey, to string, ...) error
- func (s *TemplateService) SendSMS(ctx context.Context, appID xid.ID, templateKey, to string, ...) error
- func (s *TemplateService) SendWithTemplate(ctx context.Context, req *SendWithTemplateRequest) (*notification.Notification, error)
- type TemplatesResponse
Constants ¶
This section is empty.
Variables ¶
var ( NewResendProvider = providers.NewResendProvider NewMailerSendProvider = providers.NewMailerSendProvider NewPostmarkProvider = providers.NewPostmarkProvider )
Re-export provider constructors
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter provides a simplified interface for plugins to send notifications
func NewAdapter ¶
func NewAdapter(templateSvc *TemplateService) *Adapter
NewAdapter creates a new notification adapter
func (*Adapter) SendCustom ¶
func (a *Adapter) SendCustom(ctx context.Context, appID xid.ID, templateKey, recipient string, notifType notification.NotificationType, variables map[string]interface{}) error
SendCustom sends a notification using a custom template
func (*Adapter) SendDirectEmail ¶
func (a *Adapter) SendDirectEmail(ctx context.Context, appID xid.ID, recipient, subject, body string) error
SendDirectEmail sends an email without using a template
func (*Adapter) SendDirectSMS ¶
SendDirectSMS sends an SMS without using a template
func (*Adapter) SendEmailOTP ¶
func (a *Adapter) SendEmailOTP(ctx context.Context, appID xid.ID, email, code string, expiryMinutes int) error
SendEmailOTP sends an email OTP code
func (*Adapter) SendMFACode ¶
func (a *Adapter) SendMFACode(ctx context.Context, appID xid.ID, recipient, code string, expiryMinutes int, notifType notification.NotificationType) error
SendMFACode sends an MFA verification code via email or SMS
func (*Adapter) SendMagicLink ¶
func (a *Adapter) SendMagicLink(ctx context.Context, appID xid.ID, email, userName, magicLink string, expiryMinutes int) error
SendMagicLink sends a magic link email
func (*Adapter) SendPasswordReset ¶
func (a *Adapter) SendPasswordReset(ctx context.Context, appID xid.ID, email, userName, resetURL, resetCode string, expiryMinutes int) error
SendPasswordReset sends a password reset email
func (*Adapter) SendPhoneOTP ¶
SendPhoneOTP sends a phone OTP code via SMS
func (*Adapter) SendSecurityAlert ¶
func (a *Adapter) SendSecurityAlert(ctx context.Context, appID xid.ID, email, userName, eventType, eventTime, location, device string) error
SendSecurityAlert sends a security alert notification
type ChannelsResponse ¶
type ChannelsResponse struct {
Channels interface{} `json:"channels"`
Count int `json:"count"`
}
type Config ¶
type Config struct {
// AddDefaultTemplates automatically adds default templates on startup
AddDefaultTemplates bool `json:"add_default_templates" yaml:"add_default_templates"`
// DefaultLanguage is the default language for templates
DefaultLanguage string `json:"default_language" yaml:"default_language"`
// AllowAppOverrides allows apps to override default templates in SaaS mode
AllowAppOverrides bool `json:"allow_app_overrides" yaml:"allow_app_overrides"`
// AutoPopulateTemplates creates default templates for new apps
AutoPopulateTemplates bool `json:"auto_populate_templates" yaml:"auto_populate_templates"`
// AllowTemplateReset enables template reset functionality
AllowTemplateReset bool `json:"allow_template_reset" yaml:"allow_template_reset"`
// AutoSendWelcome automatically sends welcome email on user signup
AutoSendWelcome bool `json:"auto_send_welcome" yaml:"auto_send_welcome"`
// RetryAttempts is the number of retry attempts for failed notifications
RetryAttempts int `json:"retry_attempts" yaml:"retry_attempts"`
// RetryDelay is the delay between retry attempts
RetryDelay time.Duration `json:"retry_delay" yaml:"retry_delay"`
// CleanupAfter is the duration after which old notifications are deleted
CleanupAfter time.Duration `json:"cleanup_after" yaml:"cleanup_after"`
// RateLimits defines rate limits for notification sending
RateLimits map[string]RateLimit `json:"rate_limits" yaml:"rate_limits"`
// Providers configuration for email and SMS
Providers ProvidersConfig `json:"providers" yaml:"providers"`
}
Config holds the notification plugin configuration
type DashboardExtension ¶
type DashboardExtension struct {
// contains filtered or unexported fields
}
DashboardExtension implements the ui.DashboardExtension interface This allows the notification plugin to add its own screens to the dashboard
func NewDashboardExtension ¶
func NewDashboardExtension(plugin *Plugin) *DashboardExtension
NewDashboardExtension creates a new dashboard extension for notification plugin
func (*DashboardExtension) DashboardWidgets ¶
func (e *DashboardExtension) DashboardWidgets() []ui.DashboardWidget
DashboardWidgets returns widgets to show on the main dashboard
func (*DashboardExtension) ExtensionID ¶
func (e *DashboardExtension) ExtensionID() string
ExtensionID returns the unique identifier for this extension
func (*DashboardExtension) NavigationItems ¶
func (e *DashboardExtension) NavigationItems() []ui.NavigationItem
NavigationItems returns navigation items to register
func (*DashboardExtension) PreviewTemplate ¶
func (e *DashboardExtension) PreviewTemplate(c forge.Context) error
PreviewTemplate handles template preview requests
func (*DashboardExtension) RenderDashboardWidget ¶
RenderDashboardWidget renders the notification stats widget
func (*DashboardExtension) Routes ¶
func (e *DashboardExtension) Routes() []ui.Route
Routes returns routes to register under /dashboard/app/:appId/
func (*DashboardExtension) SaveNotificationSettings ¶
func (e *DashboardExtension) SaveNotificationSettings(c forge.Context) error
SaveNotificationSettings handles saving notification settings
func (*DashboardExtension) ServeAnalyticsSettings ¶
func (e *DashboardExtension) ServeAnalyticsSettings(c forge.Context) error
ServeAnalyticsSettings renders the analytics page
func (*DashboardExtension) ServeCreateTemplate ¶
func (e *DashboardExtension) ServeCreateTemplate(c forge.Context) error
ServeCreateTemplate renders the create template page
func (*DashboardExtension) ServeEditTemplate ¶
func (e *DashboardExtension) ServeEditTemplate(c forge.Context) error
ServeEditTemplate renders the edit template page
func (*DashboardExtension) ServeNotificationSettings ¶
func (e *DashboardExtension) ServeNotificationSettings(c forge.Context) error
ServeNotificationSettings renders the notification settings page
func (*DashboardExtension) ServeNotificationsOverview ¶
func (e *DashboardExtension) ServeNotificationsOverview(c forge.Context) error
ServeNotificationsOverview renders the notifications overview page
func (*DashboardExtension) ServeProviderSettings ¶
func (e *DashboardExtension) ServeProviderSettings(c forge.Context) error
ServeProviderSettings renders the provider settings page
func (*DashboardExtension) ServeTemplatesList ¶
func (e *DashboardExtension) ServeTemplatesList(c forge.Context) error
ServeTemplatesList renders the templates list page
func (*DashboardExtension) SetRegistry ¶
func (e *DashboardExtension) SetRegistry(registry *dashboard.ExtensionRegistry)
SetRegistry sets the extension registry reference (called by dashboard after registration)
func (*DashboardExtension) SettingsPages ¶
func (e *DashboardExtension) SettingsPages() []ui.SettingsPage
SettingsPages returns full settings pages for the sidebar layout
func (*DashboardExtension) SettingsSections ¶
func (e *DashboardExtension) SettingsSections() []ui.SettingsSection
SettingsSections returns settings sections for backward compatibility Deprecated: Use SettingsPages() instead
func (*DashboardExtension) TestProvider ¶
func (e *DashboardExtension) TestProvider(c forge.Context) error
TestProvider handles provider test requests
func (*DashboardExtension) TestSendTemplate ¶
func (e *DashboardExtension) TestSendTemplate(c forge.Context) error
TestSendTemplate handles test send requests
type EmailProviderConfig ¶
type EmailProviderConfig struct {
Provider string `json:"provider" yaml:"provider"` // smtp, sendgrid, ses, etc.
From string `json:"from" yaml:"from"`
FromName string `json:"from_name" yaml:"from_name"`
ReplyTo string `json:"reply_to" yaml:"reply_to"`
Config map[string]interface{} `json:"config" yaml:"config"`
}
EmailProviderConfig holds email provider configuration
type ErrorResponse ¶
type ErrorResponse = responses.ErrorResponse
Response types - use shared responses from core
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles notification HTTP requests
func NewHandler ¶
func NewHandler(service *notification.Service, templateSvc *TemplateService, config Config) *Handler
NewHandler creates a new notification handler
func (*Handler) CreateABTestVariant ¶
CreateABTestVariant creates a new A/B test variant
func (*Handler) CreateProvider ¶
CreateProvider creates a new notification provider
func (*Handler) CreateTemplate ¶
CreateTemplate creates a new notification template
func (*Handler) CreateTemplateVersion ¶
CreateTemplateVersion creates a new version for a template
func (*Handler) DeclareABTestWinner ¶
DeclareABTestWinner declares a winner for an A/B test
func (*Handler) DeleteProvider ¶
DeleteProvider deletes a provider
func (*Handler) DeleteTemplate ¶
DeleteTemplate deletes a template
func (*Handler) GetABTestResults ¶
GetABTestResults retrieves A/B test results for a test group
func (*Handler) GetAppAnalytics ¶
GetAppAnalytics retrieves analytics for an app
func (*Handler) GetNotification ¶
GetNotification retrieves a notification by ID
func (*Handler) GetOrgAnalytics ¶
GetOrgAnalytics retrieves analytics for an organization
func (*Handler) GetProvider ¶
GetProvider retrieves a provider by ID
func (*Handler) GetTemplate ¶
GetTemplate retrieves a template by ID
func (*Handler) GetTemplateAnalytics ¶
GetTemplateAnalytics retrieves analytics for a template
func (*Handler) GetTemplateDefaults ¶
GetTemplateDefaults returns default template metadata
func (*Handler) GetTemplateVersion ¶
GetTemplateVersion retrieves a specific template version
func (*Handler) HandleWebhook ¶
HandleWebhook handles provider webhook callbacks
func (*Handler) ListNotifications ¶
ListNotifications lists all notifications with pagination
func (*Handler) ListProviders ¶
ListProviders lists all providers for an app/org
func (*Handler) ListTemplateVersions ¶
ListTemplateVersions lists all versions for a template
func (*Handler) ListTemplates ¶
ListTemplates lists all templates with pagination
func (*Handler) PreviewTemplate ¶
PreviewTemplate renders a template with provided variables
func (*Handler) RenderTemplate ¶
RenderTemplate renders a template string with variables (no template ID required)
func (*Handler) ResendNotification ¶
ResendNotification resends a notification
func (*Handler) ResetAllTemplates ¶
ResetAllTemplates resets all templates for an app to defaults
func (*Handler) ResetTemplate ¶
ResetTemplate resets a template to default values
func (*Handler) RestoreTemplateVersion ¶
RestoreTemplateVersion restores a template to a previous version
func (*Handler) SendNotification ¶
SendNotification sends a notification
func (*Handler) TrackNotificationEvent ¶
TrackNotificationEvent tracks an analytics event
func (*Handler) UpdateProvider ¶
UpdateProvider updates a provider's configuration
type MailerSendConfig ¶
type MailerSendConfig = providers.MailerSendConfig
Re-export provider config types
type MessageResponse ¶
type MessageResponse = responses.MessageResponse
type NotificationErrorResponse ¶
type NotificationErrorResponse struct {
Error string `json:"error" example:"Error message"`
}
Response types for notification routes
type NotificationListResponse ¶
type NotificationListResponse struct {
Notifications []interface{} `json:"notifications"`
Total int `json:"total" example:"50"`
}
type NotificationResponse ¶
type NotificationResponse struct {
Notification interface{} `json:"notification"`
}
type NotificationStatusResponse ¶
type NotificationStatusResponse struct {
Status string `json:"status" example:"success"`
}
type NotificationTemplateListResponse ¶
type NotificationTemplateListResponse struct {
Templates []interface{} `json:"templates"`
Total int `json:"total" example:"10"`
}
type NotificationTemplateResponse ¶
type NotificationTemplateResponse struct {
Template interface{} `json:"template"`
}
type NotificationWebhookResponse ¶
type NotificationWebhookResponse struct {
Status string `json:"status" example:"processed"`
}
type NotificationsResponse ¶
type NotificationsResponse struct {
Notifications interface{} `json:"notifications"`
Count int `json:"count"`
}
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin implements the notification template management plugin
func NewPlugin ¶
func NewPlugin(opts ...PluginOption) *Plugin
NewPlugin creates a new notification plugin instance with optional configuration
func (*Plugin) DashboardExtension ¶
func (p *Plugin) DashboardExtension() ui.DashboardExtension
DashboardExtension returns the dashboard extension interface implementation
func (*Plugin) GetService ¶
func (p *Plugin) GetService() *notification.Service
GetService returns the notification service for use by other plugins
func (*Plugin) GetTemplateService ¶
func (p *Plugin) GetTemplateService() *TemplateService
GetTemplateService returns the template service for use by other plugins
func (*Plugin) RegisterHooks ¶
func (p *Plugin) RegisterHooks(hookRegistry *hooks.HookRegistry) error
RegisterHooks registers plugin hooks
func (*Plugin) RegisterRoutes ¶
RegisterRoutes registers HTTP routes for the plugin
func (*Plugin) RegisterServiceDecorators ¶
func (p *Plugin) RegisterServiceDecorators(services *registry.ServiceRegistry) error
RegisterServiceDecorators registers the notification service TODO: Implement when service registry is available
type PluginOption ¶
type PluginOption func(*Plugin)
PluginOption is a functional option for configuring the notification plugin
func WithAddDefaultTemplates ¶
func WithAddDefaultTemplates(add bool) PluginOption
WithAddDefaultTemplates sets whether to add default templates
func WithAllowAppOverrides ¶
func WithAllowAppOverrides(allow bool) PluginOption
WithAllowOrgOverrides sets whether to allow organization overrides
func WithAutoSendWelcome ¶
func WithAutoSendWelcome(auto bool) PluginOption
WithAutoSendWelcome sets whether to auto-send welcome emails
func WithDefaultConfig ¶
func WithDefaultConfig(cfg Config) PluginOption
WithDefaultConfig sets the default configuration for the plugin
func WithDefaultLanguage ¶
func WithDefaultLanguage(lang string) PluginOption
WithDefaultLanguage sets the default language
func WithEmailProvider ¶
func WithEmailProvider(provider, from, fromName string) PluginOption
WithEmailProvider sets the email provider configuration
func WithRetryConfig ¶
func WithRetryConfig(attempts int, delay time.Duration) PluginOption
WithRetryConfig sets the retry configuration
func WithSMSProvider ¶
func WithSMSProvider(provider, from string) PluginOption
WithSMSProvider sets the SMS provider configuration
type PostmarkConfig ¶
type PostmarkConfig = providers.PostmarkConfig
Re-export provider config types
type ProvidersConfig ¶
type ProvidersConfig struct {
Email EmailProviderConfig `json:"email" yaml:"email"`
SMS *SMSProviderConfig `json:"sms,omitempty" yaml:"sms,omitempty"` // Optional SMS provider
}
ProvidersConfig holds provider configurations
type RateLimit ¶
type RateLimit struct {
MaxRequests int `json:"max_requests" yaml:"max_requests"`
Window time.Duration `json:"window" yaml:"window"`
}
RateLimit defines rate limiting configuration
type SMSProviderConfig ¶
type SMSProviderConfig struct {
Provider string `json:"provider" yaml:"provider"` // twilio, vonage, aws-sns, etc.
From string `json:"from" yaml:"from"`
Config map[string]interface{} `json:"config" yaml:"config"`
}
SMSProviderConfig holds SMS provider configuration
type SendWithTemplateRequest ¶
type SendWithTemplateRequest struct {
AppID xid.ID `json:"appId"`
TemplateKey string `json:"templateKey"`
Type notification.NotificationType `json:"type"`
Recipient string `json:"recipient"`
Variables map[string]interface{} `json:"variables"`
Language string `json:"language,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
SendWithTemplateRequest represents a request to send a notification using a template
type StatusResponse ¶
type StatusResponse = responses.StatusResponse
type SuccessResponse ¶
type SuccessResponse = responses.SuccessResponse
type TemplateDefault ¶
type TemplateDefault struct {
TemplateKey string
Type string
Subject string
BodyText string
BodyHTML string
Variables []string
Description string
}
TemplateDefault represents a default template
func DefaultTemplates ¶
func DefaultTemplates() []TemplateDefault
DefaultTemplates returns the default notification templates
type TemplateEngine ¶
type TemplateEngine struct {
// contains filtered or unexported fields
}
TemplateEngine provides template rendering functionality
func NewTemplateEngine ¶
func NewTemplateEngine() *TemplateEngine
NewTemplateEngine creates a new template engine
func (*TemplateEngine) ExtractVariables ¶
func (e *TemplateEngine) ExtractVariables(templateStr string) ([]string, error)
ExtractVariables extracts variable names from a template
func (*TemplateEngine) Render ¶
func (e *TemplateEngine) Render(templateStr string, variables map[string]interface{}) (string, error)
Render renders a template with the given variables
func (*TemplateEngine) ValidateTemplate ¶
func (e *TemplateEngine) ValidateTemplate(templateStr string) error
ValidateTemplate validates a template for syntax errors
type TemplateService ¶
type TemplateService struct {
// contains filtered or unexported fields
}
TemplateService provides template-aware notification functionality
func NewTemplateService ¶
func NewTemplateService( notificationSvc *notification.Service, repo notification.Repository, config Config, ) *TemplateService
NewTemplateService creates a new template service
func (*TemplateService) RenderTemplate ¶
func (s *TemplateService) RenderTemplate(ctx context.Context, templateID xid.ID, variables map[string]interface{}) (subject, body string, err error)
RenderTemplate renders a template with variables without sending
func (*TemplateService) SendDirect ¶
func (s *TemplateService) SendDirect(ctx context.Context, appID xid.ID, notifType notification.NotificationType, recipient, subject, body string, metadata map[string]interface{}) (*notification.Notification, error)
SendDirect sends a notification without using a template
func (*TemplateService) SendEmail ¶
func (s *TemplateService) SendEmail(ctx context.Context, appID xid.ID, templateKey, to string, variables map[string]interface{}) error
SendEmail sends an email notification
func (*TemplateService) SendSMS ¶
func (s *TemplateService) SendSMS(ctx context.Context, appID xid.ID, templateKey, to string, variables map[string]interface{}) error
SendSMS sends an SMS notification
func (*TemplateService) SendWithTemplate ¶
func (s *TemplateService) SendWithTemplate(ctx context.Context, req *SendWithTemplateRequest) (*notification.Notification, error)
SendWithTemplate sends a notification using a template
type TemplatesResponse ¶
type TemplatesResponse struct {
Templates interface{} `json:"templates"`
Count int `json:"count"`
}