PlugMicropub v0.1.0 PlugMicropub.HandlerBehaviour behaviour View Source

Behaviour defining the interface for a PlugMicropub Handler

Link to this section Summary

Link to this section Types

Link to this type access_token() View Source
access_token() :: String.t()
Link to this type handler_error() View Source
handler_error() ::
  {:error, handler_error_atom()}
  | {:error, handler_error_atom(), description :: String.t()}
Link to this type handler_error_atom() View Source
handler_error_atom() :: :invalid_request | :forbidden | :insufficient_scope

Link to this section Callbacks

Link to this callback handle_config_query(access_token) View Source
handle_config_query(access_token()) :: {:ok, map()} | handler_error()
handle_config_query(access_token()) :: {:ok, map()} | handler_error()
Link to this callback handle_create(type, properties, access_token) View Source
handle_create(type :: String.t(), properties :: map(), access_token()) ::
  {:ok, :created | :accepted, url :: String.t()} | handler_error()
Link to this callback handle_delete(url, access_token) View Source
handle_delete(url :: String.t(), access_token()) :: :ok | handler_error()
Link to this callback handle_media(file, access_token) View Source
handle_media(file :: Plug.Upload.t(), access_token()) ::
  {:ok, url :: String.t()} | handler_error()
Link to this callback handle_source_query(url, properties, access_token) View Source
handle_source_query(
  url :: String.t(),
  properties :: [String.t()],
  access_token()
) :: {:ok, map()} | handler_error()
Link to this callback handle_undelete(url, access_token) View Source
handle_undelete(url :: String.t(), access_token()) ::
  :ok
  | {:ok, url :: String.t()}
  | {:error, handler_error()}
  | {:error, handler_error(), error_description :: String.t()}
Link to this callback handle_update(url, replace, add, delete, access_token) View Source
handle_update(
  url :: String.t(),
  replace :: map(),
  add :: map(),
  delete :: map(),
  access_token()
) :: :ok | {:ok, url :: String.t()} | handler_error()