Investec Open API v0.1.0 InvestecOpenApi.Accounts View Source

Methods to obtain account details

Link to this section Summary

Functions

List all the accounts for a given user. This needs an authenticated client as an input parameter.

Link to this section Types

Specs

t() :: %InvestecOpenApi.Accounts{
  account_id: binary(),
  account_name: binary(),
  account_number: binary(),
  product_name: binary(),
  reference_name: binary()
}

Link to this section Functions

Link to this function

call_list_accounts(client)

View Source

Specs

Link to this function

create_account_object(account)

View Source

Specs

create_account_object(map()) :: t()

Specs

list_accounts(InvestecOpenApi.Client.t()) ::
  {:error, binary() | Jason.DecodeError.t()}
  | {:ok, [t()], InvestecOpenApi.Client.t()}

List all the accounts for a given user. This needs an authenticated client as an input parameter.

It will return a list with %InvestecOpenApi.Accounts{} objects.

With this it also returns an authenticated %InvestecOpenApi.Client{} again, because if the previous access_token has expired, a new one woule automatically be created again

Example

iex> {:ok, client} = InvestecOpenApi.new()
...> {:ok, accounts, _client} = InvestecOpenApi.Accounts.list_accounts(client)
...> accounts
[
  %InvestecOpenApi.Accounts{account_id: "172878438321553632224",
  account_name: "Mr John Doe",
  account_number: "10010206147",
  product_name: "Private Bank Account",
  reference_name: "My Investec Private Bank Account"}
]