Glific v0.3.1 Glific.Flows View Source
The Flows context.
Link to this section Summary
Functions
A generic json traversal and building the structure for a specific flow schema which is an array of objects in the json file. Used for Node/Actions, Node/Exits, Router/Cases, and Router/Categories
Returns an %Ecto.Changeset{}
for tracking flow changes.
Check the required fields for all flow objects. If missing, raise an exception
Return the count of tags, using the same filter as list_tags
Creates a flow.
Save new revision for the flow
Deletes a flow.
Check if a flow has been activated since the time sent as a parameter e.g. outofoffice will check if that flow was activated in the last 24 hours daily/weekly will check since start of day/week, etc
A helper function to interact with the Caching API and get the cached flow. It will also set the loaded flow to cache in case it does not exists.
Gets a single flow.
Get specific flow revision by number
Get a list of all the revisions based on a flow UUID
Returns the list of flows.
Update latest flow revision status as done Reset old published flow revision status as draft Update cached flow definition
Start flow for a contact
Start flow for contacts of a group
Update the cached flow from db. This typically happens when the flow definition is updated via the UI
Updates a flow.
Link to this section Functions
Specs
A generic json traversal and building the structure for a specific flow schema which is an array of objects in the json file. Used for Node/Actions, Node/Exits, Router/Cases, and Router/Categories
Specs
change_flow(Glific.Flows.Flow.t(), map()) :: Ecto.Changeset.t()
Returns an %Ecto.Changeset{}
for tracking flow changes.
Examples
iex> change_flow(flow)
%Ecto.Changeset{data: %Flow{}}
Specs
Check the required fields for all flow objects. If missing, raise an exception
Specs
Return the count of tags, using the same filter as list_tags
Specs
create_flow(map()) :: {:ok, Glific.Flows.Flow.t()} | {:error, Ecto.Changeset.t()}
Creates a flow.
Examples
iex> create_flow(%{field: value})
{:ok, %Flow{}}
iex> create_flow(%{field: bad_value})
{:error, %Ecto.Changeset{}}
Specs
create_flow_revision(map()) :: Glific.Flows.FlowRevision.t()
Save new revision for the flow
Specs
delete_flow(Glific.Flows.Flow.t()) :: {:ok, Glific.Flows.Flow.t()} | {:error, Ecto.Changeset.t()}
Deletes a flow.
Examples
iex> delete_flow(flow)
{:ok, %Flow{}}
iex> delete_flow(flow)
{:error, %Ecto.Changeset{}}
Specs
flow_activated(non_neg_integer(), non_neg_integer(), DateTime.t()) :: boolean()
Check if a flow has been activated since the time sent as a parameter e.g. outofoffice will check if that flow was activated in the last 24 hours daily/weekly will check since start of day/week, etc
Specs
A helper function to interact with the Caching API and get the cached flow. It will also set the loaded flow to cache in case it does not exists.
Specs
get_flow!(integer()) :: Glific.Flows.Flow.t()
Gets a single flow.
Raises Ecto.NoResultsError
if the Flow does not exist.
Examples
iex> get_flow!(123)
%Flow{}
iex> get_flow!(456)
** (Ecto.NoResultsError)
Specs
Get specific flow revision by number
Specs
Get a list of all the revisions based on a flow UUID
Specs
list_flows(map()) :: [Glific.Flows.Flow.t()]
Returns the list of flows.
Examples
iex> list_flows()
[%Flow{}, ...]
Specs
publish_flow(Glific.Flows.Flow.t()) :: {:ok, Glific.Flows.Flow.t()}
Update latest flow revision status as done Reset old published flow revision status as draft Update cached flow definition
Specs
start_contact_flow(Glific.Flows.Flow.t(), Glific.Contacts.Contact.t()) :: {:ok, Glific.Flows.Flow.t()} | {:error, String.t()}
Start flow for a contact
Specs
start_group_flow(Glific.Flows.Flow.t(), Glific.Groups.Group.t()) :: {:ok, Glific.Flows.Flow.t()}
Start flow for contacts of a group
Specs
update_cached_flow(Glific.Flows.Flow.t()) :: {atom(), any()}
Update the cached flow from db. This typically happens when the flow definition is updated via the UI
Specs
update_flow(Glific.Flows.Flow.t(), map()) :: {:ok, Glific.Flows.Flow.t()} | {:error, Ecto.Changeset.t()}
Updates a flow.
Examples
iex> update_flow(flow, %{field: new_value})
{:ok, %Flow{}}
iex> update_flow(flow, %{field: bad_value})
{:error, %Ecto.Changeset{}}