View Source Bonfire.Boundaries.Verbs (Bonfire v0.9.10-classic-beta.169)
Verbs represent actions users can perform, such as reading a post or replying to a message. Each verb has a unique ID and are defined in configuration.
The corresponding Ecto schema is Bonfire.Data.AccessControl.Verb
which is defined in a seperate repo.
Summary
Functions
Returns a changeset for the given verb and attributes.
Creates a new verb with the given attributes.
Retrieves a verb by its slug or ID.
Retrieves verb details by its ID or name, raising an error if not found.
Retrieves a verb ID by its slug.
Retrieves a verb ID by its slug or ID, raising an error if not found.
Retrieves a verb slug by its ID or name.
Retrieves a verb tuple by its ID or name.
Retrieves the IDs of the given verbs.
Lists the verbs from the specified source and key.
Returns a debug list of verbs by comparing the database and code.
Returns the list of verb slugs.
Returns the list of verbs from the configuration.
Returns the count of verbs in the configuration.
Functions
Returns a changeset for the given verb and attributes.
Examples
iex> Bonfire.Boundaries.Verbs.changeset(%{verb: :new_verb, description: "A new verb"})
Creates a new verb with the given attributes.
Examples
Bonfire.Boundaries.Verbs.create(%{verb: :new_verb, description: "A new verb"}) {:ok, %Verb{id: "new_verb_id", verb: :new_verb, description: "A new verb"}}
Retrieves a verb by its slug or ID.
Examples
iex> Bonfire.Boundaries.Verbs.get(:read)
%{id: "read_id", verb: :read}
iex> Bonfire.Boundaries.Verbs.get("read_id")
%{id: "read_id", verb: :read}
iex> Bonfire.Boundaries.Verbs.get("non_existent")
nil
Retrieves verb details by its ID or name, raising an error if not found.
Examples
iex> Bonfire.Boundaries.Verbs.get!("read")
%{id: "some_id", verb: :read} # Example output
iex> Bonfire.Boundaries.Verbs.get!("non_existent_id")
** (RuntimeError) Missing default verb: "non_existent_id"
Retrieves a verb ID by its slug.
Examples
iex> Bonfire.Boundaries.Verbs.get_id(:read)
"read_id"
iex> Bonfire.Boundaries.Verbs.get_id("read")
"read_id"
iex> Bonfire.Boundaries.Verbs.get_id("non_existent")
nil
Retrieves a verb ID by its slug or ID, raising an error if not found.
iex> Bonfire.Boundaries.Verbs.get_id!(:read)
"read_id"
iex> Bonfire.Boundaries.Verbs.get_id!("non_existent")
** (RuntimeError) Missing default verb: "non_existent"
Retrieves a verb slug by its ID or name.
## Examples
iex> Bonfire.Boundaries.Verbs.get_slug("read_id")
:read
Retrieves a verb tuple by its ID or name.
Examples
iex> Bonfire.Boundaries.Verbs.get_tuple("read_id")
{:read, %{id: "read_id", verb: :read}}
iex> Bonfire.Boundaries.Verbs.get_tuple("non_existent")
nil
Retrieves the IDs of the given verbs.
iex> Bonfire.Boundaries.Verbs.ids([:read, :write])
["read_id", "write_id"]
iex> Bonfire.Boundaries.Verbs.ids(:read)
["read_id"]
Lists the verbs from the specified source and key.
Examples
iex> Bonfire.Boundaries.Verbs.list(:db, :verb)
%{read: %Verb{id: "read_id", verb: :read}, write: %Verb{id: "write_id", verb: :write}}
iex> Bonfire.Boundaries.Verbs.list(:instance, :id)
["read_id", "write_id"]
Returns a debug list of verbs by comparing the database and code.
Examples
> Bonfire.Boundaries.Verbs.list_verbs_debug()
# Example output:
[ok: :read, error: "Code and DB have differing IDs for the same verb", ...]
Returns the list of verb slugs.
Examples
iex> Bonfire.Boundaries.Verbs.slugs()
[:read, :write]
Returns the list of verbs from the configuration.
Returns the count of verbs in the configuration.