Home Reference Source Test
public class | source

ApiClient

The Hyperwallet API Client

Test:

Static Method Summary

Static Public Methods
public static

Format response to documents model before passing to callback

Static Private Methods
private static

Creates response body parser for application/jose+json content-type

private static

isEmptyResponseBody(body: *): *

Helper function to check if the response body is an empty object

Constructor Summary

Public Constructor
public

constructor(username: string, password: string, server: string, encryptionData: string)

Create a instance of the API client

Member Summary

Public Members
public
public
public
public
Protected Members
protected

The flag shows if encryption is enabled

protected

The API password

protected

The API server to connect to

protected

The API username

protected

The Node SDK Version number

Method Summary

Public Methods
public

doGet(partialUrl: string, params: Object, callback: api-callback)

Do a GET call to the Hyperwallet API server

public

doPost(partialUrl: string, data: Object, params: Object, callback: api-callback)

Do a POST call to the Hyperwallet API server

public

doPut(partialUrl: string, data: Object, params: Object, callback: api-callback)

Do a PUT call to the Hyperwallet API server

public

doPutMultipart(partialUrl: string, data: Object, callback: api-callback)

Do a PUT call to the Hyperwallet API server to upload documents

Private Methods
private

processEncryptedResponse(httpMethod: string, err: Object, res: Object, callback: api-callback)

Process encrypted response from server

private

Process non encrypted response from server

private

wrapCallback(httpMethod: string, callback: api-callback): function(err: Object, res: Object)

Wrap a callback to process possible API and network errors

Static Public Methods

public static formatResForCallback(res: Object): * source

Format response to documents model before passing to callback

Params:

NameTypeAttributeDescription
res Object

Response object

Return:

*

Static Private Methods

private static createJoseJsonParser() source

Creates response body parser for application/jose+json content-type

private static isEmptyResponseBody(body: *): * source

Helper function to check if the response body is an empty object

Params:

NameTypeAttributeDescription
body *

Return:

*

Public Constructors

public constructor(username: string, password: string, server: string, encryptionData: string) source

Create a instance of the API client

Params:

NameTypeAttributeDescription
username string

The API username

password string

The API password

server string

The API server to connect to

encryptionData string

The API encryption data

Test:

Public Members

public clientPrivateKeySetPath: * source

public contextId: * source

public encryption: * source

public hyperwalletKeySetPath: * source

Protected Members

protected isEncrypted: boolean source

The flag shows if encryption is enabled

protected password: string source

The API password

protected server: string source

The API server to connect to

protected username: string source

The API username

protected version: string source

The Node SDK Version number

Public Methods

public doGet(partialUrl: string, params: Object, callback: api-callback) source

Do a GET call to the Hyperwallet API server

Params:

NameTypeAttributeDescription
partialUrl string

The api endpoint to call (gets prefixed by server and /rest/v4/)

params Object

Query parameters to send in this call

callback api-callback

The callback for this call

Test:

public doPost(partialUrl: string, data: Object, params: Object, callback: api-callback) source

Do a POST call to the Hyperwallet API server

Params:

NameTypeAttributeDescription
partialUrl string

The api endpoint to call (gets prefixed by server and /rest/v4/)

data Object

The data to send to the server

params Object

Query parameters to send in this call

callback api-callback

The callback for this call

Test:

public doPut(partialUrl: string, data: Object, params: Object, callback: api-callback) source

Do a PUT call to the Hyperwallet API server

Params:

NameTypeAttributeDescription
partialUrl string

The api endpoint to call (gets prefixed by server and /rest/v4/)

data Object

The data to send to the server

params Object

Query parameters to send in this call

callback api-callback

The callback for this call

Test:

public doPutMultipart(partialUrl: string, data: Object, callback: api-callback) source

Do a PUT call to the Hyperwallet API server to upload documents

Params:

NameTypeAttributeDescription
partialUrl string

The api endpoint to call (gets prefixed by server and /rest/v4/)

data Object

The data to send to the server

callback api-callback

The callback for this call

Test:

Private Methods

private processEncryptedResponse(httpMethod: string, err: Object, res: Object, callback: api-callback) source

Process encrypted response from server

Params:

NameTypeAttributeDescription
httpMethod string

The http method that is currently processing

err Object

Error object

res Object

Response object

callback api-callback

The final callback

private processNonEncryptedResponse(err: Object, res: Object, callback: api-callback) source

Process non encrypted response from server

Params:

NameTypeAttributeDescription
err Object

Error object

res Object

Response object

callback api-callback

The final callback

private wrapCallback(httpMethod: string, callback: api-callback): function(err: Object, res: Object) source

Wrap a callback to process possible API and network errors

Params:

NameTypeAttributeDescription
httpMethod string

The http method that is currently processing

callback api-callback

The final callback

Return:

function(err: Object, res: Object)

The super agent callback