View Source Plausible.HTTPClient.Interface behaviour (Plausible v0.0.1)

Summary

Types

finch_request_opts()

@type finch_request_opts() :: Keyword.t()

headers()

@type headers() :: Finch.Request.headers()

params()

@type params() :: Finch.Request.body() | map()

response()

@type response() ::
  {:ok, Finch.Response.t()}
  | {:error,
     Mint.Types.error() | Finch.Error.t() | Plausible.HTTPClient.Non200Error.t()}

url()

@type url() :: Finch.Request.url()

Callbacks

get(url)

@callback get(url()) :: response()

get(url, headers)

@callback get(url(), headers()) :: response()

get(url, headers, params)

@callback get(url(), headers(), params()) :: response()

post(url, headers, params)

@callback post(url(), headers(), params()) :: response()

post(url, headers, params, finch_request_opts)

@callback post(url(), headers(), params(), finch_request_opts()) :: response()