View Source Camarero.Plato behaviour (camarero v1.0.3)
This behaviour is high-level abstraction of the container begind handlers.
All handlers are supposed to implement this behaviour. The simplest way
is to use Camarero.Plato
in the handler module; that will inject
the default boilerlate using %{binary() => any()}
map as a container behind.
Default implementation uses Camarero.Tapas
as low-level container implementation.
Summary
Types
HTTP status code
Callbacks
Returns the container itself, as is
Deletes the key-value pair for the key specified
Returns the value for the key specified
Sets the value for the key specified (intended to be used from the application)
Returns the route this module is supposed to be mounted to
Returns the key-value map out of a random input
Returns the key-value map out of a random input, the second argument contains additional request data
Types
@type status_code() :: non_neg_integer()
HTTP status code
Callbacks
@callback plato_all() :: Camarero.Tapas.t()
Returns the container itself, as is
@callback plato_delete(key :: binary() | atom()) :: nil | {binary(), status_code()} | binary()
Deletes the key-value pair for the key specified
@callback plato_get(key :: binary() | atom()) :: {:ok, any()} | :error | {:error, {status_code(), map()}}
Returns the value for the key specified
@callback plato_put(key :: binary() | atom(), value :: any()) :: :ok | {binary(), status_code()} | binary()
Sets the value for the key specified (intended to be used from the application)
@callback plato_route() :: binary()
Returns the route this module is supposed to be mounted to
Returns the key-value map out of a random input
Returns the key-value map out of a random input, the second argument contains additional request data