Investec Open API v0.1.0 InvestecOpenApi.Accounts.Balance View Source
This module deals with the get_account_balance api endpoint.
Link to this section Summary
Functions
Outputs the balance for a given user and account. This needs an authenticated client
and account_id (or %InvestecOpenApi.Accounts{} object) as input parameters.
Link to this section Types
Specs
Link to this section Functions
Specs
call_get_balance(InvestecOpenApi.Client.t(), binary()) :: {InvestecOpenApi.Client.t(), {:error, HTTPoison.Error.t()} | {:ok, HTTPoison.Response.t()}}
Specs
Specs
get_balance(InvestecOpenApi.Client.t(), binary() | InvestecOpenApi.Accounts.t()) :: {:error, any()} | {:ok, t(), InvestecOpenApi.Client.t()}
Outputs the balance for a given user and account. This needs an authenticated client
and account_id (or %InvestecOpenApi.Accounts{} object) as input parameters.
It will an %InvestecOpenApi.Accounts.Balance{} object.
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, [account | _], client} = InvestecOpenApi.Accounts.list_accounts(client)
...> {:ok, balance, client} = InvestecOpenApi.Accounts.Balance.get_balance(client, account)
...> balance
%InvestecOpenApi.Accounts.Balance{
account_id: "172878438321553632224",
available_balance: 98857.76,
currency: "ZAR",
current_balance: 28857.76
}