Sendio.Client behaviour (sendio v1.1.0)

send.io API client.

Summary

Types

A module implementing the Castable behaviour, or a tuple for generic types

t()

Types

@type castable() :: module() | {module(), module()} | :raw

A module implementing the Castable behaviour, or a tuple for generic types

Link to this type

response(type)

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

Callbacks

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

Functions

Link to this function

default_base_url()

@spec default_base_url() :: String.t()

The default API base URL (https://api.send.io).

Link to this function

delete(client, castable_module, path, body \\ %{}, opts \\ [])

@spec delete(t(), castable(), String.t(), map(), Keyword.t()) :: response(any())
Link to this function

get(client, castable_module, path, opts \\ [])

@spec get(t(), castable(), String.t(), Keyword.t()) :: response(any())
@spec new(Sendio.config()) :: t()

Creates a new send.io client struct given a keyword list of config opts.

The base URL is taken from the :base_url option, then the :base_url set in config :sendio, Sendio.Client, then the SENDIO_BASE_URL environment variable, then https://api.send.io. A trailing slash is optional.

Link to this function

patch(client, castable_module, path, body \\ %{}, opts \\ [])

@spec patch(t(), castable(), String.t(), map(), Keyword.t()) :: response(any())
Link to this function

post(client, castable_module, path, body \\ %{}, opts \\ [])

@spec post(t(), castable(), String.t(), map() | [map()], Keyword.t()) ::
  response(any())