ExDadata.HTTPAdapter behaviour (ExDadata v0.1.0) View Source

An interface to provide an HTTP client.

Link to this section Summary

Types

JSON-body for the request, provided as json-encodable data.

A headers provided for the request.

An http method.

Opts provided for specific adapters.

Full url for the request.

Callbacks

Provides an ability to do an arbitrary request with json data.

Link to this section Types

Specs

body() :: term()

JSON-body for the request, provided as json-encodable data.

Specs

header() :: {String.t(), String.t()}

A headers provided for the request.

Specs

method() :: :get | :post | :patch | :put | :delete | :head

An http method.

Specs

opts() :: term()

Opts provided for specific adapters.

Specs

url() :: String.t()

Full url for the request.

Note: It's a proper full url with query params and everything else. In case your http-client library doesn't allow you to contain such strings in your url, you need to decompose it.

Link to this section Callbacks

Link to this callback

request(t, method, url, list, body, opts)

View Source

Specs

request(ExDadata.Client.t(), method(), url(), [header()], body(), opts()) ::
  {:ok, ExDadata.HTTPAdapter.Response.t()} | {:error, term()}

Provides an ability to do an arbitrary request with json data.