StarlingBank.Transactions (StarlingBank v1.0.0)

Copy Markdown View Source

Transaction feed ("feed items") — the unified view of money movements on an account: card payments, transfers, direct debits, etc.

Required scopes: transaction:read, transaction:edit.

Summary

Functions

Attaches a receipt to a feed item. attrs should match Starling's receipt schema.

Downloads a feed item attachment's binary content.

Lists feed items (transactions) for an account's default category, within an optional time range.

Downloads a statement as CSV for the given date range.

Downloads a statement as PDF (binary) for the given date range.

Updates user-editable metadata (e.g. spending category, notes) on a feed item.

Types

t()

@type t() :: %StarlingBank.Transactions{
  amount_minor_units: integer(),
  counter_party_name: String.t() | nil,
  counter_party_type: String.t() | nil,
  currency: String.t(),
  direction: String.t(),
  feed_item_uid: String.t(),
  reference: String.t() | nil,
  source: String.t(),
  spending_category: String.t() | nil,
  status: String.t(),
  transaction_time: DateTime.t() | nil,
  updated_at: DateTime.t() | nil
}

Functions

attach_receipt(feed_item_uid, attrs, client \\ nil)

@spec attach_receipt(String.t(), map(), StarlingBank.Client.t() | keyword() | nil) ::
  {:ok, map()} | {:error, StarlingBank.Error.t()}

Attaches a receipt to a feed item. attrs should match Starling's receipt schema.

attachment(attachment_uid, client \\ nil)

@spec attachment(String.t(), StarlingBank.Client.t() | keyword() | nil) ::
  {:ok, binary()} | {:error, StarlingBank.Error.t()}

Downloads a feed item attachment's binary content.

get(account_uid, category_uid, feed_item_uid, client \\ nil)

@spec get(
  String.t(),
  String.t(),
  String.t(),
  StarlingBank.Client.t() | keyword() | nil
) ::
  {:ok, t()} | {:error, StarlingBank.Error.t()}

Fetches a single feed item by UID.

list(account_uid, category_uid, opts \\ [], client \\ nil)

@spec list(
  String.t(),
  String.t(),
  keyword(),
  StarlingBank.Client.t() | keyword() | nil
) ::
  {:ok, [t()]} | {:error, StarlingBank.Error.t()}

Lists feed items (transactions) for an account's default category, within an optional time range.

statement_csv(account_uid, from, to, client \\ nil)

@spec statement_csv(
  String.t(),
  Date.t(),
  Date.t(),
  StarlingBank.Client.t() | keyword() | nil
) ::
  {:ok, binary()} | {:error, StarlingBank.Error.t()}

Downloads a statement as CSV for the given date range.

statement_pdf(account_uid, from, to, client \\ nil)

@spec statement_pdf(
  String.t(),
  Date.t(),
  Date.t(),
  StarlingBank.Client.t() | keyword() | nil
) ::
  {:ok, binary()} | {:error, StarlingBank.Error.t()}

Downloads a statement as PDF (binary) for the given date range.

update_metadata(account_uid, feed_item_uid, attrs, client \\ nil)

@spec update_metadata(
  String.t(),
  String.t(),
  map(),
  StarlingBank.Client.t() | keyword() | nil
) ::
  {:ok, nil} | {:error, StarlingBank.Error.t()}

Updates user-editable metadata (e.g. spending category, notes) on a feed item.