Represents an authenticated Tink API client.
Fields
:access_token— Bearer token (required):refresh_token— refresh token for obtaining new access tokens (if provided):token_type— "bearer" (default):expires_at—DateTimeexpiry; nil means never checked:scope— space-separated token scopes:id_hint— user hint returned by Tink in token responses:auto_refresh— re-fetch a client credentials token on 401:cache— setfalseto bypass caching for all calls on this client:rate_limit_key— Hammer bucket key; defaults toTink.Config.client_id():adapter— HTTP adapter module (default:Tink.Config.http_adapter())
Creating clients
{:ok, client} = Tink.Auth.client_credentials(scope: "authorization:grant user:create")
{:ok, client} = Tink.Auth.user_client(auth_code)
client = Tink.Client.new(access_token: "bearer_abc123")Bypassing cache per-client
no_cache_client = %{user_client | cache: false}
{:ok, accounts} = Tink.Accounts.list(no_cache_client)Tracing requests
Pass :client_trace_id to tag requests for tracing. Tink echoes it back
in the X-Client-Trace-ID response header:
Tink.Accounts.list(client, client_trace_id: "my-trace-abc-123")Idempotency
For POST requests that must not be duplicated (e.g. payments), pass an
:idempotency_key. Tink de-duplicates requests with the same key for 24h:
Tink.Payments.create(client, params, idempotency_key: idempotency_uuid)Per-call retry override
Tink.Transactions.list(client, max_retries: 0) # disable retry
Tink.Accounts.get(client, "id", max_retries: 5) # increase retries
Summary
Functions
Append query params to a path, omitting nil values.
Whether caching is enabled for this client.
Returns true if the access token has passed its expiry time.
Types
Functions
Append query params to a path, omitting nil values.
Client.add_query("/data/v2/accounts", %{"pageSize" => 50, "pageToken" => nil})
# => "/data/v2/accounts?pageSize=50"
Whether caching is enabled for this client.
@spec delete(t(), String.t(), keyword()) :: {:ok, map()} | {:error, Tink.Error.t()}
Returns true if the access token has passed its expiry time.
@spec get(t(), String.t(), keyword()) :: {:ok, map()} | {:error, Tink.Error.t()}