Skip to main content
Corvus Connection

ITemplatesApi

Interface
TheOmenDen.StreamPulse.Scripting.ITemplatesApiMessage-templating operations available inside a script handler (spec 002 AC-22), bound to the current invocation's trigger context. Every method is failure-safe: an unknown template, a kind mismatch, a compile/render error, or an unexpected throw is logged and yields an empty string (or an empty list) — it never throws, so a failing call can never crash the host or escape a node. The Render Template graph node lowers to RenderAsync.

Members

5
  • ListAsync
    method
    ValueTask<IReadOnlyList<TemplateSummary>> ListAsync(string kind = default, CancellationToken cancellationToken = default)
    Enumerates the available templates, optionally filtered to one context-kind name (e.g. "Follow"; case-insensitive). An unrecognized kind name yields an empty list. The kind is a string (not the MessageContextKind enum) to keep the scripting SDK free of project dependencies.
  • RenderAsync
    method
    ValueTask<string> RenderAsync(string nameOrId, CancellationToken cancellationToken = default)
    Renders the named template against the current handler's trigger context. An unknown name or a template whose context kind doesn't match the current trigger returns empty (logged).
  • RenderAsync
    method
    ValueTask<string> RenderAsync(string nameOrId, object context, CancellationToken cancellationToken = default)
    Renders the named template against an explicitly supplied trigger context (one of the TheOmenDen.StreamPulse.Scripting.Contexts records). Unknown/kind-mismatch ⇒ empty (logged).
  • RenderGroupAsync
    method
    ValueTask<string> RenderGroupAsync(string groupName, CancellationToken cancellationToken = default)
    Picks a member of the named group per its strategy, then renders it against the current context.
  • RenderWithAsync
    method
    ValueTask<string> RenderWithAsync(string nameOrId, IReadOnlyDictionary<string, object> tokens, CancellationToken cancellationToken = default)
    Renders the named template against an explicit token dictionary (advanced) — keyed by full token name (e.g. user.displayName). Tokens absent from the map fall back to the template's defaults.