Glific v0.3.1 Glific.Tags View Source
The Tags Context, which encapsulates and manages tags and the related join tables.
Link to this section Summary
Functions
Returns an %Ecto.Changeset{}
for tracking contact changes.
Returns an %Ecto.Changeset{}
for tracking message changes.
Returns an %Ecto.Changeset{}
for tracking tag changes.
Return the count of tags, using the same filter as list_tags
Creates a contact.
Creates a message tag
Creates a tag.
Creates a template tag.
Deletes a contact tag.
Deletes a list of contact tags, each tag attached to the same contact
Deletes a message tag.
In Join tables we rarely use the table id. We always know the object ids and hence more convenient to delete an entry via its object ids. We will generalize this function and move it to Repo.ex when we get a better handle on how to do so :)
Deletes a tag.
Deletes a list of template tags, each tag attached to the same template
Gets a single contact.
Gets a single message.
Gets a single tag.
Given a tag id or a list of tag ids, retrieve all the ancestors for the list_tags
Converts all tag kewords into the map where keyword is the key and tag id is the value
Returns the list of tags.
Remove a specific tag from contact messages
Filter all the status tag and returns as a map
Updates a contact tag.
Updates a message tag.
Updates a tag.
Link to this section Functions
Specs
change_contact_tag(Glific.Tags.ContactTag.t(), map()) :: Ecto.Changeset.t()
Returns an %Ecto.Changeset{}
for tracking contact changes.
Examples
iex> change_contact_tag(contact_tag)
%Ecto.Changeset{data: %ContactTag{}}
Specs
change_message_tag(Glific.Tags.MessageTag.t(), map()) :: Ecto.Changeset.t()
Returns an %Ecto.Changeset{}
for tracking message changes.
Examples
iex> change_message_tag(message_tag)
%Ecto.Changeset{data: %MessageTag{}}
Specs
change_tag(Glific.Tags.Tag.t(), map()) :: Ecto.Changeset.t()
Returns an %Ecto.Changeset{}
for tracking tag changes.
Examples
iex> change_tag(tag)
%Ecto.Changeset{data: %Tag{}}
Specs
Return the count of tags, using the same filter as list_tags
Specs
create_contact_tag(map()) :: {:ok, Glific.Tags.ContactTag.t()} | {:error, Ecto.Changeset.t()}
Creates a contact.
Examples
iex> create_contact_tag(%{field: value})
{:ok, %Contact{}}
iex> create_contact_tag(%{field: bad_value})
{:error, %Ecto.Changeset{}}
Specs
create_message_tag(map()) :: {:ok, Glific.Tags.MessageTag.t()} | {:error, Ecto.Changeset.t()}
Creates a message tag
Examples
iex> create_message_tag(%{field: value}) {:ok, %Message{}}
iex> create_message_tag(%{field: bad_value}) {:error, %Ecto.Changeset{}}
Specs
create_tag(map()) :: {:ok, Glific.Tags.Tag.t()} | {:error, Ecto.Changeset.t()}
Creates a tag.
Examples
iex> create_tag(%{field: value})
{:ok, %Tag{}}
iex> create_tag(%{field: bad_value})
{:error, %Ecto.Changeset{}}
Specs
create_template_tag(map()) :: {:ok, Glific.Tags.TemplateTag.t()} | {:error, Ecto.Changeset.t()}
Creates a template tag.
Examples
iex> create_template_tag(%{field: value})
{:ok, %Contact{}}
iex> create_template_tag(%{field: bad_value})
{:error, %Ecto.Changeset{}}
Specs
delete_contact_tag(Glific.Tags.ContactTag.t()) :: {:ok, Glific.Tags.ContactTag.t()} | {:error, Ecto.Changeset.t()}
Deletes a contact tag.
Examples
iex> delete_contact_tag(contact_tag)
{:ok, %ContactTag{}}
iex> delete_contact_tag(contact_tag)
{:error, %Ecto.Changeset{}}
Specs
Deletes a list of contact tags, each tag attached to the same contact
Specs
delete_message_tag(Glific.Tags.MessageTag.t()) :: {:ok, Glific.Tags.MessageTag.t()} | {:error, Ecto.Changeset.t()}
Deletes a message tag.
Examples
iex> delete_message_tag(message_tag)
{:ok, %MessageTag{}}
iex> delete_message_tag(message_tag)
{:error, %Ecto.Changeset{}}
Specs
In Join tables we rarely use the table id. We always know the object ids and hence more convenient to delete an entry via its object ids. We will generalize this function and move it to Repo.ex when we get a better handle on how to do so :)
Specs
delete_tag(Glific.Tags.Tag.t()) :: {:ok, Glific.Tags.Tag.t()} | {:error, Ecto.Changeset.t()}
Deletes a tag.
Examples
iex> delete_tag(tag)
{:ok, %Tag{}}
iex> delete_tag(tag)
{:error, %Ecto.Changeset{}}
Specs
Deletes a list of template tags, each tag attached to the same template
Specs
get_contact_tag!(integer()) :: Glific.Tags.ContactTag.t()
Gets a single contact.
Raises Ecto.NoResultsError
if the Contact does not exist.
Examples
iex> get_contact_tag!(123)
%Contact{}
iex> get_contact_tag!(456)
** (Ecto.NoResultsError)
Specs
get_message_tag!(integer()) :: Glific.Tags.MessageTag.t()
Gets a single message.
Raises Ecto.NoResultsError
if the Message does not exist.
Examples
iex> get_message_tag!(123)
%Message{}
iex> get_message_tag!(456)
** (Ecto.NoResultsError)
Specs
get_tag!(integer()) :: Glific.Tags.Tag.t()
Gets a single tag.
Raises Ecto.NoResultsError
if the Tag does not exist.
Examples
iex> get_tag!(123)
%Tag{}
iex> get_tag!(456)
** (Ecto.NoResultsError)
Specs
include_all_ancestors(non_neg_integer() | [non_neg_integer()]) :: [ non_neg_integer() ]
Given a tag id or a list of tag ids, retrieve all the ancestors for the list_tags
Specs
Converts all tag kewords into the map where keyword is the key and tag id is the value
Specs
list_tags(map()) :: [Glific.Tags.Tag.t()]
Returns the list of tags.
Examples
iex> list_tags()
[%Tag{}, ...]
Specs
remove_tag_from_all_message(integer(), String.t()) :: list()
remove_tag_from_all_message(integer(), [String.t()]) :: list()
Remove a specific tag from contact messages
Specs
Filter all the status tag and returns as a map
Specs
update_contact_tag(Glific.Tags.ContactTag.t(), map()) :: {:ok, Glific.Tags.ContactTag.t()} | {:error, Ecto.Changeset.t()}
Updates a contact tag.
Examples
iex> update_contact_tag(contact_tag, %{field: new_value})
{:ok, %ContactTag{}}
iex> update_contact_tag(contact_tag, %{field: bad_value})
{:error, %Ecto.Changeset{}}
Specs
update_message_tag(Glific.Tags.MessageTag.t(), map()) :: {:ok, Glific.Tags.MessageTag.t()} | {:error, Ecto.Changeset.t()}
Updates a message tag.
Examples
iex> update_message_tag(message_tag, %{field: new_value})
{:ok, %MessageTag{}}
iex> update_message_tag(message_tag, %{field: bad_value})
{:error, %Ecto.Changeset{}}
Specs
update_tag(Glific.Tags.Tag.t(), map()) :: {:ok, Glific.Tags.Tag.t()} | {:error, Ecto.Changeset.t()}
Updates a tag.
Examples
iex> update_tag(tag, %{field: new_value})
{:ok, %Tag{}}
iex> update_tag(tag, %{field: bad_value})
{:error, %Ecto.Changeset{}}