Resend.Client behaviour (resend v0.2.0)

Resend API client.

Link to this section Summary

Link to this section Types

Link to this type

response(type)

@type response(type) :: {:ok, type} | {:error, Resend.Error.t() | :client_error}
@type t() :: %Resend.Client{
  api_key: String.t(),
  base_url: String.t() | nil,
  client: module() | nil
}

Link to this section Callbacks

Link to this callback

post(t, t, map)

@callback post(t(), String.t(), map()) ::
  {:ok, %{body: map(), status: pos_integer()}} | {:error, any()}

Link to this section Functions

Link to this function

new(config \\ Resend.config())

@spec new(Resend.config()) :: t()

Returns a new Resend client struct.

Accepts a keyword list of config opts, though if omitted then it will attempt to load them from the application environment.

Link to this function

post(client, path, castable_module, body)

@spec post(t(), String.t(), atom(), map()) :: response(any())