What each person wants to hear about: a setting for each category of
Chime.Config and each channel.
"on"- it goes;"off"- it does not, and the log says the person turned it off;"daily"and"weekly"- for email: it waits for the person's digest (Chime.Digest).
A setting the person has not changed is the category's default
(:defaults in Chime.Config), else "on". A required category
(required: true) is always "on": its settings cannot be changed.
Chime.preferences/1 reads a person's, Chime.put_preference/4 changes
one, and the JSON API (Chime.API) and the LiveView component
(Chime.Components.preferences/1) are both over them.
Summary
Functions
A person's settings, for each category of the config: in a workspace, its own where the person set them, else their settings for all.
Changes a person's setting of a channel for a category, for every
workspace, or for one (workspace). Errors: :required (the category
is required), :unknown_category, :unknown_channel,
:invalid_setting (a setting that is not "on" or "off", or
"daily" or "weekly" for email).
Types
@type t() :: %{ category: Chime.Config.category(), settings: %{required(String.t()) => String.t()} }
A category and the person's settings of its channels.
Functions
@spec for_recipient(Chime.Config.t(), String.t(), String.t() | nil) :: [t()]
A person's settings, for each category of the config: in a workspace, its own where the person set them, else their settings for all.
@spec put( Chime.Config.t(), String.t(), String.t(), String.t(), String.t(), String.t() | nil ) :: :ok | {:error, :required | :unknown_category | :unknown_channel | :invalid_setting}
Changes a person's setting of a channel for a category, for every
workspace, or for one (workspace). Errors: :required (the category
is required), :unknown_category, :unknown_channel,
:invalid_setting (a setting that is not "on" or "off", or
"daily" or "weekly" for email).