Glific v0.3.1 Glific.Flows.Flow View Source

The flow object which encapsulates the complete flow as emitted by by https://github.com/nyaruka/floweditor

Link to this section Summary

Functions

Standard changeset pattern we use for all data types

Build the context so we can execute the flow

Return a flow for a specific uuid. Cache is not present in cache

load the latest revision, specifically json definition from the flow_revision table. We return the clean definition back

Helper function to load a active flow from the database and build an object

Process a json structure from floweditor to the Glific data types

Create a subflow of an existing flow

Changeset helper for keywords

Link to this section Types

Specs

t() :: %Glific.Flows.Flow{
  __meta__: Ecto.Schema.Metadata.t(),
  definition: map() | nil,
  flow_type: String.t() | nil,
  id: non_neg_integer() | nil,
  ignore_keywords: boolean() | nil,
  inserted_at: :utc_datetime | nil,
  keywords: [String.t()] | nil,
  localization: Glific.Flows.Localization.t() | nil,
  name: String.t() | nil,
  nodes: [Glific.Flows.Node.t()] | nil,
  organization:
    Glific.Partners.Organization.t() | Ecto.Association.NotLoaded.t() | nil,
  organization_id: non_neg_integer() | nil,
  revisions:
    [Glific.Flows.FlowRevision.t()] | Ecto.Association.NotLoaded.t() | nil,
  shortcode: String.t() | nil,
  updated_at: :utc_datetime | nil,
  uuid: Ecto.UUID.t() | nil,
  uuid_map: map() | nil,
  version_number: String.t() | nil
}

Link to this section Functions

Specs

changeset(t(), map()) :: Ecto.Changeset.t()

Standard changeset pattern we use for all data types

Specs

context(t(), Glific.Contacts.Contact.t()) ::
  {:ok, Glific.Flows.FlowContext.t()} | {:error, String.t()}

Build the context so we can execute the flow

Specs

get_flow(Ecto.UUID.t()) :: map()

Return a flow for a specific uuid. Cache is not present in cache

Link to this function

get_latest_definition(flow_id)

View Source

Specs

get_latest_definition(integer()) :: map()

load the latest revision, specifically json definition from the flow_revision table. We return the clean definition back

Specs

get_loaded_flow(map()) :: map()

Helper function to load a active flow from the database and build an object

Specs

process(map(), t()) :: t()

Process a json structure from floweditor to the Glific data types

Link to this function

start_sub_flow(context, uuid)

View Source

Specs

start_sub_flow(Glific.Flows.FlowContext.t(), Ecto.UUID.t()) ::
  {:ok, Glific.Flows.FlowContext.t(), [String.t()]} | {:error, String.t()}

Create a subflow of an existing flow

Link to this function

validate_keywords(changeset, keywords)

View Source

Specs

validate_keywords(Ecto.Changeset.t(), []) :: Ecto.Changeset.t()

Changeset helper for keywords