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

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, Swoosh.ApiClient.Finch, and Swoosh.ApiClient.Req.

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.

Types

@type body() :: binary()
@type headers() :: [{binary(), binary()}]
@type status() :: pos_integer()
@type url() :: binary()

Callbacks

@callback init() :: :ok

Callback to initializes the given api client.

Link to this callback

post(url, headers, body, t)

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

Callback invoked when posting to a given URL.

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.