PushEx.Behaviour.Controller behaviour (PushEx v2.2.0)

Implementable functions that are used by the API controller. It is crucial to ensure that all API calls are secured behind proper auth.

Summary

Callbacks

Accepts a Plug.Conn and params map to determine if the API is allowed to be accessed. It is possible to modify the response Plug.Conn completely, or return simple :ok | :error atoms.

Callbacks

auth(t, map)

@callback auth(Plug.Conn.t(), map()) ::
  :ok | {:ok, Plug.Conn.t(), map()} | :error | {:error, Plug.Conn.t()}

Accepts a Plug.Conn and params map to determine if the API is allowed to be accessed. It is possible to modify the response Plug.Conn completely, or return simple :ok | :error atoms.