A Req-backed client for Nuntly REST API 1.x.
Explicit client
client = Nuntly.new(api_key: "ntly_...")Pass :api_key or set NUNTLY_API_KEY. The :base_url
option defaults to https://api.nuntly.com. All remaining options are
forwarded to Req.new/1, including adapters, retries, timeouts, and test
plugs.
Responses
Requests return {:ok, Req.Response.t()} for every HTTP response, including
non-2xx statuses, or {:error, Exception.t()} for transport failures.
Summary
Types
@type t() :: %Nuntly.Client{req: Req.Request.t()}
Functions
Creates a Req-backed API client.
Arguments
opts— Optional client keyword list::api_key— Bearer token. Falls back toNUNTLY_API_KEY.:base_url— API base URL. Defaults tohttps://api.nuntly.com.- Remaining entries are passed unchanged to
Req.new/1.
Example
client = Nuntly.Client.new(
api_key: "ntly_...",
receive_timeout: 10_000,
retry: :transient
)
@spec request(t(), atom(), String.t(), keyword()) :: {:ok, Req.Response.t()} | {:error, Exception.t()}
Sends an HTTP request through an existing client.
Generated resource functions call this function, so most applications do not need to call it directly.
Arguments
client— ANuntly.Clientreturned bynew/1.method— HTTP method atom such as:getor:post.path— Path relative to the configured base URL.opts— Optional Req request keyword list, such as:params,:json, or:headers.
Example
Nuntly.Client.request(client, :get, "/emails", params: %{limit: 20})