Documentation
¶
Overview ¶
Package templatekit provides shared template resolution and payload merging for integration operations
Index ¶
- Variables
- func BuildDispatchPayload(defaults map[string]any, overlays ...any) (json.RawMessage, error)
- func LoadNotificationTemplate(ctx context.Context, client *generated.Client, ...) (*generated.NotificationTemplate, error)
- func ResolveOperationTemplate(ctx context.Context, req types.OperationRequest, ...) error
Constants ¶
This section is empty.
Variables ¶
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 ¶
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.