module:ApiClient()

new module:ApiClient()

This class subject to change without prior notice, Please dont use this class directly.

Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an application to use this class directly - the *Api and model classes provide the public API for the service. The contents of this file should be regarded as internal but are documented for completeness.

Classes

handlers/AddFundingAccountHandler

handlers/CancelPaymentAuthorizationHandler

handlers/CreateCustomerHandler

handlers/CreatePaymentAuthorizationHandler

handlers/CreatePaymentHandler

handlers/CreateRecurringPaymentSetupHandler

handlers/CreateRefundHandler

handlers/DeleteFundingAccountHandler

handlers/DeletePaymentHandler

handlers/DeletePaymentSetupHandler

handlers/DeleteRecordPaymentHandler

handlers/GetCustomerAccountHandler

handlers/GetCustomerHandler

handlers/GetFundingAccountHandler

handlers/GetPaymentHandler

handlers/GetPaymentSetupHandler

handlers/GetRefundHandler

handlers/RecordPaymentHandler

handlers/RenewCustomerAccountHandler

handlers/ReplaceFundingAccountHandler

handlers/RetrieveCustomerAccountsHandler

handlers/RetrieveCustomerAccountsPageHandler

handlers/RetrieveCustomersHandler

handlers/RetrieveCustomersPageHandler

handlers/RetrieveFeePaymentHandler

handlers/RetrieveFundingAccountsHandler

handlers/RetrieveFundingAccountsPageHandler

handlers/RetrievePaymentSetupsHandler

handlers/RetrievePaymentsHandler

handlers/RetrieveRefundsHandler

handlers/SimplePaymentHandler

handlers/UpdateCustomerHandler

handlers/UpdateFundingAccountHandler

handlers/UpdatePaymentHandler

handlers/UpdatePaymentSetupHandler

Members

static, readonly CollectionFormatEnum :String

Enumeration of collection format separator strategies.

Properties:
Name Type Description
CSV String

Comma-separated values. Value: csv

SSV String

Space-separated values. Value: ssv

TSV String

Tab-separated values. Value: tsv

PIPES String

Pipe(|)-separated values. Value: pipes

MULTI String

Native array. Value: multi

static instance :module:ApiClient

The default API client implementation.

authentications :Array.<String>

The authentication methods to be included for all API calls.

basePath :String

The base URL against which to resolve every API call's (relative) path.

Default Value:
  • https://api.orbipay.com/payments/v1

cache :Boolean

If set to false an additional timestamp parameter is added to all API GET calls to prevent browser caching

Default Value:
  • true

defaultHeaders :Array.<String>

The default HTTP headers to be included for all API calls.

Default Value:
  • {}

enableCookies

If set to true, the client will save the cookies from each server response, and return them in the next request.

Default Value:
  • false

timeout :Number

The default HTTP timeout for all API calls.

Default Value:
  • 60

Methods

static constructFromObject(data, obj)

Constructs a new map or array model from REST data.

Parameters:
Name Type Description
data Object | Array

The REST data.

obj Object | Array

The target object or array.

static convertToType(data, type)

Converts a value to the specified type.

Parameters:
Name Type Description
data String | Object

The data to convert, as a string or object.

type String | Array.<String> | Object.<String, Object> | function

The type to return. Pass a string for simple types or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type: all properties on data will be converted to this type.

Returns:
-

An instance of the specified type or null or undefined if data is null or undefined.

static parseDate(str) → {Date}

Parses an ISO-8601 string representation of a date value.

Parameters:
Name Type Description
str String

The date value as a string.

Returns:
Date -

The parsed date object.

applyAuthToRequest(request, authNames)

Applies authentication headers to the request.

Parameters:
Name Type Description
request Object

The request object created by a superagent() call.

authNames Array.<String>

An array of authentication method names.

buildCollectionParam(param, collectionFormat) → {String|Array}

Builds a string representation of an array-type actual parameter, according to the given collection format.

Parameters:
Name Type Description
param Array

An array parameter.

collectionFormat module:ApiClient.CollectionFormatEnum

The array element separator strategy.

Returns:
String | Array -

A string representation of the supplied collection, using the specified delimiter. Returns param as is if collectionFormat is multi.

buildUrl(path, pathParams) → {String}

Builds full URL by appending the given path to the base URL and replacing path parameter place-holders with parameter values. NOTE: query parameters are not handled here.

Parameters:
Name Type Description
path String

The path to append to the base URL.

pathParams Object

The parameter values to append.

Returns:
String -

The encoded path with parameter values substituted.

callApi(path, httpMethod, pathParams, queryParams, collectionQueryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, returnType, callback) → {Object}

Invokes the REST service using the supplied settings and parameters.

Parameters:
Name Type Description
path String

The base URL to invoke.

httpMethod String

The HTTP method to use.

pathParams Object.<String, String>

A map of path parameters and their values.

queryParams Object.<String, Object>

A map of query parameters and their values.

collectionQueryParams Object.<String, Object>

A map of collection query parameters and their values.

headerParams Object.<String, Object>

A map of header parameters and their values.

formParams Object.<String, Object>

A map of form parameters and their values.

bodyParam Object

The value to pass as the request body.

authNames Array.<String>

An array of authentication type names.

contentTypes Array.<String>

An array of request MIME types.

accepts Array.<String>

An array of acceptable response MIME types.

returnType String | Array | ObjectFunction

The required type to return; can be a string for simple types or the constructor for a complex type.

callback module:ApiClient~callApiCallback

The callback function.

Returns:
Object -

The SuperAgent request object.

deserialize(response, returnType)

Deserializes an HTTP response body into a value of the specified type.

Parameters:
Name Type Description
response Object

A SuperAgent response object.

returnType String | Array.<String> | Object.<String, Object> | function

The type to return. Pass a string for simple types or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type: all properties on data will be converted to this type.

Returns:
-

A value of the specified type.

isFileParam(param) → {Boolean}

Checks whether the given parameter value represents file-like content.

Parameters:
Name Type Description
param

The parameter to check.

Returns:
Boolean -

true if param represents a file.

isJsonMime(contentType) → {Boolean}

Checks whether the given content type represents JSON.
JSON content type examples:

  • application/json
  • application/json; charset=UTF8
  • APPLICATION/JSON
Parameters:
Name Type Description
contentType String

The MIME content type to check.

Returns:
Boolean -

true if contentType represents JSON, otherwise false.

jsonPreferredMime(contentTypes) → {String}

Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first.

Parameters:
Name Type Description
contentTypes Array.<String>
Returns:
String -

The chosen content type, preferring JSON.

normalizeParams(params) → {Object.<String, Object>}

Normalizes parameter values:

  • remove nils
  • keep files and arrays
  • format to string with `paramToString` for other cases
Parameters:
Name Type Description
params Object.<String, Object>

The parameters as object properties.

Returns:
Object.<String, Object> -

normalized parameters.

paramToString(param) → {String}

Returns a string representation for an actual parameter.

Parameters:
Name Type Description
param

The actual parameter.

Returns:
String -

The string representation of param.

Type Definitions

callApiCallback(error, data, response)

Callback function to receive the result of the operation.

Parameters:
Name Type Description
error String

Error message, if any.

data

The data returned by the service call.

response String

The complete HTTP response.