A compact Req-backed client for the Nuntly REST API.
Nuntly supports a configured Repo-style API for the common single-account case and an explicit client API for dynamic credentials and multi-tenancy.
Configured module
defmodule MyApp.Nuntly do
use Nuntly, otp_app: :my_app
end
# config/runtime.exs
config :my_app, MyApp.Nuntly,
api_key: System.fetch_env!("NUNTLY_API_KEY")
MyApp.Nuntly.list_emails(%{limit: 20})Explicit client
client = Nuntly.new(api_key: "ntly_...")
Nuntly.Emails.list_emails(client, %{limit: 20})Both APIs return {:ok, Req.Response.t()} for HTTP responses, including
non-2xx statuses, and {:error, Exception.t()} for transport failures.
Summary
Functions
Defines a configured, Repo-style Nuntly API module.
Arguments
opts— Compile-time options for the configured module::otp_app— Required OTP application containing this module's runtime configuration.
Configuration is read using the configured module as the application environment key.
Example
defmodule MyApp.Nuntly do
use Nuntly, otp_app: :my_app
end
config :my_app, MyApp.Nuntly,
api_key: System.fetch_env!("NUNTLY_API_KEY"),
receive_timeout: 10_000
MyApp.Nuntly.send_email(payload)The generated operation functions omit the explicit client argument. Their
overridable client/0 function calls Nuntly.new/1 with the application
configuration.
@spec new(keyword()) :: Nuntly.Client.t()
Creates a Req-backed Nuntly 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 forwarded unchanged to
Req.new/1.
Example
client = Nuntly.new(
api_key: "ntly_...",
receive_timeout: 10_000,
retry: :transient
)