Documentation
¶
Overview ¶
Package templates provides email template management.
Index ¶
- type Registry
- func (r *Registry) GetTemplate(templateType TemplateType) (*Template, error)
- func (r *Registry) ListTemplates() []*Template
- func (r *Registry) RegisterTemplate(tmpl *Template)
- func (r *Registry) RenderSubject(tmpl *Template, data map[string]interface{}) (string, error)
- func (r *Registry) RenderTemplate(tmpl *Template, data map[string]interface{}) (string, error)
- func (r *Registry) RenderTextTemplate(tmpl *Template, data map[string]interface{}) (string, error)
- type Template
- type TemplateType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages email templates.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates a new template registry with default templates.
func (*Registry) GetTemplate ¶
func (r *Registry) GetTemplate(templateType TemplateType) (*Template, error)
GetTemplate returns the template for the given type.
func (*Registry) ListTemplates ¶
ListTemplates returns all registered templates.
func (*Registry) RegisterTemplate ¶
RegisterTemplate registers a custom template.
func (*Registry) RenderSubject ¶
RenderSubject renders the subject line template with the given data.
func (*Registry) RenderTemplate ¶
RenderTemplate renders an HTML template with the given data.
type Template ¶
type Template struct {
Type TemplateType
Subject string
HTMLPath string
TextPath string
BrevoID int64 // Template ID in Brevo dashboard (0 means use local template)
}
Template holds information about an email template.
type TemplateType ¶
type TemplateType string
TemplateType represents the type of an email template.
const ( TemplateWorkflowCompleted TemplateType = "workflow_completed" TemplateWorkflowFailed TemplateType = "workflow_failed" TemplateJobCompleted TemplateType = "job_completed" TemplateJobFailed TemplateType = "job_failed" TemplateTestResultsSummary TemplateType = "test_results" TemplateWelcome TemplateType = "welcome" )
Template types for email notifications.
Click to show internal directories.
Click to hide internal directories.