AshDispatch.Info (AshDispatch v0.5.0)

View Source

Introspection helpers for AshDispatch events.

This module provides functions to introspect event DSL configuration at runtime. Generated automatically by Spark.InfoGenerator.

Usage

# Get event ID
AshDispatch.Info.dispatch_id(MyApp.Events.Orders.Created)
# => "orders.created"

# Get channels
AshDispatch.Info.dispatch_channels(MyApp.Events.Orders.Created)
# => [%Channel{transport: :email, audience: :user}, ...]

# Get domain
AshDispatch.Info.dispatch_domain(MyApp.Events.Orders.Created)
# => :orders

Generated Functions

All DSL options and sections generate corresponding accessor functions:

Dispatch Section

Channels Section

Content Section

Metadata Section

Counters Section

Summary

Functions

Email preference category for user opt-out. Maps to UserEmailPreferences field. If nil, email is not user-configurable.

Email preference category for user opt-out. Maps to UserEmailPreferences field. If nil, email is not user-configurable.

dispatch.channels DSL entities

Action button label for in-app notifications

Action button label for in-app notifications

Action URL for in-app notifications. Supports {{variable}} interpolation.

Action URL for in-app notifications. Supports {{variable}} interpolation.

Email 'from' address (e.g., 'noreply@myapp.com')

Email 'from' address (e.g., 'noreply@myapp.com')

Email 'from' name (e.g., 'MyApp')

Email 'from' name (e.g., 'MyApp')

In-app notification message. Supports {{variable}} interpolation.

In-app notification message. Supports {{variable}} interpolation.

In-app notification title. Supports {{variable}} interpolation.

In-app notification title. Supports {{variable}} interpolation.

dispatch.content DSL options

Email subject line. Supports {{variable}} interpolation from prepare_template_assigns/2.

Email subject line. Supports {{variable}} interpolation from prepare_template_assigns/2.

dispatch.counters DSL entities

Domain this event belongs to (e.g., :orders, :tickets). Used for organization and filtering.

Domain this event belongs to (e.g., :orders, :tickets). Used for organization and filtering.

Unique event identifier (e.g., "orders.created"). If not provided, defaults to "{module_name_last_segment}".

Unique event identifier (e.g., "orders.created"). If not provided, defaults to "{module_name_last_segment}".

Ash filter expression to control visibility in manual trigger UI.

Ash filter expression to control visibility in manual trigger UI.

Whether this event requires user action

Notification type for styling in UI

Notification type for styling in UI

dispatch.metadata DSL options

dispatch DSL options

Field specification for extracting the recipient identifier (email, phone, etc.).

Field specification for extracting the recipient identifier (email, phone, etc.).

Field specification for extracting the recipient display name.

Field specification for extracting the recipient display name.

dispatch.recipient.discord DSL options

Field specification for extracting the recipient identifier (email, phone, etc.).

Field specification for extracting the recipient identifier (email, phone, etc.).

Field specification for extracting the recipient display name.

Field specification for extracting the recipient display name.

dispatch.recipient.email DSL options

Field specification for extracting the recipient identifier (email, phone, etc.).

Field specification for extracting the recipient identifier (email, phone, etc.).

Field specification for extracting the recipient display name.

Field specification for extracting the recipient display name.

dispatch.recipient.in_app DSL options

Field specification for extracting the recipient identifier (email, phone, etc.).

Field specification for extracting the recipient identifier (email, phone, etc.).

Field specification for extracting the recipient display name.

Field specification for extracting the recipient display name.

dispatch.recipient.slack DSL options

Field specification for extracting the recipient identifier (email, phone, etc.).

Field specification for extracting the recipient identifier (email, phone, etc.).

Field specification for extracting the recipient display name.

Field specification for extracting the recipient display name.

dispatch.recipient.sms DSL options

Field specification for extracting the recipient identifier (email, phone, etc.).

Field specification for extracting the recipient identifier (email, phone, etc.).

Field specification for extracting the recipient display name.

Field specification for extracting the recipient display name.

dispatch.recipient.webhook DSL options

Ash filter expression to control whether auto-triggered events should send.

Ash filter expression to control whether auto-triggered events should send.

Whether users can opt-out of this event via email preferences. Set to false for critical system emails (auth, password reset).

Functions

dispatch_category(dsl_or_extended)

@spec dispatch_category(dsl_or_extended :: module() | map()) ::
  {:ok, String.t()} | :error

Email preference category for user opt-out. Maps to UserEmailPreferences field. If nil, email is not user-configurable.

dispatch_category!(dsl_or_extended)

@spec dispatch_category!(dsl_or_extended :: module() | map()) ::
  String.t() | no_return()

Email preference category for user opt-out. Maps to UserEmailPreferences field. If nil, email is not user-configurable.

dispatch_channels(dsl_or_extended)

@spec dispatch_channels(dsl_or_extended :: module() | map()) :: [struct()]

dispatch.channels DSL entities

dispatch_content_action_label(dsl_or_extended)

@spec dispatch_content_action_label(dsl_or_extended :: module() | map()) ::
  {:ok, String.t()} | :error

Action button label for in-app notifications

dispatch_content_action_label!(dsl_or_extended)

@spec dispatch_content_action_label!(dsl_or_extended :: module() | map()) ::
  String.t() | no_return()

Action button label for in-app notifications

dispatch_content_action_url(dsl_or_extended)

@spec dispatch_content_action_url(dsl_or_extended :: module() | map()) ::
  {:ok, String.t()} | :error

Action URL for in-app notifications. Supports {{variable}} interpolation.

dispatch_content_action_url!(dsl_or_extended)

@spec dispatch_content_action_url!(dsl_or_extended :: module() | map()) ::
  String.t() | no_return()

Action URL for in-app notifications. Supports {{variable}} interpolation.

dispatch_content_from_email(dsl_or_extended)

@spec dispatch_content_from_email(dsl_or_extended :: module() | map()) ::
  {:ok, String.t()} | :error

Email 'from' address (e.g., 'noreply@myapp.com')

dispatch_content_from_email!(dsl_or_extended)

@spec dispatch_content_from_email!(dsl_or_extended :: module() | map()) ::
  String.t() | no_return()

Email 'from' address (e.g., 'noreply@myapp.com')

dispatch_content_from_name(dsl_or_extended)

@spec dispatch_content_from_name(dsl_or_extended :: module() | map()) ::
  {:ok, String.t()} | :error

Email 'from' name (e.g., 'MyApp')

dispatch_content_from_name!(dsl_or_extended)

@spec dispatch_content_from_name!(dsl_or_extended :: module() | map()) ::
  String.t() | no_return()

Email 'from' name (e.g., 'MyApp')

dispatch_content_notification_message(dsl_or_extended)

@spec dispatch_content_notification_message(dsl_or_extended :: module() | map()) ::
  {:ok, String.t()} | :error

In-app notification message. Supports {{variable}} interpolation.

dispatch_content_notification_message!(dsl_or_extended)

@spec dispatch_content_notification_message!(dsl_or_extended :: module() | map()) ::
  String.t() | no_return()

In-app notification message. Supports {{variable}} interpolation.

dispatch_content_notification_title(dsl_or_extended)

@spec dispatch_content_notification_title(dsl_or_extended :: module() | map()) ::
  {:ok, String.t()} | :error

In-app notification title. Supports {{variable}} interpolation.

dispatch_content_notification_title!(dsl_or_extended)

@spec dispatch_content_notification_title!(dsl_or_extended :: module() | map()) ::
  String.t() | no_return()

In-app notification title. Supports {{variable}} interpolation.

dispatch_content_options(dsl_or_extended)

@spec dispatch_content_options(dsl_or_extended :: module() | map()) :: %{
  required(atom()) => any()
}

dispatch.content DSL options

Returns a map containing the and any configured or default values.

dispatch_content_subject(dsl_or_extended)

@spec dispatch_content_subject(dsl_or_extended :: module() | map()) ::
  {:ok, String.t()} | :error

Email subject line. Supports {{variable}} interpolation from prepare_template_assigns/2.

dispatch_content_subject!(dsl_or_extended)

@spec dispatch_content_subject!(dsl_or_extended :: module() | map()) ::
  String.t() | no_return()

Email subject line. Supports {{variable}} interpolation from prepare_template_assigns/2.

dispatch_counters(dsl_or_extended)

@spec dispatch_counters(dsl_or_extended :: module() | map()) :: [struct()]

dispatch.counters DSL entities

dispatch_domain(dsl_or_extended)

@spec dispatch_domain(dsl_or_extended :: module() | map()) :: {:ok, atom()} | :error

Domain this event belongs to (e.g., :orders, :tickets). Used for organization and filtering.

dispatch_domain!(dsl_or_extended)

@spec dispatch_domain!(dsl_or_extended :: module() | map()) :: atom() | no_return()

Domain this event belongs to (e.g., :orders, :tickets). Used for organization and filtering.

dispatch_id(dsl_or_extended)

@spec dispatch_id(dsl_or_extended :: module() | map()) :: {:ok, String.t()} | :error

Unique event identifier (e.g., "orders.created"). If not provided, defaults to "{module_name_last_segment}".

dispatch_id!(dsl_or_extended)

@spec dispatch_id!(dsl_or_extended :: module() | map()) :: String.t() | no_return()

Unique event identifier (e.g., "orders.created"). If not provided, defaults to "{module_name_last_segment}".

dispatch_manual_trigger_filter(dsl_or_extended)

@spec dispatch_manual_trigger_filter(dsl_or_extended :: module() | map()) ::
  {:ok, any()} | :error

Ash filter expression to control visibility in manual trigger UI.

Filters are applied to the target user (recipient) to determine if this event should be shown as an option in manual trigger interfaces.

Examples

# Only show if user hasn't confirmed email
manual_trigger_filter: [confirmed_at: nil]

# Only show if user is archived
manual_trigger_filter: [archived_at: [not: nil]]

# Complex filter with multiple conditions
manual_trigger_filter: [admin: true, archived: false]

Defaults to no filter (show for all users). For complex logic, override the applicable_for_user?/1 callback instead.

dispatch_manual_trigger_filter!(dsl_or_extended)

@spec dispatch_manual_trigger_filter!(dsl_or_extended :: module() | map()) ::
  any() | no_return()

Ash filter expression to control visibility in manual trigger UI.

Filters are applied to the target user (recipient) to determine if this event should be shown as an option in manual trigger interfaces.

Examples

# Only show if user hasn't confirmed email
manual_trigger_filter: [confirmed_at: nil]

# Only show if user is archived
manual_trigger_filter: [archived_at: [not: nil]]

# Complex filter with multiple conditions
manual_trigger_filter: [admin: true, archived: false]

Defaults to no filter (show for all users). For complex logic, override the applicable_for_user?/1 callback instead.

dispatch_metadata_action_required?(dsl_or_extended)

@spec dispatch_metadata_action_required?(dsl_or_extended :: module() | map()) ::
  boolean()

Whether this event requires user action

dispatch_metadata_notification_type(dsl_or_extended)

@spec dispatch_metadata_notification_type(dsl_or_extended :: module() | map()) ::
  {:ok, :error | :warning | :success | :info} | :error

Notification type for styling in UI

dispatch_metadata_notification_type!(dsl_or_extended)

@spec dispatch_metadata_notification_type!(dsl_or_extended :: module() | map()) ::
  (:error | :warning | :success | :info) | no_return()

Notification type for styling in UI

dispatch_metadata_options(dsl_or_extended)

@spec dispatch_metadata_options(dsl_or_extended :: module() | map()) :: %{
  required(atom()) => any()
}

dispatch.metadata DSL options

Returns a map containing the and any configured or default values.

dispatch_options(dsl_or_extended)

@spec dispatch_options(dsl_or_extended :: module() | map()) :: %{
  required(atom()) => any()
}

dispatch DSL options

Returns a map containing the and any configured or default values.

dispatch_recipient_discord_identifier(dsl_or_extended)

@spec dispatch_recipient_discord_identifier(dsl_or_extended :: module() | map()) ::
  {:ok, any()} | :error

Field specification for extracting the recipient identifier (email, phone, etc.).

Formats:

  • :field_name - Direct field access
  • {:field, :field_name} - Explicit field
  • {:field, [:nested, :path]} - Nested path
  • {:string_field, "key"} - String key
  • &Module.function/1 - Custom function

dispatch_recipient_discord_identifier!(dsl_or_extended)

@spec dispatch_recipient_discord_identifier!(dsl_or_extended :: module() | map()) ::
  any() | no_return()

Field specification for extracting the recipient identifier (email, phone, etc.).

Formats:

  • :field_name - Direct field access
  • {:field, :field_name} - Explicit field
  • {:field, [:nested, :path]} - Nested path
  • {:string_field, "key"} - String key
  • &Module.function/1 - Custom function

dispatch_recipient_discord_name(dsl_or_extended)

@spec dispatch_recipient_discord_name(dsl_or_extended :: module() | map()) ::
  {:ok, any()} | :error

Field specification for extracting the recipient display name.

Formats: Same as identifier. Set to nil if name is not needed (e.g., webhooks).

dispatch_recipient_discord_name!(dsl_or_extended)

@spec dispatch_recipient_discord_name!(dsl_or_extended :: module() | map()) ::
  any() | no_return()

Field specification for extracting the recipient display name.

Formats: Same as identifier. Set to nil if name is not needed (e.g., webhooks).

dispatch_recipient_discord_options(dsl_or_extended)

@spec dispatch_recipient_discord_options(dsl_or_extended :: module() | map()) :: %{
  required(atom()) => any()
}

dispatch.recipient.discord DSL options

Returns a map containing the and any configured or default values.

dispatch_recipient_email_identifier(dsl_or_extended)

@spec dispatch_recipient_email_identifier(dsl_or_extended :: module() | map()) ::
  {:ok, any()} | :error

Field specification for extracting the recipient identifier (email, phone, etc.).

Formats:

  • :field_name - Direct field access
  • {:field, :field_name} - Explicit field
  • {:field, [:nested, :path]} - Nested path
  • {:string_field, "key"} - String key
  • &Module.function/1 - Custom function

dispatch_recipient_email_identifier!(dsl_or_extended)

@spec dispatch_recipient_email_identifier!(dsl_or_extended :: module() | map()) ::
  any() | no_return()

Field specification for extracting the recipient identifier (email, phone, etc.).

Formats:

  • :field_name - Direct field access
  • {:field, :field_name} - Explicit field
  • {:field, [:nested, :path]} - Nested path
  • {:string_field, "key"} - String key
  • &Module.function/1 - Custom function

dispatch_recipient_email_name(dsl_or_extended)

@spec dispatch_recipient_email_name(dsl_or_extended :: module() | map()) ::
  {:ok, any()} | :error

Field specification for extracting the recipient display name.

Formats: Same as identifier. Set to nil if name is not needed (e.g., webhooks).

dispatch_recipient_email_name!(dsl_or_extended)

@spec dispatch_recipient_email_name!(dsl_or_extended :: module() | map()) ::
  any() | no_return()

Field specification for extracting the recipient display name.

Formats: Same as identifier. Set to nil if name is not needed (e.g., webhooks).

dispatch_recipient_email_options(dsl_or_extended)

@spec dispatch_recipient_email_options(dsl_or_extended :: module() | map()) :: %{
  required(atom()) => any()
}

dispatch.recipient.email DSL options

Returns a map containing the and any configured or default values.

dispatch_recipient_in_app_identifier(dsl_or_extended)

@spec dispatch_recipient_in_app_identifier(dsl_or_extended :: module() | map()) ::
  {:ok, any()} | :error

Field specification for extracting the recipient identifier (email, phone, etc.).

Formats:

  • :field_name - Direct field access
  • {:field, :field_name} - Explicit field
  • {:field, [:nested, :path]} - Nested path
  • {:string_field, "key"} - String key
  • &Module.function/1 - Custom function

dispatch_recipient_in_app_identifier!(dsl_or_extended)

@spec dispatch_recipient_in_app_identifier!(dsl_or_extended :: module() | map()) ::
  any() | no_return()

Field specification for extracting the recipient identifier (email, phone, etc.).

Formats:

  • :field_name - Direct field access
  • {:field, :field_name} - Explicit field
  • {:field, [:nested, :path]} - Nested path
  • {:string_field, "key"} - String key
  • &Module.function/1 - Custom function

dispatch_recipient_in_app_name(dsl_or_extended)

@spec dispatch_recipient_in_app_name(dsl_or_extended :: module() | map()) ::
  {:ok, any()} | :error

Field specification for extracting the recipient display name.

Formats: Same as identifier. Set to nil if name is not needed (e.g., webhooks).

dispatch_recipient_in_app_name!(dsl_or_extended)

@spec dispatch_recipient_in_app_name!(dsl_or_extended :: module() | map()) ::
  any() | no_return()

Field specification for extracting the recipient display name.

Formats: Same as identifier. Set to nil if name is not needed (e.g., webhooks).

dispatch_recipient_in_app_options(dsl_or_extended)

@spec dispatch_recipient_in_app_options(dsl_or_extended :: module() | map()) :: %{
  required(atom()) => any()
}

dispatch.recipient.in_app DSL options

Returns a map containing the and any configured or default values.

dispatch_recipient_slack_identifier(dsl_or_extended)

@spec dispatch_recipient_slack_identifier(dsl_or_extended :: module() | map()) ::
  {:ok, any()} | :error

Field specification for extracting the recipient identifier (email, phone, etc.).

Formats:

  • :field_name - Direct field access
  • {:field, :field_name} - Explicit field
  • {:field, [:nested, :path]} - Nested path
  • {:string_field, "key"} - String key
  • &Module.function/1 - Custom function

dispatch_recipient_slack_identifier!(dsl_or_extended)

@spec dispatch_recipient_slack_identifier!(dsl_or_extended :: module() | map()) ::
  any() | no_return()

Field specification for extracting the recipient identifier (email, phone, etc.).

Formats:

  • :field_name - Direct field access
  • {:field, :field_name} - Explicit field
  • {:field, [:nested, :path]} - Nested path
  • {:string_field, "key"} - String key
  • &Module.function/1 - Custom function

dispatch_recipient_slack_name(dsl_or_extended)

@spec dispatch_recipient_slack_name(dsl_or_extended :: module() | map()) ::
  {:ok, any()} | :error

Field specification for extracting the recipient display name.

Formats: Same as identifier. Set to nil if name is not needed (e.g., webhooks).

dispatch_recipient_slack_name!(dsl_or_extended)

@spec dispatch_recipient_slack_name!(dsl_or_extended :: module() | map()) ::
  any() | no_return()

Field specification for extracting the recipient display name.

Formats: Same as identifier. Set to nil if name is not needed (e.g., webhooks).

dispatch_recipient_slack_options(dsl_or_extended)

@spec dispatch_recipient_slack_options(dsl_or_extended :: module() | map()) :: %{
  required(atom()) => any()
}

dispatch.recipient.slack DSL options

Returns a map containing the and any configured or default values.

dispatch_recipient_sms_identifier(dsl_or_extended)

@spec dispatch_recipient_sms_identifier(dsl_or_extended :: module() | map()) ::
  {:ok, any()} | :error

Field specification for extracting the recipient identifier (email, phone, etc.).

Formats:

  • :field_name - Direct field access
  • {:field, :field_name} - Explicit field
  • {:field, [:nested, :path]} - Nested path
  • {:string_field, "key"} - String key
  • &Module.function/1 - Custom function

dispatch_recipient_sms_identifier!(dsl_or_extended)

@spec dispatch_recipient_sms_identifier!(dsl_or_extended :: module() | map()) ::
  any() | no_return()

Field specification for extracting the recipient identifier (email, phone, etc.).

Formats:

  • :field_name - Direct field access
  • {:field, :field_name} - Explicit field
  • {:field, [:nested, :path]} - Nested path
  • {:string_field, "key"} - String key
  • &Module.function/1 - Custom function

dispatch_recipient_sms_name(dsl_or_extended)

@spec dispatch_recipient_sms_name(dsl_or_extended :: module() | map()) ::
  {:ok, any()} | :error

Field specification for extracting the recipient display name.

Formats: Same as identifier. Set to nil if name is not needed (e.g., webhooks).

dispatch_recipient_sms_name!(dsl_or_extended)

@spec dispatch_recipient_sms_name!(dsl_or_extended :: module() | map()) ::
  any() | no_return()

Field specification for extracting the recipient display name.

Formats: Same as identifier. Set to nil if name is not needed (e.g., webhooks).

dispatch_recipient_sms_options(dsl_or_extended)

@spec dispatch_recipient_sms_options(dsl_or_extended :: module() | map()) :: %{
  required(atom()) => any()
}

dispatch.recipient.sms DSL options

Returns a map containing the and any configured or default values.

dispatch_recipient_webhook_identifier(dsl_or_extended)

@spec dispatch_recipient_webhook_identifier(dsl_or_extended :: module() | map()) ::
  {:ok, any()} | :error

Field specification for extracting the recipient identifier (email, phone, etc.).

Formats:

  • :field_name - Direct field access
  • {:field, :field_name} - Explicit field
  • {:field, [:nested, :path]} - Nested path
  • {:string_field, "key"} - String key
  • &Module.function/1 - Custom function

dispatch_recipient_webhook_identifier!(dsl_or_extended)

@spec dispatch_recipient_webhook_identifier!(dsl_or_extended :: module() | map()) ::
  any() | no_return()

Field specification for extracting the recipient identifier (email, phone, etc.).

Formats:

  • :field_name - Direct field access
  • {:field, :field_name} - Explicit field
  • {:field, [:nested, :path]} - Nested path
  • {:string_field, "key"} - String key
  • &Module.function/1 - Custom function

dispatch_recipient_webhook_name(dsl_or_extended)

@spec dispatch_recipient_webhook_name(dsl_or_extended :: module() | map()) ::
  {:ok, any()} | :error

Field specification for extracting the recipient display name.

Formats: Same as identifier. Set to nil if name is not needed (e.g., webhooks).

dispatch_recipient_webhook_name!(dsl_or_extended)

@spec dispatch_recipient_webhook_name!(dsl_or_extended :: module() | map()) ::
  any() | no_return()

Field specification for extracting the recipient display name.

Formats: Same as identifier. Set to nil if name is not needed (e.g., webhooks).

dispatch_recipient_webhook_options(dsl_or_extended)

@spec dispatch_recipient_webhook_options(dsl_or_extended :: module() | map()) :: %{
  required(atom()) => any()
}

dispatch.recipient.webhook DSL options

Returns a map containing the and any configured or default values.

dispatch_should_send_filter(dsl_or_extended)

@spec dispatch_should_send_filter(dsl_or_extended :: module() | map()) ::
  {:ok, any()} | :error

Ash filter expression to control whether auto-triggered events should send.

Filters are applied to the target user (recipient) to determine if this auto-triggered event should actually be sent to them.

Examples

# Only send if user hasn't confirmed email yet
should_send_filter: [confirmed_at: nil]

# Only send to active, non-archived users
should_send_filter: [archived_at: nil, active: true]

Defaults to no filter (always send). For complex logic, override the should_send?/2 callback instead.

Note: This filter is only checked for auto-triggered events. Manual triggers always send (assuming applicable_for_user? returns true).

dispatch_should_send_filter!(dsl_or_extended)

@spec dispatch_should_send_filter!(dsl_or_extended :: module() | map()) ::
  any() | no_return()

Ash filter expression to control whether auto-triggered events should send.

Filters are applied to the target user (recipient) to determine if this auto-triggered event should actually be sent to them.

Examples

# Only send if user hasn't confirmed email yet
should_send_filter: [confirmed_at: nil]

# Only send to active, non-archived users
should_send_filter: [archived_at: nil, active: true]

Defaults to no filter (always send). For complex logic, override the should_send?/2 callback instead.

Note: This filter is only checked for auto-triggered events. Manual triggers always send (assuming applicable_for_user? returns true).

dispatch_user_configurable?(dsl_or_extended)

@spec dispatch_user_configurable?(dsl_or_extended :: module() | map()) :: boolean()

Whether users can opt-out of this event via email preferences. Set to false for critical system emails (auth, password reset).