DripDrop.Templates.Renderer (DripDrop v0.1.0)

Copy Markdown View Source

Renders templates and validates channel payload shapes.

Summary

Functions

Renders a binary or map template and validates it for the target channel.

Renders a step template with enrollment and hook data.

Renders a single Liquid text template.

Validates Liquid syntax and MJML compilation for an optional email template.

Types

render_error()

@type render_error() :: %{kind: :permanent, reason: term()}

Functions

render(template, vars, channel)

@spec render(binary() | map(), map(), atom() | binary()) ::
  {:ok, map()} | {:error, render_error()}

Renders a binary or map template and validates it for the target channel.

render_step(step, enrollment, hook_results)

@spec render_step(map(), term(), map()) :: {:ok, map()} | {:error, render_error()}

Renders a step template with enrollment and hook data.

render_text(template, vars)

@spec render_text(binary(), map()) :: {:ok, binary()} | {:error, render_error()}

Renders a single Liquid text template.

validate(template, channel)

@spec validate(binary() | map(), atom() | binary()) ::
  :ok | {:error, [{integer(), integer(), binary()}]}

Validates Liquid syntax and MJML compilation for an optional email template.