Tink.Consents (Tink v1.0.0)

Copy Markdown View Source

Full consent lifecycle management via the v2 connectivity API.

Requires consents or consents:readonly scope.

Use this to programmatically create, inspect, and revoke user consents without requiring a Tink Link re-flow for every operation.

Example

{:ok, consent} = Tink.Consents.create(app_client, %{
  "userId" => tink_user_id,
  "providerId" => "uk-ob-monzo",
  "scope" => "accounts:read,transactions:read"
})

# Later — check status
{:ok, consent} = Tink.Consents.get(app_client, consent["id"])

# Revoke when no longer needed
{:ok, _} = Tink.Consents.revoke(app_client, consent["id"])

Summary

Functions

Create a new consent. Requires consents.

Get a consent by ID. Requires consents:readonly.

Get a specific authorization for a consent. Requires consents:readonly.

Get a consent template for a provider. Requires consents:readonly.

List consents with pagination. Requires consents:readonly.

List authorizations for a consent. Requires consents:readonly.

Relay an authorization callback (server-side relay flows). Requires consents.

Revoke a consent. Requires consents.

Stream all consents across pages lazily.

Functions

create(client, params)

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

Create a new consent. Requires consents.

get(client, consent_id)

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

Get a consent by ID. Requires consents:readonly.

get_authorization(client, consent_id, authorization_id)

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

Get a specific authorization for a consent. Requires consents:readonly.

get_template(client, provider_id)

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

Get a consent template for a provider. Requires consents:readonly.

list(client, opts \\ [])

@spec list(
  Tink.Client.t(),
  keyword()
) :: {:ok, map()} | {:error, Tink.Error.t()}

List consents with pagination. Requires consents:readonly.

list_authorizations(client, consent_id)

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

List authorizations for a consent. Requires consents:readonly.

relay_authorization_callback(client, params)

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

Relay an authorization callback (server-side relay flows). Requires consents.

revoke(client, consent_id)

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

Revoke a consent. Requires consents.

stream(client, opts \\ [])

@spec stream(
  Tink.Client.t(),
  keyword()
) :: Enumerable.t()

Stream all consents across pages lazily.