Tink.Categories (Tink v0.1.1)

Copy Markdown View Source

Categories API with explicit long-term caching (24-hour TTL).

Category data is static reference data — it does not change between API versions. This makes it the most cache-friendly resource in the SDK. Both list_categories/2 and get_category/3 store results for 24 hours, keyed on locale, to avoid redundant round-trips.

Cache Keys

  • List: "categories:<locale>"
  • Individual: "categories:<category_id>:<locale>"

Required Scopes

  • categories:read

Summary

Functions

Gets a specific category by ID with 24-hour caching.

Lists all available transaction categories with 24-hour caching.

Functions

get_category(client, category_id, opts \\ [])

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

Gets a specific category by ID with 24-hour caching.

Parameters

  • client - Tink client
  • category_id - Category identifier (e.g. "expenses:food.groceries")
  • opts - Options:
    • :locale - BCP 47 locale (default: "en_US")

Returns

  • {:ok, category} - Category details
  • {:error, error} - If the request fails

Examples

{:ok, cat} = Tink.Categories.get_category(client, "expenses:food.groceries")

list_categories(client, opts \\ [])

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

Lists all available transaction categories with 24-hour caching.

Different locales are cached independently so that locale-specific labels do not bleed into one another.

Parameters

  • client - Tink client
  • opts - Options:
    • :locale - BCP 47 locale (default: "en_US")
    • :cache - Override caching (true | false)

Returns

  • {:ok, categories} - List of categories
  • {:error, error} - If the request fails

Examples

{:ok, categories} = Tink.Categories.list_categories(client)

{:ok, sv_categories} = Tink.Categories.list_categories(client, locale: "sv_SE")