View Source Camarero.Plato behaviour (camarero v0.13.3)

This behaviour is high-level abstraction of the container begind handlers.

Aññ 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.

Link to this section 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

Link to this section Types

Specs

status_code() :: non_neg_integer()

HTTP status code

Link to this section Callbacks

Specs

plato_all() :: Camarero.Tapas.t()

Returns the container itself, as is

Specs

plato_delete(key :: binary() | atom()) ::
  nil | {binary(), status_code()} | binary()

Deletes the key-value pair for the key specified

Specs

plato_get(key :: binary() | atom()) ::
  {:ok, any()} | :error | {:error, {status_code(), map()}}

Returns the value for the key specified

Specs

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)

Specs

plato_route() :: binary()

Returns the route this module is supposed to be mounted to

Specs

reshape(map()) :: map()

Returns the key-value map out of a random input