Low-level HTTP client for the Unit API.
Handles:
- JSON:API envelope building and parsing
- Bearer token authentication
- Automatic retries with exponential back-off (configurable)
- Idempotency key injection
- Telemetry instrumentation
- Pagination helpers
You should not need to use this module directly. Prefer the high-level
API modules (Unit.API.*).
Summary
Functions
Builds a query string for paginated list requests.
Performs a DELETE request.
Performs a GET request.
Generates a random idempotency key.
Performs a PATCH request.
Performs a POST request.
Performs a PUT request (used for binary uploads, e.g. document images).
Types
@type method() :: :get | :post | :patch | :put | :delete
@type response() :: {:ok, map() | [map()] | nil} | {:error, Unit.Error.t()}
Functions
Builds a query string for paginated list requests.
Options
:page_limit— number of items per page (default: 100, max: 1000):page_offset— offset for cursor-based paging:filter— map of filter params, e.g.%{status: "Active"}:sort— sort field, e.g."-createdAt"(prefix-for descending):include— comma-separated relationships to sideload
Performs a DELETE request.
Performs a GET request.
@spec idempotency_key() :: String.t()
Generates a random idempotency key.
Use the same key to safely retry mutating requests without double-processing.
Performs a PATCH request.
Performs a POST request.
Performs a PUT request (used for binary uploads, e.g. document images).