MillionSend.Client (MillionSend v0.6.0)

Copy Markdown View Source

A resolved MillionSend client: API key, base URL, User-Agent and the HTTP module to run requests through. Build one with MillionSend.client/1.

Summary

Functions

Resolves a client from (in precedence order) the given opts, the config :millionsend, MillionSend.Client application env, OS environment variables, and finally the built-in defaults.

Types

t()

@type t() :: %MillionSend.Client{
  api_key: String.t(),
  base_url: String.t(),
  http_client: module(),
  user_agent: String.t()
}

Functions

new(opts \\ [])

@spec new(keyword()) :: t()

Resolves a client from (in precedence order) the given opts, the config :millionsend, MillionSend.Client application env, OS environment variables, and finally the built-in defaults.

Options: :api_key, :base_url, :user_agent (a suffix appended to the SDK's own User-Agent token), :http_client (a module implementing MillionSend.HTTP, for tests/proxies), :allow_insecure_http (accept a plain http:// base URL on a non-loopback host; off by default because the API key travels as a bearer header).