Nadia.HTTPClient behaviour (nadia v1.5.0)

View Source

Behaviour for Nadia HTTP adapters.

Custom adapters receive a Nadia.HTTPRequest and return either {:ok, %Nadia.HTTPResponse{}} or {:error, reason}. Applications usually do not call this module directly, but tests and custom transports may pass an adapter module through Nadia.Client.new/1.

Summary

Callbacks

post(t)

@callback post(Nadia.HTTPRequest.t()) :: {:ok, Nadia.HTTPResponse.t()} | {:error, term()}

Functions

adapter()

default_adapter()

@spec default_adapter() :: module()

post(request)

@spec post(Nadia.HTTPRequest.t()) :: {:ok, Nadia.HTTPResponse.t()} | {:error, term()}

post(adapter, request)

@spec post(module(), Nadia.HTTPRequest.t()) ::
  {:ok, Nadia.HTTPResponse.t()} | {:error, term()}