Home Reference Source Test
public class | source

Member

Extends:

@token-io/core~CoreMember → Member

Represents a Token member.

Constructor Summary

Public Constructor
public

constructor(options: object)

Member Summary

Private Members
private

_client: *

private

Method Summary

Public Methods
public

cancelToken(token: Token | string): Promise<TokenOperationResult>

Cancels a token.

public

createCustomization(logo: BlobPayload, colors: object, consentText: string, name: string, appName: string): Promise<string>

Creates a customization.

public

Creates a representable that acts as another member via an access token.

public

Looks up all access tokens.

public

getAccount(accountId: string): Promise<Account>

Looks up a member's account by ID.

public

getAccounts(): Promise<Array<Account>>

Looks up the member's accounts.

public

getActiveAccessToken(toMemberId: string): Promise<Token>

Looks up a existing access token where the calling member is the grantor and given member is the grantee.

public

getBlob(blobId: string): Promise<Blob>

Downloads a blob from the server.

public

getProfile(id: string): Promise<Profile>

Gets a member's public profile.

public

getProfilePicture(id: string, size: ProfilePictureSize): Promise<Blob>

Gets a member's public profile picture.

public

getToken(tokenId: string): Promise<Token>

Looks up a token by its ID.

public

getTransfer(transferId: string): Promise<Transfer>

Looks up a transfer.

public

Looks up all transfer tokens.

public

getTransfers(tokenId: string, offset: string, limit: number): Promise<object>

Looks up all of the member's transfers.

public

redeemToken(token: Token | string, amount: number, currency: string, description: string, destinations: Array<TransferEndpoint>, refId: string): Promise<Transfer>

Redeems a token.

public

setProfile(profile: Profile): Promise<Profile>

Replaces the authenticated member's public profile.

public

Uploads the authenticated member's public profile.

public

storeTokenRequest(tokenRequest: TokenRequestBuilder): Promise<TokenRequest>

Stores a request for a token.

Private Methods
private

_resolveToken(token: string | Token): Promise<Token>

Public Constructors

public constructor(options: object) source

Params:

NameTypeAttributeDescription
options object

Private Members

private _client: * source

private _unauthenticatedClient: * source

Public Methods

public cancelToken(token: Token | string): Promise<TokenOperationResult> source

Cancels a token.

Params:

NameTypeAttributeDescription
token Token | string

token to cancel, can be tokenId

Return:

Promise<TokenOperationResult>

cancelled token

public createCustomization(logo: BlobPayload, colors: object, consentText: string, name: string, appName: string): Promise<string> source

Creates a customization.

Params:

NameTypeAttributeDescription
logo BlobPayload

logo

colors object
  • nullable: true

map of ARGB colors #AARRGGBB

consentText string
  • nullable: true

consent text

name string
  • nullable: true

display name

appName string
  • nullable: true

corresponding app name

Return:

Promise<string>

customization ID

public forAccessToken(accessTokenId: string): Representable source

Creates a representable that acts as another member via an access token.

Params:

NameTypeAttributeDescription
accessTokenId string

ID of the access token

Return:

Representable

new member that acts as another member

public getAccessTokens(offset: string, limit: number): Promise<object> source

Looks up all access tokens.

Params:

NameTypeAttributeDescription
offset string

where to start looking

limit number

how many to look for

Return:

Promise<object>

access tokens - returns a list of access tokens

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

Looks up a member's account by ID.

Params:

NameTypeAttributeDescription
accountId string

accountId

Return:

Promise<Account>

Promise resolving to the account

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

Looks up the member's accounts.

Return:

Promise<Array<Account>>

Promise resolving to the accounts

public getActiveAccessToken(toMemberId: string): Promise<Token> source

Looks up a existing access token where the calling member is the grantor and given member is the grantee.

Params:

NameTypeAttributeDescription
toMemberId string

beneficiary of the active access token

Return:

Promise<Token>

access token returned by the server

public getBlob(blobId: string): Promise<Blob> source

Downloads a blob from the server.

Params:

NameTypeAttributeDescription
blobId string

ID of the blob

Return:

Promise<Blob>

downloaded blob

public getProfile(id: string): Promise<Profile> source

Gets a member's public profile.

Params:

NameTypeAttributeDescription
id string

member ID whose profile to get

Return:

Promise<Profile>

profile

public getProfilePicture(id: string, size: ProfilePictureSize): Promise<Blob> source

Gets a member's public profile picture.

Params:

NameTypeAttributeDescription
id string

member ID whose picture to get

size ProfilePictureSize

desired size category SMALL/MEDIUM/LARGE/ORIGINAL

Return:

Promise<Blob>

downloaded blob

public getToken(tokenId: string): Promise<Token> source

Looks up a token by its ID.

Params:

NameTypeAttributeDescription
tokenId string

ID of the token

Return:

Promise<Token>

token

public getTransfer(transferId: string): Promise<Transfer> source

Looks up a transfer.

Params:

NameTypeAttributeDescription
transferId string

ID to look up

Return:

Promise<Transfer>

transfer if found

public getTransferTokens(offset: string, limit: number): Promise<object> source

Looks up all transfer tokens.

Params:

NameTypeAttributeDescription
offset string

where to start looking

limit number

how many to look for

Return:

Promise<object>

returns a list of Transfer Tokens

public getTransfers(tokenId: string, offset: string, limit: number): Promise<object> source

Looks up all of the member's transfers.

Params:

NameTypeAttributeDescription
tokenId string

token to use for lookup

offset string

where to start looking

limit number

how many to retrieve

Return:

Promise<object>

Transfers

public redeemToken(token: Token | string, amount: number, currency: string, description: string, destinations: Array<TransferEndpoint>, refId: string): Promise<Transfer> source

Redeems a token.

Params:

NameTypeAttributeDescription
token Token | string

token to redeem. Can also be a tokenId

amount number

amount to redeem

currency string

currency to redeem

description string

optional transfer description

destinations Array<TransferEndpoint>
  • optional
  • default: undefined

transfer destinations

refId string

ID that will be set on created Transfer Token uses this to detect duplicates caller might use this to recognize the transfer if param empty, transfer will have random refId

Return:

Promise<Transfer>

Transfer created as a result of this redeem call

public setProfile(profile: Profile): Promise<Profile> source

Replaces the authenticated member's public profile.

Params:

NameTypeAttributeDescription
profile Profile

profile to set

Return:

Promise<Profile>

newly-set profile

public setProfilePicture(type: string, data: ArrayBuffer | string): Promise<void> source

Uploads the authenticated member's public profile.

Params:

NameTypeAttributeDescription
type string

MIME type

data ArrayBuffer | string

data in bytes, can be base64 string

Return:

Promise<void>

empty promise

public storeTokenRequest(tokenRequest: TokenRequestBuilder): Promise<TokenRequest> source

Stores a request for a token. Called by a merchant or a TPP that wants access from a user.

Params:

NameTypeAttributeDescription
tokenRequest TokenRequestBuilder

token request to store

Return:

Promise<TokenRequest>

the stored TokenRequestBuilder

Private Methods

private _resolveToken(token: string | Token): Promise<Token> source

Params:

NameTypeAttributeDescription
token string | Token

Return:

Promise<Token>