Runbox.Scenario.Notification (runbox v7.0.1)
Module contains functions for working with scenario notifications.
Link to this section Summary
Functions
Lists all channels with templates defined for scenario, notification type and template type.
Lists all template languages defined for senario, notification type, template type and channel.
Lists all notification types for a scenario.
Lists all template types of the specified notification.
Loads and evaluates templates specified by scenario, notification type, template type, channel and language.
Tries to load the notification spec of the given scenario.
Link to this section Functions
list_channels(scenario_id, notification_type, template_type)
@spec list_channels(String.t(), String.t(), String.t()) :: {:ok, [String.t()]} | {:error, File.posix()}
Lists all channels with templates defined for scenario, notification type and template type.
list_languages(scenario_id, notification_type, template_type, channel)
@spec list_languages(String.t(), String.t(), String.t(), String.t()) :: {:ok, [String.t()]} | {:error, File.posix()}
Lists all template languages defined for senario, notification type, template type and channel.
list_notification_types(scenario_id)
@spec list_notification_types(String.t()) :: {:ok, [String.t()]} | {:error, File.posix()}
Lists all notification types for a scenario.
list_template_types(scenario_id, notification_type)
@spec list_template_types(String.t(), String.t()) :: {:ok, [String.t()]} | {:error, File.posix()}
Lists all template types of the specified notification.
load_and_eval_templates(scenario, notification_type, template_type, channel, language, data, fallback_language)
@spec load_and_eval_templates( scenario_id :: String.t(), notification_type :: String.t(), template_type :: String.t(), channel :: String.t(), language :: String.t(), data :: keyword(), fallback_language :: String.t() ) :: {:ok, %{required(String.t()) => String.t()}} | {:error, atom(), String.t()}
Loads and evaluates templates specified by scenario, notification type, template type, channel and language.
If language is not defined or does not exist, fallback_language
is used.
load_spec(scenario_id)
Tries to load the notification spec of the given scenario.
Returns
{:ok, notification_spec}
if the spec is found{:error, :cannot_load, exception}
if the spec file cannot be found{:error, :bad_syntax, exception}
if the spec file was found but contains syntactic errors