Documentation
¶
Overview ¶
Package templates provides email template storage functionality.
Index ¶
- Variables
- func DefaultPath() string
- func ExpandVariables(text string, vars map[string]string) (string, []string)
- type FileStore
- func (f *FileStore) Create(_ context.Context, t *domain.EmailTemplate) (*domain.EmailTemplate, error)
- func (f *FileStore) Delete(_ context.Context, id string) error
- func (f *FileStore) Get(_ context.Context, id string) (*domain.EmailTemplate, error)
- func (f *FileStore) IncrementUsage(_ context.Context, id string) error
- func (f *FileStore) List(_ context.Context, category string) ([]domain.EmailTemplate, error)
- func (f *FileStore) Path() string
- func (f *FileStore) Update(_ context.Context, t *domain.EmailTemplate) (*domain.EmailTemplate, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrTemplateNotFound = errors.New("template not found")
ErrTemplateNotFound is returned when a template is not found.
Functions ¶
Types ¶
type FileStore ¶
type FileStore struct {
// contains filtered or unexported fields
}
FileStore implements TemplateStore using a JSON file.
func NewDefaultFileStore ¶
func NewDefaultFileStore() *FileStore
NewDefaultFileStore creates a FileStore at the default location. The default location is ~/.config/nylas/templates.json
func NewFileStore ¶
NewFileStore creates a new FileStore at the specified path.
func (*FileStore) Create ¶
func (f *FileStore) Create(_ context.Context, t *domain.EmailTemplate) (*domain.EmailTemplate, error)
Create creates a new template and returns it with generated ID.
func (*FileStore) IncrementUsage ¶
IncrementUsage increments the usage count for a template.
func (*FileStore) Update ¶
func (f *FileStore) Update(_ context.Context, t *domain.EmailTemplate) (*domain.EmailTemplate, error)
Update updates an existing template.
Click to show internal directories.
Click to hide internal directories.