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

AccessTokenBuilder

Constructor Summary

Public Constructor
public

constructor(client: Object, member: Object, resources: Array)

Represents a Builder for a transfer token.

Member Summary

Private Members
private

_client: *

private

_member: *

private

_payload: {"version": *, "refId": *, "access": *}

private

Method Summary

Public Methods
public

Builds the token payload.

public

async execute(): Promise

Executes the createToken API call to the server, and returns a promise with the token.

public

Adds a resource for metadata of one account.

public

Adds a resource for balance of one account.

public

Adds a resource for transactions of one account.

public

Adds a resource for one address.

public
this method was deprecated. Support for these resources will be removed.

Adds a resource for full access.

public
this method was deprecated. Support for this resource will be removed.

Adds a resource for metadata of all accounts.

public
this method was deprecated. Support for this resource will be removed.

Adds a resource for metadata of all accounts at a given bank.

public
this method was deprecated. Support for this resource will be removed.

Adds a resource for all addresses.

public
this method was deprecated. Support for this resource will be removed.

Adds a resource for balances of all accounts.

public
this method was deprecated. Support for this resource will be removed.

Adds a resource for balances of all accounts at a given bank.

public
this method was deprecated. Support for this resource will be removed.

Adds a resource for transactions of all accounts.

public
this method was deprecated. Support for this resource will be removed.

Adds a resource for transactions of all accounts at a given bank.

public
this method was deprecated. Support for this resource will be removed.

Adds a resource for resolved transfer destinations of all accounts.

public
this method was deprecated. Support for this resource will be removed.

Adds a resource for resolved transfer destinations of all accounts at a given bank.

public

Adds a resource for resolved transfer destinations of a given account.

public

Sets acting as on the token.

public

Sets the description of the token.

public

Sets the effective date of the token.

public

Sets the endorse token timeout.

public

Sets the expiration date of the token.

public

Adds a from id.

public

Sets the refId on the token.

public

Sets the alias of the grantee.

public

Sets the memberId of the grantee.

public

Sets the token request ID.

Public Constructors

public constructor(client: Object, member: Object, resources: Array) source

Represents a Builder for a transfer token.

Params:

NameTypeAttributeDescription
client Object

The http client to use for the API call

member Object

member performing the request

resources Array

the resources to give access to

Private Members

private _client: * source

private _member: * source

private _payload: {"version": *, "refId": *, "access": *} source

private _tokenRequestId: string source

Public Methods

public build(): Object source

Builds the token payload.

Return:

Object

token payload

public async execute(): Promise source

Executes the createToken API call to the server, and returns a promise with the token.

Return:

Promise

the created and filled access token

public forAccount(accountId: String): AccessTokenBuilder source

Adds a resource for metadata of one account.

Params:

NameTypeAttributeDescription
accountId String

id of the account

Return:

AccessTokenBuilder

returns back the builder object

public forAccountBalances(accountId: String): AccessTokenBuilder source

Adds a resource for balance of one account.

Params:

NameTypeAttributeDescription
accountId String

id of the account

Return:

AccessTokenBuilder

returns back the builder object

public forAccountTransactions(accountId: String): AccessTokenBuilder source

Adds a resource for transactions of one account.

Params:

NameTypeAttributeDescription
accountId String

id of the account

Return:

AccessTokenBuilder

returns back the builder object

public forAddress(addressId: String): AccessTokenBuilder source

Adds a resource for one address.

Params:

NameTypeAttributeDescription
addressId String

id of the address

Return:

AccessTokenBuilder

returns back the builder object

public forAll(): AccessTokenBuilder source

this method was deprecated. Support for these resources will be removed.

Adds a resource for full access.

Return:

AccessTokenBuilder

returns back the builder object

public forAllAccounts(): AccessTokenBuilder source

this method was deprecated. Support for this resource will be removed.

Adds a resource for metadata of all accounts.

Return:

AccessTokenBuilder

returns back the builder object

public forAllAccountsAtBank(bankId: String): AccessTokenBuilder source

this method was deprecated. Support for this resource will be removed.

Adds a resource for metadata of all accounts at a given bank.

Params:

NameTypeAttributeDescription
bankId String

id of the bank

Return:

AccessTokenBuilder

returns back the builder object

public forAllAddresses(): AccessTokenBuilder source

this method was deprecated. Support for this resource will be removed.

Adds a resource for all addresses.

Return:

AccessTokenBuilder

returns back the builder object

public forAllBalances(): AccessTokenBuilder source

this method was deprecated. Support for this resource will be removed.

Adds a resource for balances of all accounts.

Return:

AccessTokenBuilder

returns back the builder object

public forAllBalancesAtBank(bankId: String): AccessTokenBuilder source

this method was deprecated. Support for this resource will be removed.

Adds a resource for balances of all accounts at a given bank.

Params:

NameTypeAttributeDescription
bankId String

id of the bank

Return:

AccessTokenBuilder

returns back the builder object

public forAllTransactions(): AccessTokenBuilder source

this method was deprecated. Support for this resource will be removed.

Adds a resource for transactions of all accounts.

Return:

AccessTokenBuilder

returns back the builder object

public forAllTransactionsAtbank(bankId: String): AccessTokenBuilder source

this method was deprecated. Support for this resource will be removed.

Adds a resource for transactions of all accounts at a given bank.

Params:

NameTypeAttributeDescription
bankId String

id of the bank

Return:

AccessTokenBuilder

returns back the builder object

public forAllTransferDestinations(): AccessTokenBuilder source

this method was deprecated. Support for this resource will be removed.

Adds a resource for resolved transfer destinations of all accounts.

Return:

AccessTokenBuilder

returns back the builder object

public forAllTransferDestinationsAtBank(bankId: String): AccessTokenBuilder source

this method was deprecated. Support for this resource will be removed.

Adds a resource for resolved transfer destinations of all accounts at a given bank.

Params:

NameTypeAttributeDescription
bankId String

id of the bank

Return:

AccessTokenBuilder

returns back the builder object

public forTransferDestinations(accountId: String): AccessTokenBuilder source

Adds a resource for resolved transfer destinations of a given account.

Params:

NameTypeAttributeDescription
accountId String

id of the account

Return:

AccessTokenBuilder

returns back the builder object

public setActingAs(actingAs: Object): AccessTokenBuilder source

Sets acting as on the token.

Params:

NameTypeAttributeDescription
actingAs Object

entity the redeemer is acting on behalf of

Return:

AccessTokenBuilder

returns back the builder object

public setDescription(description: string): AccessTokenBuilder source

Sets the description of the token.

Params:

NameTypeAttributeDescription
description string

description

Return:

AccessTokenBuilder

returns back the builder object

public setEffectiveAtMs(effectiveAtMs: number): AccessTokenBuilder source

Sets the effective date of the token.

Params:

NameTypeAttributeDescription
effectiveAtMs number

effective date in milliseconds

Return:

AccessTokenBuilder

returns back the builder object

public setEndorseUntilMs(endorseUntilMs: number): AccessTokenBuilder source

Sets the endorse token timeout.

Params:

NameTypeAttributeDescription
endorseUntilMs number

time at which no more endorsements can be made

Return:

AccessTokenBuilder

returns back the builder object

public setExpiresAtMs(expiresAtMs: number): AccessTokenBuilder source

Sets the expiration date of the token.

Params:

NameTypeAttributeDescription
expiresAtMs number

expiration date in milliseconds

Return:

AccessTokenBuilder

returns back the builder object

public setFromId(memberId: String): AccessTokenBuilder source

Adds a from id.

Params:

NameTypeAttributeDescription
memberId String

fromId

Return:

AccessTokenBuilder

returns back the builder object

public setRefId(refId: string): AccessTokenBuilder source

Sets the refId on the token.

Params:

NameTypeAttributeDescription
refId string

client generated reference id

Return:

AccessTokenBuilder

returns back the builder object

public setToAlias(toAlias: Object): AccessTokenBuilder source

Sets the alias of the grantee.

Params:

NameTypeAttributeDescription
toAlias Object

alias of the grantee

Return:

AccessTokenBuilder

returns back the builder object

public setToMemberId(toMemberId: string): AccessTokenBuilder source

Sets the memberId of the grantee.

Params:

NameTypeAttributeDescription
toMemberId string

memberId of the grantee

Return:

AccessTokenBuilder

returns back the builder object

public setTokenRequestId(tokenRequestId: string): AccessTokenBuilder source

Sets the token request ID.

Params:

NameTypeAttributeDescription
tokenRequestId string

token request id

Return:

AccessTokenBuilder

returns back the builder object