HTTP client for the Lithic API, built on Req.
Handles:
- API key authentication
- JSON encode/decode
- Automatic retries with exponential backoff (5xx + network errors)
- Telemetry events
- Idempotency keys for mutating requests
- Cursor-based pagination via
Lithic.Page
Creating a client
# Uses application config
client = Lithic.Client.new()
# Override per-client
client = Lithic.Client.new(api_key: "my_key", environment: :sandbox)Direct use (most users call resource modules instead)
{:ok, body} = Lithic.Client.get(client, "/cards")
{:ok, body} = Lithic.Client.post(client, "/cards", %{type: "VIRTUAL"})
Summary
Functions
DELETE request.
GET request.
Build a new client. Accepts any Lithic.Config.resolve/1 override keys.
PATCH request.
POST request.
PUT request.
Types
@type t() :: %Lithic.Client{config: Lithic.Config.t(), req: Req.Request.t()}
Functions
@spec delete(t(), String.t(), keyword()) :: {:ok, map()} | {:error, Lithic.Error.t()}
DELETE request.
@spec get(t(), String.t(), keyword()) :: {:ok, map()} | {:error, Lithic.Error.t()}
GET request.
Build a new client. Accepts any Lithic.Config.resolve/1 override keys.
PATCH request.
POST request.
PUT request.