Home Reference Source Test
import Representable from '@token-io/tpp/src/main/Representable.js'
public class | source

Representable

Represents the part of a Token member that can be accessed through an access token.

Constructor Summary

Public Constructor
public

constructor(member: Member)

User Member::forAccessToken.

Member Summary

Private Members
private

Method Summary

Public Methods
public

confirmFunds(accountId: string, amount: number | string, currency: string): Promise<boolean>

Confirms if an account has sufficient funds for a purchase.

public

getAccount(accountId: string): Promise<Account>

Looks up an account by the account ID.

public

getAccounts(): Promise<Array<Account>>

Looks up linked accounts.

public

getBalance(accountId: string, keyLevel: KeyLevel): Promise<Balance>

Looks up the balance of an account.

public

getBalances(accountIds: Array<string>, keyLevel: KeyLevel): Promise<Array<Balance>>

Looks up the balances of an array of accounts.

public

getTransaction(accountId: string, transactionId: string, keyLevel: KeyLevel): Promise<Transaction>

Looks up a transaction.

public

getTransactions(accountId: string, offset: string, limit: number, keyLevel: KeyLevel): Promise<object>

Looks up all of the member's transactions for an account.

Public Constructors

public constructor(member: Member) source

User Member::forAccessToken.

Params:

NameTypeAttributeDescription
member Member

Private Members

private _member: Member source

Public Methods

public confirmFunds(accountId: string, amount: number | string, currency: string): Promise<boolean> source

Confirms if an account has sufficient funds for a purchase.

Params:

NameTypeAttributeDescription
accountId string

accountId

amount number | string

amount

currency string

currency

Return:

Promise<boolean>

true if account has sufficient funds

public getAccount(accountId: string): Promise<Account> source

Looks up an account by the account ID.

Params:

NameTypeAttributeDescription
accountId string

the ID

Return:

Promise<Account>

Promise resolving to the account

public getAccounts(): Promise<Array<Account>> source

Looks up linked accounts.

Return:

Promise<Array<Account>>

Promise resolving to the accounts

public getBalance(accountId: string, keyLevel: KeyLevel): Promise<Balance> source

Looks up the balance of an account.

Params:

NameTypeAttributeDescription
accountId string

ID of the account

keyLevel KeyLevel

key level

Return:

Promise<Balance>

Promise of get balance response object

public getBalances(accountIds: Array<string>, keyLevel: KeyLevel): Promise<Array<Balance>> source

Looks up the balances of an array of accounts.

Params:

NameTypeAttributeDescription
accountIds Array<string>

array of account IDs

keyLevel KeyLevel

key level

Return:

Promise<Array<Balance>>

Promise of get balances response object

public getTransaction(accountId: string, transactionId: string, keyLevel: KeyLevel): Promise<Transaction> source

Looks up a transaction.

Params:

NameTypeAttributeDescription
accountId string

ID of the account

transactionId string

which transaction to look up

keyLevel KeyLevel

key level

Return:

Promise<Transaction>

the Transaction

public getTransactions(accountId: string, offset: string, limit: number, keyLevel: KeyLevel): Promise<object> source

Looks up all of the member's transactions for an account.

Params:

NameTypeAttributeDescription
accountId string

ID of the account

offset string

where to start looking

limit number

how many to retrieve

keyLevel KeyLevel

key level

Return:

Promise<object>

Transactions