View Source LmHttp.ClientApi behaviour (Lucid Modules HTTP v0.1.0)

Behaviour for HTTP clients that should implement the request callback.

Link to this section Summary

Link to this section Types

@type body() :: map()
@type endpoint() :: String.t()
@type headers() :: tuple()
@type http_method() :: atom()
@type query_params() :: map()
@type response() :: %{status: integer(), body: map(), headers: map()}
@type result() :: {:ok, response()} | {:error, String.t()}
@type serialized_request() :: %{
  method: http_method(),
  endpoint: endpoint(),
  headers: map(),
  body: map()
}
@type t() :: module()
@type url() :: String.t()

Link to this section Callbacks

Link to this callback

request(serialized_request)

View Source
@callback request(serialized_request()) :: result()

Generic request.