View Source StepFlow.NotificationHooks.NotificationTemplates (StepFlow v1.8.0)

The Notification templates context.

Summary

Functions

Creates a notification_template.

Deletes a NotificationTemplate.

Gets a single notification_template.

Gets a single notification_template by template_name.

Returns the list of notification templates.

Functions

Link to this function

create_notification_template(attrs \\ %{})

View Source

Creates a notification_template.

Examples

iex> create_notification_template(%
{
  template_name: template_name_value,
  template_headers: template_headers_value,
  template_body: template_body_value
})
{:ok, %NotificationTemplate{}}

iex> create_notification_template(%
{
  template_name: duplicate_template_name_value,
  template_headers: template_headers_value,
  template_body: template_body_value
})
{:error, %Ecto.Changeset{}}
Link to this function

delete_notification_template(notification_template)

View Source

Deletes a NotificationTemplate.

Examples

iex> delete_notification_template(notification_template)
{:ok, %NotificationTemplate{}}

iex> delete_notification_template(notification_template)
{:error, %Ecto.Changeset{}}
Link to this function

get_notification_template!(id)

View Source

Gets a single notification_template.

Raises Ecto.NoResultsError if the notification_template does not exist.

Examples

iex> get_notification_template!(123)
%NotificationTemplate{}

iex> get_notification_template!(456)
** (Ecto.NoResultsError)
Link to this function

get_notification_template_by_name(template_name)

View Source

Gets a single notification_template by template_name.

Examples

iex> get_notification_template_by_name("MY_NAME")
%NotificationTemplate{}

iex> get_notification_template_by_name("BAD_NAME")
nil
Link to this function

list_notification_templates(params \\ %{})

View Source

Returns the list of notification templates.

Examples

iex> list_notification_templates()
[%NotificationTemplate{}, ...]
Link to this function

update_notification_template(notification_template, attrs)

View Source

Updates NotificationTemplate.

Examples

iex> update_notification_template(notification_template, %{field: new_value})
{:ok, %NotificationTemplate{}}

iex> update_notification_template(notification_template, %{field: bad_value})
{:error, %Ecto.Changeset{}}