StarlingBank.Client (StarlingBank v1.0.0)

Copy Markdown View Source

A reusable, explicit client struct.

Most functions in StarlingBank.Resources.* accept either:

  • a %StarlingBank.Client{} built with new/1, or
  • a plain keyword list of opts (access_token:, environment:, ...), or
  • nothing at all, in which case configuration falls back to the application environment (see StarlingBank.Config).

Building an explicit client is recommended whenever you talk to multiple Starling accounts/environments from the same application (e.g. a multi-tenant TPP integration).

Example

client = StarlingBank.Client.new(access_token: token, environment: :production)
{:ok, accounts} = StarlingBank.Accounts.list(client)

Summary

Functions

Builds a new client from opts. See StarlingBank.Config.new/1.

Types

t()

@type t() :: %StarlingBank.Client{config: StarlingBank.Config.t()}

Functions

new(opts \\ [])

@spec new(keyword()) :: t()

Builds a new client from opts. See StarlingBank.Config.new/1.