View Source Glific.Notifications (Glific v5.1.6)

The notifications manager and API to interface with the notification sub-system

Link to this section Summary

Functions

Return the count of notifications, using the same filter as list_notifications

Create a Notification

Returns the list of notifications. Since this is very basic and only listing functionality we added the status filter like this. In future we will put the status as virtual filed in the notifications itself.

Mark all the unread messages as read.

We will pick the types from here to keep the consistency

Link to this section Functions

Link to this function

count_notifications(args)

View Source
@spec count_notifications(map()) :: integer()

Return the count of notifications, using the same filter as list_notifications

Link to this function

create_notification(attrs \\ %{})

View Source
@spec create_notification(map()) ::
  {:ok, Glific.Notifications.Notification.t()} | {:error, Ecto.Changeset.t()}

Create a Notification

Link to this function

list_notifications(args)

View Source
@spec list_notifications(map()) :: list()

Returns the list of notifications. Since this is very basic and only listing functionality we added the status filter like this. In future we will put the status as virtual filed in the notifications itself.

Link to this function

mark_notification_as_read()

View Source
@spec mark_notification_as_read() :: boolean()

Mark all the unread messages as read.

@spec types() :: %{critical: String.t(), warning: String.t(), info: String.t()}

We will pick the types from here to keep the consistency

Link to this function

update_notification(notification, attrs)

View Source
@spec update_notification(Glific.Notifications.Notification.t(), map()) ::
  {:ok, Glific.Notifications.Notification.t()} | {:error, Ecto.Changeset.t()}

Update a Notification