Documentation
¶
Index ¶
- Variables
- type AccountAutoSendConfig
- type Adapter
- func (a *Adapter) SendAccountDeleted(ctx context.Context, appID xid.ID, recipientEmail, userName, timestamp string) error
- func (a *Adapter) SendAccountReactivated(ctx context.Context, appID xid.ID, recipientEmail, userName, timestamp string) error
- func (a *Adapter) SendAccountSuspended(ctx context.Context, appID xid.ID, ...) error
- func (a *Adapter) SendAllSessionsRevoked(ctx context.Context, appID xid.ID, recipientEmail, userName, timestamp string) error
- func (a *Adapter) SendCustom(ctx context.Context, appID xid.ID, templateKey, recipient string, ...) error
- func (a *Adapter) SendDeviceRemoved(ctx context.Context, appID xid.ID, ...) 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) SendEmailChangeRequest(ctx context.Context, appID xid.ID, ...) error
- func (a *Adapter) SendEmailChanged(ctx context.Context, appID xid.ID, ...) 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) SendNewDeviceLogin(ctx context.Context, appID xid.ID, ...) error
- func (a *Adapter) SendNewLocationLogin(ctx context.Context, appID xid.ID, ...) error
- func (a *Adapter) SendOrgDeleted(ctx context.Context, appID xid.ID, recipientEmail, userName, orgName string) error
- func (a *Adapter) SendOrgInvite(ctx context.Context, appID xid.ID, ...) error
- func (a *Adapter) SendOrgMemberAdded(ctx context.Context, appID xid.ID, ...) error
- func (a *Adapter) SendOrgMemberLeft(ctx context.Context, appID xid.ID, ...) error
- func (a *Adapter) SendOrgMemberRemoved(ctx context.Context, appID xid.ID, ...) error
- func (a *Adapter) SendOrgRoleChanged(ctx context.Context, appID xid.ID, ...) error
- func (a *Adapter) SendOrgTransfer(ctx context.Context, appID xid.ID, ...) error
- func (a *Adapter) SendPasswordChanged(ctx context.Context, appID xid.ID, recipientEmail, userName, timestamp 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) SendSuspiciousLogin(ctx context.Context, appID xid.ID, ...) error
- func (a *Adapter) SendUsernameChanged(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
- func (a *Adapter) WithAppName(name string) *Adapter
- func (a *Adapter) WithAppService(appSvc interface{}) *Adapter
- type AsyncAdapter
- func (a *AsyncAdapter) SendAccountDeleted(ctx context.Context, appID xid.ID, recipientEmail, userName, timestamp string) error
- func (a *AsyncAdapter) SendAccountReactivated(ctx context.Context, appID xid.ID, recipientEmail, userName, timestamp string) error
- func (a *AsyncAdapter) SendAccountSuspended(ctx context.Context, appID xid.ID, email, userName, reason, timestamp string) error
- func (a *AsyncAdapter) SendAllSessionsRevoked(ctx context.Context, appID xid.ID, recipientEmail, userName, timestamp string) error
- func (a *AsyncAdapter) SendDeviceRemoved(ctx context.Context, appID xid.ID, ...) error
- func (a *AsyncAdapter) SendEmailChangeRequest(ctx context.Context, appID xid.ID, ...) error
- func (a *AsyncAdapter) SendEmailChanged(ctx context.Context, appID xid.ID, ...) error
- func (a *AsyncAdapter) SendEmailOTP(ctx context.Context, appID xid.ID, email, code string, expiryMinutes int) error
- func (a *AsyncAdapter) SendMFACode(ctx context.Context, appID xid.ID, recipient, code string, expiryMinutes int, ...) error
- func (a *AsyncAdapter) SendMagicLink(ctx context.Context, appID xid.ID, email, userName, magicLink string, ...) error
- func (a *AsyncAdapter) SendNewDeviceLogin(ctx context.Context, appID xid.ID, ...) error
- func (a *AsyncAdapter) SendNewLocationLogin(ctx context.Context, appID xid.ID, ...) error
- func (a *AsyncAdapter) SendOrgInvite(ctx context.Context, appID xid.ID, ...) error
- func (a *AsyncAdapter) SendOrgMemberAdded(ctx context.Context, appID xid.ID, ...) error
- func (a *AsyncAdapter) SendOrgMemberRemoved(ctx context.Context, appID xid.ID, ...) error
- func (a *AsyncAdapter) SendPasswordChanged(ctx context.Context, appID xid.ID, recipientEmail, userName, timestamp string) error
- func (a *AsyncAdapter) SendPasswordReset(ctx context.Context, appID xid.ID, email, userName, resetURL, resetCode string, ...) error
- func (a *AsyncAdapter) SendPhoneOTP(ctx context.Context, appID xid.ID, phone, code string) error
- func (a *AsyncAdapter) SendSecurityAlert(ctx context.Context, appID xid.ID, ...) error
- func (a *AsyncAdapter) SendSuspiciousLogin(ctx context.Context, appID xid.ID, ...) error
- func (a *AsyncAdapter) SendUsernameChanged(ctx context.Context, appID xid.ID, ...) error
- func (a *AsyncAdapter) SendVerificationEmail(ctx context.Context, appID xid.ID, ...) error
- func (a *AsyncAdapter) SendWelcomeEmail(ctx context.Context, appID xid.ID, email, userName, loginURL string) error
- type AsyncConfig
- type AuthAutoSendConfig
- type AutoSendConfig
- type ChannelsResponse
- type Config
- type DashboardExtension
- func (e *DashboardExtension) DashboardWidgets() []ui.DashboardWidget
- func (e *DashboardExtension) ExtensionID() string
- func (e *DashboardExtension) GetSampleTemplate(c forge.Context) error
- func (e *DashboardExtension) HandleUpdateSettings(c forge.Context) error
- func (e *DashboardExtension) NavigationItems() []ui.NavigationItem
- func (e *DashboardExtension) PreviewBuilderTemplate(c forge.Context) error
- 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) SaveBuilderTemplate(c forge.Context) error
- 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) ServeEmailBuilder(c forge.Context) error
- func (e *DashboardExtension) ServeEmailBuilderWithTemplate(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 DeclareABTestWinnerRequest
- type DeleteProviderRequest
- type DeleteTemplateRequest
- type EmailProviderConfig
- type ErrorResponse
- type GetABTestResultsRequest
- type GetNotificationRequest
- type GetProviderRequest
- type GetTemplateAnalyticsRequest
- type GetTemplateRequest
- type GetTemplateVersionRequest
- 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 OrganizationAutoSendConfig
- 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
- func (p *Plugin) Stop()
- 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 PreviewTemplateRequest
- type ProvidersConfig
- type RateLimit
- type RenderTemplateRequest
- type ResendConfig
- type ResendNotificationRequest
- type ResetTemplateRequest
- type RestoreTemplateVersionRequest
- type SMSProviderConfig
- type SendWithTemplateRequest
- type SessionAutoSendConfig
- 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
- type UpdateProviderRequest
- type UpdateTemplateRequest
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 AccountAutoSendConfig ¶ added in v0.0.6
type AccountAutoSendConfig struct {
EmailChangeRequest bool `json:"email_change_request" yaml:"email_change_request"`
EmailChanged bool `json:"email_changed" yaml:"email_changed"`
PasswordChanged bool `json:"password_changed" yaml:"password_changed"`
UsernameChanged bool `json:"username_changed" yaml:"username_changed"`
Deleted bool `json:"deleted" yaml:"deleted"`
Suspended bool `json:"suspended" yaml:"suspended"`
Reactivated bool `json:"reactivated" yaml:"reactivated"`
}
AccountAutoSendConfig controls account lifecycle notifications
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) SendAccountDeleted ¶ added in v0.0.6
func (a *Adapter) SendAccountDeleted(ctx context.Context, appID xid.ID, recipientEmail, userName, timestamp string) error
SendAccountDeleted sends notification when account is deleted
func (*Adapter) SendAccountReactivated ¶ added in v0.0.6
func (a *Adapter) SendAccountReactivated(ctx context.Context, appID xid.ID, recipientEmail, userName, timestamp string) error
SendAccountReactivated sends notification when account is reactivated
func (*Adapter) SendAccountSuspended ¶ added in v0.0.6
func (a *Adapter) SendAccountSuspended(ctx context.Context, appID xid.ID, recipientEmail, userName, reason, timestamp string) error
SendAccountSuspended sends notification when account is suspended
func (*Adapter) SendAllSessionsRevoked ¶ added in v0.0.6
func (a *Adapter) SendAllSessionsRevoked(ctx context.Context, appID xid.ID, recipientEmail, userName, timestamp string) error
SendAllSessionsRevoked sends notification when all sessions are signed out
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) SendDeviceRemoved ¶ added in v0.0.6
func (a *Adapter) SendDeviceRemoved(ctx context.Context, appID xid.ID, recipientEmail, userName, deviceName, timestamp string) error
SendDeviceRemoved sends notification when a device is removed from the account
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) SendEmailChangeRequest ¶ added in v0.0.6
func (a *Adapter) SendEmailChangeRequest(ctx context.Context, appID xid.ID, recipientEmail, userName, newEmail, confirmationUrl, timestamp string) error
SendEmailChangeRequest sends notification when user requests to change their email
func (*Adapter) SendEmailChanged ¶ added in v0.0.6
func (a *Adapter) SendEmailChanged(ctx context.Context, appID xid.ID, recipientEmail, userName, oldEmail, timestamp string) error
SendEmailChanged sends notification when email address is successfully changed
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) SendNewDeviceLogin ¶ added in v0.0.6
func (a *Adapter) SendNewDeviceLogin(ctx context.Context, appID xid.ID, recipientEmail, userName, deviceName, location, timestamp, ipAddress string) error
SendNewDeviceLogin sends notification when a user logs in from a new device
func (*Adapter) SendNewLocationLogin ¶ added in v0.0.6
func (a *Adapter) SendNewLocationLogin(ctx context.Context, appID xid.ID, recipientEmail, userName, location, timestamp, ipAddress string) error
SendNewLocationLogin sends notification when a user logs in from a new location
func (*Adapter) SendOrgDeleted ¶ added in v0.0.6
func (a *Adapter) SendOrgDeleted(ctx context.Context, appID xid.ID, recipientEmail, userName, orgName string) error
SendOrgDeleted sends notification when an organization is deleted
func (*Adapter) SendOrgInvite ¶ added in v0.0.6
func (a *Adapter) SendOrgInvite(ctx context.Context, appID xid.ID, recipientEmail, userName, inviterName, orgName, role, inviteURL string, expiresIn string) error
SendOrgInvite sends an organization invitation email
func (*Adapter) SendOrgMemberAdded ¶ added in v0.0.6
func (a *Adapter) SendOrgMemberAdded(ctx context.Context, appID xid.ID, recipientEmail, userName, memberName, orgName, role string) error
SendOrgMemberAdded sends notification when a member is added to organization
func (*Adapter) SendOrgMemberLeft ¶ added in v0.0.6
func (a *Adapter) SendOrgMemberLeft(ctx context.Context, appID xid.ID, recipientEmail, userName, memberName, orgName, timestamp string) error
SendOrgMemberLeft sends notification when a member leaves an organization
func (*Adapter) SendOrgMemberRemoved ¶ added in v0.0.6
func (a *Adapter) SendOrgMemberRemoved(ctx context.Context, appID xid.ID, recipientEmail, userName, memberName, orgName, timestamp string) error
SendOrgMemberRemoved sends notification when a member is removed from organization
func (*Adapter) SendOrgRoleChanged ¶ added in v0.0.6
func (a *Adapter) SendOrgRoleChanged(ctx context.Context, appID xid.ID, recipientEmail, userName, orgName, oldRole, newRole string) error
SendOrgRoleChanged sends notification when a member's role is changed
func (*Adapter) SendOrgTransfer ¶ added in v0.0.6
func (a *Adapter) SendOrgTransfer(ctx context.Context, appID xid.ID, recipientEmail, userName, orgName, transferredTo, timestamp string) error
SendOrgTransfer sends notification when organization ownership is transferred
func (*Adapter) SendPasswordChanged ¶ added in v0.0.6
func (a *Adapter) SendPasswordChanged(ctx context.Context, appID xid.ID, recipientEmail, userName, timestamp string) error
SendPasswordChanged sends notification when password is changed
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
func (*Adapter) SendSuspiciousLogin ¶ added in v0.0.6
func (a *Adapter) SendSuspiciousLogin(ctx context.Context, appID xid.ID, recipientEmail, userName, reason, location, timestamp, ipAddress string) error
SendSuspiciousLogin sends notification when suspicious login activity is detected
func (*Adapter) SendUsernameChanged ¶ added in v0.0.6
func (a *Adapter) SendUsernameChanged(ctx context.Context, appID xid.ID, recipientEmail, userName, oldUsername, newUsername, timestamp string) error
SendUsernameChanged sends notification when username is changed
func (*Adapter) SendVerificationEmail ¶
func (a *Adapter) SendVerificationEmail(ctx context.Context, appID xid.ID, email, userName, verificationURL, verificationCode string, expiryMinutes int) error
SendVerificationEmail sends an email verification link
func (*Adapter) SendWelcomeEmail ¶
func (a *Adapter) SendWelcomeEmail(ctx context.Context, appID xid.ID, email, userName, loginURL string) error
SendWelcomeEmail sends a welcome email to new users
func (*Adapter) WithAppName ¶ added in v0.0.6
WithAppName sets a static app name override
func (*Adapter) WithAppService ¶ added in v0.0.6
WithAppService sets the app service for dynamic app name lookup
type AsyncAdapter ¶ added in v0.0.7
type AsyncAdapter struct {
*Adapter
// contains filtered or unexported fields
}
AsyncAdapter wraps the standard Adapter to provide async notification sending based on notification priority. Critical notifications are sent synchronously, while non-critical notifications are sent asynchronously to avoid blocking.
func NewAsyncAdapter ¶ added in v0.0.7
func NewAsyncAdapter(adapter *Adapter, config AsyncConfig, dispatcher *notification.Dispatcher, retry *notification.RetryService) *AsyncAdapter
NewAsyncAdapter creates a new async notification adapter
func (*AsyncAdapter) SendAccountDeleted ¶ added in v0.0.7
func (a *AsyncAdapter) SendAccountDeleted(ctx context.Context, appID xid.ID, recipientEmail, userName, timestamp string) error
SendAccountDeleted sends an account deleted notification - NORMAL priority (async)
func (*AsyncAdapter) SendAccountReactivated ¶ added in v0.0.7
func (a *AsyncAdapter) SendAccountReactivated(ctx context.Context, appID xid.ID, recipientEmail, userName, timestamp string) error
SendAccountReactivated sends an account reactivated notification - NORMAL priority (async)
func (*AsyncAdapter) SendAccountSuspended ¶ added in v0.0.7
func (a *AsyncAdapter) SendAccountSuspended(ctx context.Context, appID xid.ID, email, userName, reason, timestamp string) error
SendAccountSuspended sends an account suspended notification - HIGH priority (async with logging)
func (*AsyncAdapter) SendAllSessionsRevoked ¶ added in v0.0.7
func (a *AsyncAdapter) SendAllSessionsRevoked(ctx context.Context, appID xid.ID, recipientEmail, userName, timestamp string) error
SendAllSessionsRevoked sends all sessions revoked notification - LOW priority (fire-and-forget)
func (*AsyncAdapter) SendDeviceRemoved ¶ added in v0.0.7
func (a *AsyncAdapter) SendDeviceRemoved(ctx context.Context, appID xid.ID, recipientEmail, userName, deviceName, timestamp string) error
SendDeviceRemoved sends a device removed notification - LOW priority (fire-and-forget)
func (*AsyncAdapter) SendEmailChangeRequest ¶ added in v0.0.7
func (a *AsyncAdapter) SendEmailChangeRequest(ctx context.Context, appID xid.ID, recipientEmail, userName, newEmail, confirmationUrl, timestamp string) error
SendEmailChangeRequest sends an email change request notification - HIGH priority (async with logging)
func (*AsyncAdapter) SendEmailChanged ¶ added in v0.0.7
func (a *AsyncAdapter) SendEmailChanged(ctx context.Context, appID xid.ID, recipientEmail, userName, oldEmail, timestamp string) error
SendEmailChanged sends an email changed notification - NORMAL priority (async)
func (*AsyncAdapter) SendEmailOTP ¶ added in v0.0.7
func (a *AsyncAdapter) SendEmailOTP(ctx context.Context, appID xid.ID, email, code string, expiryMinutes int) error
SendEmailOTP sends an email OTP code - CRITICAL priority (sync)
func (*AsyncAdapter) SendMFACode ¶ added in v0.0.7
func (a *AsyncAdapter) SendMFACode(ctx context.Context, appID xid.ID, recipient, code string, expiryMinutes int, notifType notification.NotificationType) error
SendMFACode sends an MFA verification code - CRITICAL priority (sync)
func (*AsyncAdapter) SendMagicLink ¶ added in v0.0.7
func (a *AsyncAdapter) SendMagicLink(ctx context.Context, appID xid.ID, email, userName, magicLink string, expiryMinutes int) error
SendMagicLink sends a magic link email - CRITICAL priority (sync)
func (*AsyncAdapter) SendNewDeviceLogin ¶ added in v0.0.7
func (a *AsyncAdapter) SendNewDeviceLogin(ctx context.Context, appID xid.ID, recipientEmail, userName, deviceName, location, timestamp, ipAddress string) error
SendNewDeviceLogin sends a new device login notification - LOW priority (fire-and-forget)
func (*AsyncAdapter) SendNewLocationLogin ¶ added in v0.0.7
func (a *AsyncAdapter) SendNewLocationLogin(ctx context.Context, appID xid.ID, recipientEmail, userName, location, timestamp, ipAddress string) error
SendNewLocationLogin sends a new location login notification - LOW priority (fire-and-forget)
func (*AsyncAdapter) SendOrgInvite ¶ added in v0.0.7
func (a *AsyncAdapter) SendOrgInvite(ctx context.Context, appID xid.ID, recipientEmail, userName, inviterName, orgName, role, inviteURL, expiresIn string) error
SendOrgInvite sends an organization invite notification - HIGH priority (async with logging)
func (*AsyncAdapter) SendOrgMemberAdded ¶ added in v0.0.7
func (a *AsyncAdapter) SendOrgMemberAdded(ctx context.Context, appID xid.ID, recipientEmail, userName, memberName, orgName, role string) error
SendOrgMemberAdded sends an organization member added notification - NORMAL priority (async)
func (*AsyncAdapter) SendOrgMemberRemoved ¶ added in v0.0.7
func (a *AsyncAdapter) SendOrgMemberRemoved(ctx context.Context, appID xid.ID, recipientEmail, userName, memberName, orgName, timestamp string) error
SendOrgMemberRemoved sends an organization member removed notification - NORMAL priority (async)
func (*AsyncAdapter) SendPasswordChanged ¶ added in v0.0.7
func (a *AsyncAdapter) SendPasswordChanged(ctx context.Context, appID xid.ID, recipientEmail, userName, timestamp string) error
SendPasswordChanged sends a password changed notification - NORMAL priority (async)
func (*AsyncAdapter) SendPasswordReset ¶ added in v0.0.7
func (a *AsyncAdapter) SendPasswordReset(ctx context.Context, appID xid.ID, email, userName, resetURL, resetCode string, expiryMinutes int) error
SendPasswordReset sends a password reset email - CRITICAL priority (sync)
func (*AsyncAdapter) SendPhoneOTP ¶ added in v0.0.7
SendPhoneOTP sends a phone OTP code - CRITICAL priority (sync)
func (*AsyncAdapter) SendSecurityAlert ¶ added in v0.0.7
func (a *AsyncAdapter) SendSecurityAlert(ctx context.Context, appID xid.ID, email, userName, eventType, eventTime, location, device string) error
SendSecurityAlert sends a security alert notification - HIGH priority (async with logging)
func (*AsyncAdapter) SendSuspiciousLogin ¶ added in v0.0.7
func (a *AsyncAdapter) SendSuspiciousLogin(ctx context.Context, appID xid.ID, recipientEmail, userName, reason, location, timestamp, ipAddress string) error
SendSuspiciousLogin sends a suspicious login alert - HIGH priority (async with logging)
func (*AsyncAdapter) SendUsernameChanged ¶ added in v0.0.7
func (a *AsyncAdapter) SendUsernameChanged(ctx context.Context, appID xid.ID, recipientEmail, userName, oldUsername, newUsername, timestamp string) error
SendUsernameChanged sends a username changed notification - NORMAL priority (async)
func (*AsyncAdapter) SendVerificationEmail ¶ added in v0.0.7
func (a *AsyncAdapter) SendVerificationEmail(ctx context.Context, appID xid.ID, email, userName, verificationURL, verificationCode string, expiryMinutes int) error
SendVerificationEmail sends a verification email - HIGH priority (async with logging)
func (*AsyncAdapter) SendWelcomeEmail ¶ added in v0.0.7
func (a *AsyncAdapter) SendWelcomeEmail(ctx context.Context, appID xid.ID, email, userName, loginURL string) error
SendWelcomeEmail sends a welcome email - NORMAL priority (async)
type AsyncConfig ¶ added in v0.0.7
type AsyncConfig struct {
// Enabled enables async processing for non-critical notifications
Enabled bool `json:"enabled" yaml:"enabled"`
// WorkerPoolSize is the number of workers for async processing
WorkerPoolSize int `json:"worker_pool_size" yaml:"worker_pool_size"`
// QueueSize is the buffer size for async queues
QueueSize int `json:"queue_size" yaml:"queue_size"`
// RetryEnabled enables retry for failed notifications
RetryEnabled bool `json:"retry_enabled" yaml:"retry_enabled"`
// MaxRetries is the maximum number of retry attempts
MaxRetries int `json:"max_retries" yaml:"max_retries"`
// RetryBackoff are the delays between retries (e.g., ["1m", "5m", "15m"])
RetryBackoff []string `json:"retry_backoff" yaml:"retry_backoff"`
// PersistFailures persists permanently failed notifications to DB
PersistFailures bool `json:"persist_failures" yaml:"persist_failures"`
}
AsyncConfig controls asynchronous notification processing
type AuthAutoSendConfig ¶ added in v0.0.6
type AuthAutoSendConfig struct {
Welcome bool `json:"welcome" yaml:"welcome"`
VerificationEmail bool `json:"verification_email" yaml:"verification_email"`
MagicLink bool `json:"magic_link" yaml:"magic_link"`
EmailOTP bool `json:"email_otp" yaml:"email_otp"`
MFACode bool `json:"mfa_code" yaml:"mfa_code"`
PasswordReset bool `json:"password_reset" yaml:"password_reset"`
}
AuthAutoSendConfig controls authentication-related notifications
type AutoSendConfig ¶ added in v0.0.6
type AutoSendConfig struct {
Auth AuthAutoSendConfig `json:"auth" yaml:"auth"`
Organization OrganizationAutoSendConfig `json:"organization" yaml:"organization"`
Session SessionAutoSendConfig `json:"session" yaml:"session"`
Account AccountAutoSendConfig `json:"account" yaml:"account"`
}
AutoSendConfig controls automatic notification sending for lifecycle events
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
// DEPRECATED: Use AutoSend.Auth.Welcome instead
AutoSendWelcome bool `json:"auto_send_welcome" yaml:"auto_send_welcome"`
// AutoSend configuration for automatic notification sending
AutoSend AutoSendConfig `json:"auto_send" yaml:"auto_send"`
// AppName is the default application name used in notifications
// If empty, will use the App name from the database
AppName string `json:"app_name" yaml:"app_name"`
// 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"`
// Async configuration for notification processing
Async AsyncConfig `json:"async" yaml:"async"`
}
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) GetSampleTemplate ¶ added in v0.0.3
func (e *DashboardExtension) GetSampleTemplate(c forge.Context) error
GetSampleTemplate returns a sample template by name
func (*DashboardExtension) HandleUpdateSettings ¶ added in v0.0.6
func (e *DashboardExtension) HandleUpdateSettings(c forge.Context) error
HandleUpdateSettings handles the settings update POST request
func (*DashboardExtension) NavigationItems ¶
func (e *DashboardExtension) NavigationItems() []ui.NavigationItem
NavigationItems returns navigation items to register
func (*DashboardExtension) PreviewBuilderTemplate ¶ added in v0.0.3
func (e *DashboardExtension) PreviewBuilderTemplate(c forge.Context) error
PreviewBuilderTemplate generates HTML preview from builder JSON
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) SaveBuilderTemplate ¶ added in v0.0.3
func (e *DashboardExtension) SaveBuilderTemplate(c forge.Context) error
SaveBuilderTemplate saves a template created with the visual builder
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) ServeEmailBuilder ¶ added in v0.0.3
func (e *DashboardExtension) ServeEmailBuilder(c forge.Context) error
ServeEmailBuilder serves the visual email template builder page
func (*DashboardExtension) ServeEmailBuilderWithTemplate ¶ added in v0.0.3
func (e *DashboardExtension) ServeEmailBuilderWithTemplate(c forge.Context) error
ServeEmailBuilderWithTemplate serves the builder with an existing template
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 by actually sending a test notification
func (*DashboardExtension) TestSendTemplate ¶
func (e *DashboardExtension) TestSendTemplate(c forge.Context) error
TestSendTemplate handles test send requests
type DeclareABTestWinnerRequest ¶ added in v0.0.7
type DeclareABTestWinnerRequest struct {
TemplateID string `path:"templateId" validate:"required"`
}
type DeleteProviderRequest ¶ added in v0.0.7
type DeleteProviderRequest struct {
ID string `path:"id" validate:"required"`
}
type DeleteTemplateRequest ¶ added in v0.0.7
type DeleteTemplateRequest struct {
ID string `path:"id" validate:"required"`
}
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 GetABTestResultsRequest ¶ added in v0.0.7
type GetABTestResultsRequest struct {
TemplateID string `path:"templateId" validate:"required"`
}
AB Test DTOs
type GetNotificationRequest ¶ added in v0.0.7
type GetNotificationRequest struct {
ID string `path:"id" validate:"required"`
}
Notification DTOs
type GetProviderRequest ¶ added in v0.0.7
type GetProviderRequest struct {
ID string `path:"id" validate:"required"`
}
Provider DTOs
type GetTemplateAnalyticsRequest ¶ added in v0.0.7
type GetTemplateAnalyticsRequest struct {
TemplateID string `path:"templateId" validate:"required"`
}
Analytics DTOs
type GetTemplateRequest ¶ added in v0.0.7
type GetTemplateRequest struct {
ID string `path:"id" validate:"required"`
}
Template DTOs
type GetTemplateVersionRequest ¶ added in v0.0.7
type GetTemplateVersionRequest struct {
TemplateID string `path:"templateId" validate:"required"`
VersionID string `path:"versionId" validate:"required"`
}
Template Version DTOs
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 OrganizationAutoSendConfig ¶ added in v0.0.6
type OrganizationAutoSendConfig struct {
Invite bool `json:"invite" yaml:"invite"`
MemberAdded bool `json:"member_added" yaml:"member_added"`
MemberRemoved bool `json:"member_removed" yaml:"member_removed"`
RoleChanged bool `json:"role_changed" yaml:"role_changed"`
Transfer bool `json:"transfer" yaml:"transfer"`
Deleted bool `json:"deleted" yaml:"deleted"`
MemberLeft bool `json:"member_left" yaml:"member_left"`
}
OrganizationAutoSendConfig controls organization-related notifications
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 and adapter
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 PreviewTemplateRequest ¶ added in v0.0.7
type PreviewTemplateRequest struct {
ID string `path:"id" validate:"required"`
}
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 RenderTemplateRequest ¶ added in v0.0.7
type RenderTemplateRequest struct {
ID string `path:"id" validate:"required"`
}
type ResendNotificationRequest ¶ added in v0.0.7
type ResendNotificationRequest struct {
ID string `path:"id" validate:"required"`
}
type ResetTemplateRequest ¶ added in v0.0.7
type ResetTemplateRequest struct {
ID string `path:"id" validate:"required"`
}
type RestoreTemplateVersionRequest ¶ added in v0.0.7
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 SessionAutoSendConfig ¶ added in v0.0.6
type SessionAutoSendConfig struct {
NewDevice bool `json:"new_device" yaml:"new_device"`
NewLocation bool `json:"new_location" yaml:"new_location"`
SuspiciousLogin bool `json:"suspicious_login" yaml:"suspicious_login"`
DeviceRemoved bool `json:"device_removed" yaml:"device_removed"`
AllRevoked bool `json:"all_revoked" yaml:"all_revoked"`
}
SessionAutoSendConfig controls session/device security notifications
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"`
}
type UpdateProviderRequest ¶ added in v0.0.7
type UpdateProviderRequest struct {
ID string `path:"id" validate:"required"`
}
type UpdateTemplateRequest ¶ added in v0.0.7
type UpdateTemplateRequest struct {
ID string `path:"id" validate:"required"`
}