Configuration management for the Codat client.
Configuration Options
All options can be set globally in config.exs or overridden per-client at runtime.
config :codat,
api_key: System.get_env("CODAT_API_KEY"),
base_url: "https://api.codat.io",
http_timeout: 30_000,
max_retries: 3Per-Request Overrides
Pass a %Codat.Client{} struct with your overrides to any API function:
client = Codat.Client.new(api_key: "...", http_timeout: 60_000)
Codat.Platform.Companies.list(client)
Summary
Functions
Returns the encoded Authorization header value for the given API key.
The Codat API requires Basic <base64(api_key)>.
Builds a validated %Codat.Config{} by merging application config, env vars,
and any runtime keyword overrides (highest priority wins).
Returns the NimbleOptions schema for documentation and external validation.
Returns the resolved API key, checking config struct then CODAT_API_KEY env var. Raises if no key is available.
Types
@type t() :: %Codat.Config{ api_key: String.t() | nil, base_url: String.t(), finch_name: atom(), http_connect_timeout: non_neg_integer(), http_timeout: non_neg_integer(), json_library: module(), max_retries: non_neg_integer(), pool_count: pos_integer(), pool_size: pos_integer(), rate_limit_retry_delay: pos_integer(), retry_base_delay: pos_integer(), retry_max_delay: pos_integer() }
Functions
Returns the encoded Authorization header value for the given API key.
The Codat API requires Basic <base64(api_key)>.
Builds a validated %Codat.Config{} by merging application config, env vars,
and any runtime keyword overrides (highest priority wins).
Raises NimbleOptions.ValidationError on invalid options.
Examples
iex> Codat.Config.new(api_key: "my_key")
%Codat.Config{api_key: "my_key", base_url: "https://api.codat.io", ...}
@spec options_schema() :: NimbleOptions.t()
Returns the NimbleOptions schema for documentation and external validation.
Returns the resolved API key, checking config struct then CODAT_API_KEY env var. Raises if no key is available.