View Source Swoosh.ApiClient behaviour (Swoosh v1.6.0)

Specification for a Swoosh API client.

It can be set to your own client with:

config :swoosh, :api_client, MyAPIClient

Swoosh comes with Swoosh.ApiClient.Hackney and Swoosh.ApiClient.Finch.

Link to this section Summary

Callbacks

Callback to initializes the given api client.

Callback invoked when posting to a given URL.

Functions

API used by adapters to post to a given URL with headers, body, and email.

Link to this section Types

Specs

body() :: binary()

Specs

headers() :: [{binary(), binary()}]

Specs

status() :: pos_integer()

Specs

url() :: binary()

Link to this section Callbacks

Specs

init() :: :ok

Callback to initializes the given api client.

Link to this callback

post(url, headers, body, t)

View Source

Specs

post(url(), headers(), body(), Swoosh.Email.t()) ::
  {:ok, status(), headers(), body()} | {:error, term()}

Callback invoked when posting to a given URL.

Link to this section Functions

Link to this function

post(url, headers, body, email)

View Source

API used by adapters to post to a given URL with headers, body, and email.