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

HttpClient

Client to make unauthenticated requests to the Token gateway.

Constructor Summary

Public Constructor
public

constructor(options: Object)

Creates the client with the given environment.

Member Summary

Private Members
private

Method Summary

Public Methods
public

async approveFirstKey(memberId: string, key: Object, cryptoEngine: Object): Object

Approve a first key for a member (self signed).

public

async approveFirstKeys(memberId: string, keys: Array, cryptoEngine: Object): Object

Approve the first keys for a member (self signed).

public

createMemberId(memberType: *, tokenRequestId: *): Object

Creates a memberId.

public

async getBanksOrCountries(options: Object, getCountries: boolean): Object

Gets banks or countries.

public

async getBlob(blobId: string): Object

Gets a blob from the server.

public

getMember(memberId: string): Object

Gets the member's information.

public

Returns the Token member.

public

async getTokenRequestResult(tokenRequestId: string): Object

Get the token request result based on its token request ID.

public

Invalidate a notification.

public

normalizeAlias(alias: *): *

public

notify(alias: Object, body: Object): Object

Notifies a user.

public

notifyCreateAndEndorseToken(tokenRequestId: *, addKey: *, receiptContact: *): Object

Notifies subscribed devices that a token should be created and endorsed.

public

notifyEndorseAndAddKey(endorseAndAddKey: Object): Object

this method was deprecated. use notifyCreateAndEndorseToken instead

Notifies subscribed devices that a token payload should be endorsed and keys should be added.

public

Sends a notification to a user to request a payment.

public

Gets a member given an alias.

public

async retrieveTokenRequest(requestId: string): Promise

Retrieves a request for a token.

public

async updateTokenRequest(requestId: string, options: Object): Promise

Updates an existing token request.

Public Constructors

public constructor(options: Object) source

Creates the client with the given environment.

Params:

NameTypeAttributeDescription
options Object

Private Members

private _instance: * source

Public Methods

public async approveFirstKey(memberId: string, key: Object, cryptoEngine: Object): Object source

Approve a first key for a member (self signed).

Params:

NameTypeAttributeDescription
memberId string

id of the member

key Object

key to approve

cryptoEngine Object

engine to use for signing

Return:

Object

response to the API call

public async approveFirstKeys(memberId: string, keys: Array, cryptoEngine: Object): Object source

Approve the first keys for a member (self signed).

Params:

NameTypeAttributeDescription
memberId string

id of the member

keys Array

keys to approve

cryptoEngine Object

engine to use for signing

Return:

Object

response to the API call

public createMemberId(memberType: *, tokenRequestId: *): Object source

Creates a memberId.

Params:

NameTypeAttributeDescription
memberType *

{string} memberType - type of member to create. 'PERSONAL' if undefined

tokenRequestId *

{string} tokenRequestId - (optional) token request id if the member is being claimed

Return:

Object

response to the API call

public async getBanksOrCountries(options: Object, getCountries: boolean): Object source

Gets banks or countries.

Params:

NameTypeAttributeDescription
options Object

optional parameters

getCountries boolean

get countries instead of banks if true

Return:

Object

response to the API call

public async getBlob(blobId: string): Object source

Gets a blob from the server.

Params:

NameTypeAttributeDescription
blobId string

id of the blob

Return:

Object

response to the API call

public getMember(memberId: string): Object source

Gets the member's information.

Params:

NameTypeAttributeDescription
memberId string

member id to lookup the member for

Return:

Object

response to the API call

public async getTokenMember(): Promise source

Returns the Token member.

Return:

Promise

response to the API call

public async getTokenRequestResult(tokenRequestId: string): Object source

Get the token request result based on its token request ID.

Params:

NameTypeAttributeDescription
tokenRequestId string

token request id

Return:

Object

response to the API call

public invalidateNotification(notificationId: Object): Object source

Invalidate a notification.

Params:

NameTypeAttributeDescription
notificationId Object

the notification id to invalidate

Return:

Object

response to the API call

public normalizeAlias(alias: *): * source

Params:

NameTypeAttributeDescription
alias *

Return:

*

public notify(alias: Object, body: Object): Object source

Notifies a user.

Params:

NameTypeAttributeDescription
alias Object

user to notify

body Object

body of the notification

Return:

Object

response to the API call

public notifyCreateAndEndorseToken(tokenRequestId: *, addKey: *, receiptContact: *): Object source

Notifies subscribed devices that a token should be created and endorsed.

Params:

NameTypeAttributeDescription
tokenRequestId *

token request ID

addKey *

(optional) add key payload

receiptContact *

(optional) receipt contact

Return:

Object

response to the API call

public notifyEndorseAndAddKey(endorseAndAddKey: Object): Object source

this method was deprecated. use notifyCreateAndEndorseToken instead

Notifies subscribed devices that a token payload should be endorsed and keys should be added.

Params:

NameTypeAttributeDescription
endorseAndAddKey Object

the endorseAndAddKey payload to be sent

Return:

Object

response to the API call

public notifyPaymentRequest(tokenPayload: Object): Object source

Sends a notification to a user to request a payment.

Params:

NameTypeAttributeDescription
tokenPayload Object

requested transfer token

Return:

Object

response to the API call

public resolveAlias(alias: Object): Object source

Gets a member given an alias.

Params:

NameTypeAttributeDescription
alias Object

alias to lookup

Return:

Object

response to the API call

public async retrieveTokenRequest(requestId: string): Promise source

Retrieves a request for a token. Called by the web(user) or by a TPP, to get request details.

Params:

NameTypeAttributeDescription
requestId string

token request id

Return:

Promise

response to the API call

public async updateTokenRequest(requestId: string, options: Object): Promise source

Updates an existing token request.

Params:

NameTypeAttributeDescription
requestId string

token request ID

options Object

new token request options

Return:

Promise

response to the API call