3.0.0 • Published 5 years ago

@datafire/nexmo_subaccounts v3.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

@datafire/nexmo_subaccounts

Client library for Subaccounts API

Installation and Usage

npm install --save @datafire/nexmo_subaccounts
let nexmo_subaccounts = require('@datafire/nexmo_subaccounts').create({
  username: "",
  password: ""
});

.then(data => {
  console.log(data);
});

Description

The Subaccounts API enables you to create subaccounts under your primary account. Subaccounts facilitate differential product configuration, reporting, and billing. The Subaccounts API is released initially with restricted availability. You can read more about the API in the Subaccounts documentation.

Actions

retrieveBalanceTransfers

Retrieve a list of balance transfers that have taken place for a primary account within a specified time period.

nexmo_subaccounts.retrieveBalanceTransfers({
  "api_key": "",
  "start_date": ""
}, context)

Input

  • input object
    • api_key required string: ID of the primary account.
    • start_date required string: Start of the retrieval period.
    • end_date string: End of the retrieval period. If absent then all transfers until now is returned.
    • subaccount string: Subaccount to filter by. You may send this multiple times to filter on multiple subaccounts

Output

transferBalance

Transfer balance between a primary account and one of its subaccounts. Note that balance_available_for_transfer = |account_balance - credit_limit| of the source account.

nexmo_subaccounts.transferBalance({
  "api_key": "",
  "body": {
    "from": "",
    "to": "",
    "amount": 0
  }
}, context)

Input

Output

retrieveCreditTransfers

Retrieve a list of credit transfers that have taken place for a primary account within a specified time period.

nexmo_subaccounts.retrieveCreditTransfers({
  "api_key": "",
  "start_date": ""
}, context)

Input

  • input object
    • api_key required string: ID of the primary account.
    • start_date required string: Start of the retrieval period.
    • end_date string: End of the retrieval period. If absent then all transfers until now is returned.
    • subaccount string: Subaccount to filter by. You may send this multiple times to filter on multiple subaccounts

Output

transferCredit

Transfer credit limit between a primary account and one of its subaccounts.

nexmo_subaccounts.transferCredit({
  "api_key": "",
  "body": {
    "from": "",
    "to": "",
    "amount": 0
  }
}, context)

Input

Output

retrieveSubaccountsList

Get the information of all the subaccounts owned by the primary account.

nexmo_subaccounts.retrieveSubaccountsList({
  "api_key": ""
}, context)

Input

  • input object
    • api_key required string: ID of the primary account

Output

createSubAccount

Create a subaccount for a given primary account.

nexmo_subaccounts.createSubAccount({
  "api_key": "",
  "body": {
    "name": ""
  }
}, context)

Input

Output

retrieveSubaccount

Get the information of a subaccount specified with its API key.

nexmo_subaccounts.retrieveSubaccount({
  "api_key": "",
  "subaccount_key": ""
}, context)

Input

  • input object
    • api_key required string: ID of the primary account
    • subaccount_key required string: ID of the subaccount

Output

modifySubaccount

Change one or more properties of a subaccount.

nexmo_subaccounts.modifySubaccount({
  "api_key": "",
  "subaccount_key": "",
  "body": {}
}, context)

Input

  • input object
    • api_key required string: ID of the primary account
    • subaccount_key required string: ID of the subaccount
    • body required ModifySubaccountRequest

Output

Definitions

ListBalanceTransfersResponse

ListCreditTransfersResponse

ModifySubaccountRequest

  • ModifySubaccountRequest object
    • name string
    • suspended boolean
    • use_primary_account_balance boolean

NewSubaccountRequest

  • NewSubaccountRequest object
    • name required string
    • secret string
    • use_primary_account_balance boolean

SubaccountCreateResponse

  • SubaccountCreateResponse
    • secret string: API secret of the subaccount.
    • api_key string: Unique subaccount ID.
    • balance number: Balance of the subAccount. Value is null if balance is shared with primary account.
    • created_at string: Subaccount creation date and time.
    • credit_limit number: Credit limit of the subAccount. Value is null if balance is shared with primary account.
    • name string: Name of the subaccount.
    • primary_account_api_key string: Unique primary account ID.
    • suspended boolean: Subaccount suspension status.
    • use_primary_account_balance boolean: Flag showing if balance is shared with primary account.

SubaccountResponse

  • SubaccountResponse object
    • api_key string: Unique subaccount ID.
    • balance number: Balance of the subAccount. Value is null if balance is shared with primary account.
    • created_at string: Subaccount creation date and time.
    • credit_limit number: Credit limit of the subAccount. Value is null if balance is shared with primary account.
    • name string: Name of the subaccount.
    • primary_account_api_key string: Unique primary account ID.
    • suspended boolean: Subaccount suspension status.
    • use_primary_account_balance boolean: Flag showing if balance is shared with primary account.

SubaccountsAllResponse

TransferBalanceOrCreditRequest

  • TransferBalanceOrCreditRequest object
    • amount required number
    • from required string
    • reference string
    • to required string

TransferBalanceResponse

  • TransferBalanceResponse object
    • amount number: Balance transfer amount
    • balance_transfer_id string: Unique balance transfer ID
    • created_at string: The date and time when the balance transfer was executed
    • from string: Account the balance is transferred from
    • reference string: Reference for the balance transfer
    • to string: Account the balance is transferred to

TransferCreditResponse

  • TransferCreditResponse object
    • amount number: Credit transfer amount
    • created_at string: The date and time when the credit transfer was executed
    • credit_transfer_id string: Unique credit transfer ID
    • from string: Account the credit is transferred from
    • reference string: Reference for the credit transfer
    • to string: Account the credit is transferred to