calcinator v1.0.0 Calcinator
Converts actions from a controller or RPC server using JSONAPI formatted params to calls on a Calcinator.Resources
module.
Summary
Types
Nested params format used by Ecto.Changeset.t
The name of the parameter that was used for the query and was not found
The raw request params that need to be validated as a JSONAPI document and converted to an Alembic.Document.t
A rendered JSONAPI document as a map
authorization_module
- The module that implements theCalcinator.Authorization
behavioursubject
- the subject that is trying to do the action and needs to be authorized byauthorization_module
target
- the target ofsubject
’s action
Types
Nested params format used by Ecto.Changeset.t
.
The name of the parameter that was used for the query and was not found.
The raw request params that need to be validated as a JSONAPI document and converted to an Alembic.Document.t
t()
t() :: %Calcinator{associations_by_include: term, authorization_module: module, ecto_schema_module: module, params: term, resources_module: term, subject: Calcinator.Authorization.subject, view_module: module}
authorization_module
- The module that implements theCalcinator.Authorization
behavioursubject
- the subject that is trying to do the action and needs to be authorized byauthorization_module
target
- the target ofsubject
’s action
Functions
can(calcinator, action, target)
can(t, Calcinator.Authorization.action, Authorizaton.target) :: :ok | {:error, :unauthorized}
changeset(calcinator, updatable, updatable_params)
changeset(t, Ecto.Schema.t, insertable_params) :: {:ok, Ecto.Changeset.t} | {:error, Ecto.Changeset.t}
create(calcinator, params)
create(t, params) :: {:error, :unauthorized} | {:error, Alembic.Document.t} | {:error, Ecto.Changeset.t} | {:ok, rendered}
delete(calcinator, params)
delete(t, params) :: {:error, {:not_found, parameter}} | {:error, :unauthorized} | {:error, Ecto.Changeset.t} | :ok
get(resources_module, params, id_key, query_options)
get(module, params, id_key :: String.t, Resources.query_options) :: {:error, {:not_found, parameter} | :timeout | term} | {:ok, Ecto.Schema.t}
index(calcinator, params, map)
index(t, params, %{base_uri: URI.t}) :: {:error, :timeout} | {:error, :unauthorized} | {:error, Alembic.Document.t} | {:ok, rendered}
show(calcinator, map)
show(t, params) :: {:error, {:not_found, parameter}} | {:error, :unauthorized} | {:error, Alembic.Document.t} | {:ok, rendered}
update(calcinator, params)
update(t, params) :: {:error, :bad_gateway} | {:error, {:not_found, parameter}} | {:error, :unauthorized} | {:error, Alembic.Document.t} | {:error, Ecto.Changeset.t} | {:ok, rendered}
update_changeset(calcinator, changeset, params)
update_changeset(t, Ecto.Changeset.t, params) :: {:ok, Ecto.Schema.t} | {:error, Alembic.Document.t} | {:error, Ecto.Changeset.t} | {:error, :bad_gateway} | {:error, :not_found}