templates

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package templates provides email template management.

Index

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

func (r *Registry) ListTemplates() []*Template

ListTemplates returns all registered templates.

func (*Registry) RegisterTemplate

func (r *Registry) RegisterTemplate(tmpl *Template)

RegisterTemplate registers a custom template.

func (*Registry) RenderSubject

func (r *Registry) RenderSubject(tmpl *Template, data map[string]interface{}) (string, error)

RenderSubject renders the subject line template with the given data.

func (*Registry) RenderTemplate

func (r *Registry) RenderTemplate(tmpl *Template, data map[string]interface{}) (string, error)

RenderTemplate renders an HTML template with the given data.

func (*Registry) RenderTextTemplate

func (r *Registry) RenderTextTemplate(tmpl *Template, data map[string]interface{}) (string, error)

RenderTextTemplate renders a plain text 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL