notifytemplate

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Overview

Package notifytemplate provides a way to access notification templates.

Index

Constants

View Source
const ManifestType = "notificationTemplate"

ManifestType is the manifest type of notification templates.

View Source
const (
	TestNotification = "test-notification"
)

Template names.

Variables

View Source
var DefaultOptions = Options{}

DefaultOptions is the default set of options.

Functions

func GetEmbeddedTemplate

func GetEmbeddedTemplate(templateName string) (string, error)

GetEmbeddedTemplate returns embedded template by name.

func GetTemplate

func GetTemplate(ctx context.Context, rep repo.Repository, templateName string) (tmpl string, found bool, err error)

GetTemplate returns a named template from the repository.

func ParseTemplate

func ParseTemplate(tmpl string, opt Options) (*template.Template, error)

ParseTemplate parses a named template.

func ResetTemplate

func ResetTemplate(ctx context.Context, rep repo.RepositoryWriter, templateName string) error

ResetTemplate removes a template override from the repository.

func ResolveTemplate

func ResolveTemplate(ctx context.Context, rep repo.Repository, profileName, baseTemplateName, extension string) (string, error)

ResolveTemplate resolves a named template from the repository by looking for most-specific defined override and falling back to generic embedded template.

func SetTemplate

func SetTemplate(ctx context.Context, rep repo.RepositoryWriter, templateName, templateText string) error

SetTemplate saves a template in the repository.

func SupportedTemplates

func SupportedTemplates() []string

SupportedTemplates returns a list of supported template names.

Types

type Info

type Info struct {
	Name         string     `json:"name"`
	LastModified *time.Time `json:"lastModified,omitempty"`
	IsBuiltIn    bool       `json:"isBuiltIn,omitempty"`
}

Info returns information about single notification template.

func ListTemplates

func ListTemplates(ctx context.Context, rep repo.Repository, prefix string) ([]Info, error)

ListTemplates returns a list of templates.

type Options

type Options struct {
	Timezone   *time.Location
	TimeFormat string
}

Options provides options for template rendering.

type TemplateManifest

type TemplateManifest struct {
	Template string `json:"template"`
}

TemplateManifest is the manifest of a notification template.

Jump to

Keyboard shortcuts

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