# `Tink.Client`
[🔗](https://github.com/iamkanishka/tink.ex/blob/v0.1.1/lib/tink/client.ex#L1)

HTTP client for making requests to the Tink API with built-in caching.

This module handles authentication, request building, and response parsing
for all Tink API endpoints. It automatically caches GET requests for
improved performance.

## Cache Key Design

Cache keys are built from the full URL including query parameters, so different
paginated or filtered requests produce independent cache entries:

    "user_abc:data:v2:accounts?pageSize=10&pageToken=ABC" → own entry
    "user_abc:data:v2:accounts?pageSize=10&pageToken=XYZ" → own entry

# `t`

```elixir
@type t() :: %Tink.Client{
  access_token: String.t() | nil,
  adapter: module(),
  base_url: String.t(),
  cache: boolean(),
  client_id: String.t(),
  client_secret: String.t(),
  timeout: integer(),
  user_id: String.t() | nil
}
```

# `delete`

```elixir
@spec delete(t(), String.t(), keyword()) :: {:ok, map()} | {:error, Tink.Error.t()}
```

Performs a DELETE request and invalidates user cache on success.

# `get`

```elixir
@spec get(t(), String.t(), keyword()) :: {:ok, map()} | {:error, Tink.Error.t()}
```

Performs a GET request with automatic caching.

GET requests are cached based on the resource type with appropriate TTLs.
Cache can be disabled per-request via `opts: [cache: false]`.

# `patch`

```elixir
@spec patch(t(), String.t(), term(), keyword()) ::
  {:ok, map()} | {:error, Tink.Error.t()}
```

Performs a PATCH request and invalidates user cache on success.

# `post`

```elixir
@spec post(t(), String.t(), term(), keyword()) ::
  {:ok, map()} | {:error, Tink.Error.t()}
```

Performs a POST request and invalidates user cache on success.

# `put`

```elixir
@spec put(t(), String.t(), term(), keyword()) ::
  {:ok, map()} | {:error, Tink.Error.t()}
```

Performs a PUT request and invalidates user cache on success.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
