annon_api v0.16.2 Annon.Configuration.Plugin

The boundary for the Plugin Configurations system.

Link to this section Summary

Functions

Creates a Plugin

Deletes a Plugin

Gets a single Plugin

Returns the list of Plugins by API ID

Link to this section Functions

Link to this function create_plugin(api, attrs)

Creates a Plugin.

Examples

iex> create_plugin(api, "proxy", %{field: value})
{:ok, %Annon.Configuration.Schemas.Plugin{}}

iex> create_plugin(api, "proxy", %{field: bad_value})
{:error, %Ecto.Changeset{}}

iex> create_plugin(api, "proxy", %{field: value, name: "not_a_proxy"})
{:error, %Ecto.Changeset{}}
Link to this function delete_plugin(plugin)

Deletes a Plugin.

Examples

iex> delete_plugin(123)
{:ok, %PluginSchema{}}

iex> delete_plugin(007)
{:error, :not_found}
Link to this function get_plugin(api_id, name)

Gets a single Plugin.

Examples

iex> get_plugin(123, "jwt")
{:ok, %Annon.Configuration.Schemas.Plugin{}}

iex> get_plugin(123, "jwt")
{:error, :not_found}
Link to this function list_plugins(api_id)

Returns the list of Plugins by API ID.

Examples

iex> list_plugins(api_id)
[%Annon.Configuration.Schemas.Plugin{}, ...]
Link to this function update_plugin(plugin, attrs)

Update a Plugin.

Update requires all fields to be present. Old Plugin will be deleted, but id, api_id and inserted_at values will be persisted in new record.

Examples

iex> update_plugin(%PluginSchema{}, %{field: new_value})
{:ok, %Annon.Configuration.Schemas.Plugin{}}

iex> update_plugin(%PluginSchema{}, %{field: bad_value})
{:error, %Ecto.Changeset{}}