Chimeway.Policy.Settings (chimeway v1.0.0)

Copy Markdown View Source

Per-recipient policy settings for quiet hours and delivery caps.

Summary

Functions

Evaluates quiet-hours and delivery-cap suppression for a delivery.

Fetches the policy settings row for a recipient, or nil.

Upserts policy settings for one recipient.

Functions

evaluate(delivery, opts \\ [])

@spec evaluate(
  Chimeway.Delivery.t(),
  keyword()
) :: {:ok, :proceed} | {:suppress, atom()} | {:defer, map()}

Evaluates quiet-hours and delivery-cap suppression for a delivery.

get_settings(recipient_id)

@spec get_settings(String.t()) :: Chimeway.Policy.Settings.Setting.t() | nil

Fetches the policy settings row for a recipient, or nil.

upsert_settings(attrs)

@spec upsert_settings(map()) ::
  {:ok, Chimeway.Policy.Settings.Setting.t()} | {:error, Ecto.Changeset.t()}

Upserts policy settings for one recipient.