templatekit

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package templatekit provides shared template resolution and payload merging for integration operations

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTemplateNotFound is returned when a notification template cannot be resolved
	ErrTemplateNotFound = errors.New("notification template not found")
	// ErrTemplateRenderFailed is returned when template payload merging fails
	ErrTemplateRenderFailed = errors.New("template render failed")
)

Functions

func BuildDispatchPayload

func BuildDispatchPayload(defaults map[string]any, overlays ...any) (json.RawMessage, error)

BuildDispatchPayload overlays the supplied struct values onto template defaults as a JSON object and returns the raw payload consumed by operation dispatchers. Each overlay is marshaled through its JSON tags, so the overlay struct types remain the single source of truth for per-invocation field names; overlays apply in order, so later overlays win on key conflicts

func LoadNotificationTemplate

func LoadNotificationTemplate(ctx context.Context, client *generated.Client, ownerID, templateID, templateKey string) (*generated.NotificationTemplate, error)

LoadNotificationTemplate loads an active notification template by ID or key for the given owner

func ResolveOperationTemplate

func ResolveOperationTemplate(ctx context.Context, req types.OperationRequest, templateID, templateKey string, cfg any) error

ResolveOperationTemplate loads a notification template when referenced and merges its defaults into cfg, which must be a pointer to the operation config struct. When neither templateID nor templateKey is set the call is a no-op

Types

This section is empty.

Jump to

Keyboard shortcuts

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