Account balances (POST /api/v1/json/balance and /balance/all), and the struct
get/2 returns (canonical name Balance).
{:ok, %Unicom360.Balance{balance: balance}} = Unicom360.Balance.get(client)
{:ok, whatsapp} = Unicom360.Balance.get(client, bundle_type: "WHATSAPP")
{:ok, %Unicom360.Balances{balances: balances}} = Unicom360.Balance.all(client)Balances are Decimals, exactly as the gateway sent them. Bundle types: "SMS" (the
default), "SMS_INTERNATIONAL", "EMAIL" and "WHATSAPP".
Fields of %Unicom360.Balance{}: message, balance (a Decimal), bundle_type,
client_id, client_name, raw and extra.
Summary
Functions
Every balance, as a map from bundle type to Decimal.
Like all/2, but returns the balances or raises Unicom360.Error.
The email bundle type.
One balance: the SMS bundle, or the bundle given as bundle_type:.
Like get/2, but returns the balance or raises Unicom360.Error.
The SMS bundle type.
The international SMS bundle type.
The WhatsApp bundle type.
Types
Functions
@spec all(Unicom360.Client.t(), keyword()) :: {:ok, Unicom360.Balances.t()} | {:error, Unicom360.Error.t()}
Every balance, as a map from bundle type to Decimal.
Options: :timeout (ms per attempt) and :max_retries.
@spec all!(Unicom360.Client.t(), keyword()) :: Unicom360.Balances.t()
Like all/2, but returns the balances or raises Unicom360.Error.
@spec email() :: String.t()
The email bundle type.
@spec get(Unicom360.Client.t(), keyword()) :: {:ok, t()} | {:error, Unicom360.Error.t()}
One balance: the SMS bundle, or the bundle given as bundle_type:.
Options: :bundle_type, :timeout (ms per attempt) and :max_retries. A refusal (for
example code: "CLIENT_NOT_FOUND") is an :api_error with no api_reference.
@spec get!(Unicom360.Client.t(), keyword()) :: t()
Like get/2, but returns the balance or raises Unicom360.Error.
@spec sms() :: String.t()
The SMS bundle type.
@spec sms_international() :: String.t()
The international SMS bundle type.
@spec whatsapp() :: String.t()
The WhatsApp bundle type.