Glific v0.3.1 Glific.Flows.ContactSetting View Source

Since many of the functions set/update fields in contact and related tables, lets centralize all the code here for now

Link to this section Summary

Functions

Add a preference to a contact. For now, all preferences are stored under the settings map, with a sub-map of preferences. We expect to get more clarity on this soon

Delete a preference from a contact. We actually dont really delete it, we just set the value to false, and hence turn it off

Get all the preferences for this contact

Reset the preferences for a contact.

Set the language for a contact

Set the name for a contact

Wrapper function for setting the contact preference, if preference is empty, it indicates to reset the preference

Link to this section Functions

Link to this function

add_contact_preference(context, preference, value \\ true)

View Source

Specs

Add a preference to a contact. For now, all preferences are stored under the settings map, with a sub-map of preferences. We expect to get more clarity on this soon

Link to this function

delete_contact_preference(context, preference)

View Source

Specs

delete_contact_preference(Glific.Flows.FlowContext.t(), String.t()) ::
  Glific.Flows.FlowContext.t()

Delete a preference from a contact. We actually dont really delete it, we just set the value to false, and hence turn it off

Link to this function

get_contact_preferences(flow_context)

View Source

Specs

get_contact_preferences(Glific.Flows.FlowContext.t()) :: [String.t()]

Get all the preferences for this contact

Link to this function

reset_contact_preference(context)

View Source

Specs

reset_contact_preference(Glific.Flows.FlowContext.t()) ::
  Glific.Flows.FlowContext.t()

Reset the preferences for a contact.

Link to this function

set_contact_language(context, language)

View Source

Specs

Set the language for a contact

Link to this function

set_contact_name(context, name)

View Source

Specs

Set the name for a contact

Link to this function

set_contact_preference(context, preference)

View Source

Specs

set_contact_preference(Glific.Flows.FlowContext.t(), String.t() | nil) ::
  Glific.Flows.FlowContext.t()

Wrapper function for setting the contact preference, if preference is empty, it indicates to reset the preference