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

Users API with cache invalidation on mutations.

User operations that modify state automatically invalidate the cache.

# `create_authorization`

```elixir
@spec create_authorization(Tink.Client.t(), map()) ::
  {:ok, map()} | {:error, Tink.Error.t()}
```

Creates an authorization grant for a user.

No caching — this is an authorization operation.

# `create_user`

```elixir
@spec create_user(Tink.Client.t(), map()) :: {:ok, map()} | {:error, Tink.Error.t()}
```

Creates a new Tink user.

This is a mutation operation - no caching, but doesn't invalidate either
since the user is new.

# `delete_credential`

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

Deletes a credential and invalidates user cache.

Returns `{:ok, map()}` on success (the response body) or `{:error, error}` on failure.
Cache invalidation is handled automatically by `Client.delete/3`.

# `delete_user`

```elixir
@spec delete_user(Tink.Client.t(), String.t()) :: :ok | {:error, Tink.Error.t()}
```

Deletes a Tink user and invalidates all their cached data.

# `get_credential`

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

Gets a specific credential with short-term caching.

# `get_user_access_token`

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

Gets a user access token from an authorization code.

No caching — this is an authentication operation.

# `list_credentials`

```elixir
@spec list_credentials(Tink.Client.t()) :: {:ok, map()} | {:error, Tink.Error.t()}
```

Lists credentials for a user with short-term caching (30 seconds).

Credential status changes frequently during authentication, so cache is short.

# `refresh_credential`

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

Refreshes a credential and invalidates user cache.

Triggers a data refresh from the bank. Cache is invalidated automatically by
`Client.post/4` on success; no extra invalidation is needed here.

---

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