Pluggy.Transactions (PluggyAI v0.1.0)

Copy Markdown View Source

Functions for interacting with the Pluggy Transactions API.

Summary

Functions

Gets a transaction by ID.

Lists transactions for a given account.

Lists transactions with cursor-based pagination.

Updates a transaction (e.g. to change its category).

Functions

get(client, id)

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

Gets a transaction by ID.

get!(client, id)

@spec get!(Pluggy.Client.t(), String.t()) :: term()

list(client, account_or_id, opts \\ [])

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

Lists transactions for a given account.

The second argument accepts either an account ID string or an account map (e.g. an entry from Pluggy.Accounts.list/2) — the :id field is extracted automatically, making it easy to pipe the two calls together:

{:ok, %{results: [account | _]}} = Pluggy.Accounts.list(client, item_id)
Pluggy.Transactions.list(client, account)

Options

  • :from - Start date filter
  • :to - End date filter
  • :page_size - Number of results per page (1-500)
  • :page - Page number

list!(client, account_or_id, opts \\ [])

@spec list!(Pluggy.Client.t(), String.t() | map(), keyword()) :: term()

list_with_cursor(client, account_or_id, opts \\ [])

@spec list_with_cursor(Pluggy.Client.t(), String.t() | map(), keyword()) ::
  {:ok, map(), Pluggy.HTTP.Cursor.t() | nil} | {:error, Pluggy.Error.t()}

Lists transactions with cursor-based pagination.

The second argument accepts either an account ID string or an account map — the :id field is extracted automatically.

Returns {:ok, response, cursor} where cursor is a %Pluggy.HTTP.Cursor{} when more pages are available, or nil when on the last page.

Pass the cursor to Pluggy.HTTP.with_cursor/1 to fetch the next page.

update(client, id, attrs)

@spec update(Pluggy.Client.t(), String.t(), map()) ::
  {:ok, term()} | {:error, Pluggy.Error.t()}

Updates a transaction (e.g. to change its category).

update!(client, id, attrs)

@spec update!(Pluggy.Client.t(), String.t(), map()) :: term()