new module:ApiClient()
- Source:
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.
Members
(static, readonly) CollectionFormatEnum :String
- Source:
Properties:
Name | Type | Description |
---|---|---|
CSV |
String | Comma-separated values. Value: |
SSV |
String | Space-separated values. Value: |
TSV |
String | Tab-separated values. Value: |
PIPES |
String | Pipe(|)-separated values. Value: |
MULTI |
String | Native array. Value: |
Enumeration of collection format separator strategies.
Type:
- String
(static) instance :module:ApiClient
- Source:
The default API client implementation.
Type:
authentications :Array.<String>
- Source:
The authentication methods to be included for all API calls.
Type:
- Array.<String>
basePath :String
- Source:
- Default Value:
- https://www.docusign.net/restapi
The base URL against which to resolve every API call's (relative) path.
Type:
- String
cache :Boolean
- Source:
- Default Value:
- true
If set to false an additional timestamp parameter is added to all API GET calls to
prevent browser caching
Type:
- Boolean
oAuthBasePath :String
- Source:
- Default Value:
- https://www.docusign.net/restapi
The base URL against which to resolve every authentication API call's (relative) path.
Type:
- String
proxy :String
- Source:
The full URI for the desired proxy.
A complete list of supported proxies can be found here: https://www.npmjs.com/package/proxy-agent.
Type:
- String
timeout :Number
- Source:
- Default Value:
- 60000
The default HTTP timeout for all API calls.
Type:
- Number
Methods
(static) constructFromObject(data, obj)
- Source:
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)
- Source:
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 |
Returns:
An instance of the specified type.
(static) parseDate(str) → {Date}
- Source:
Parses an ISO-8601 string representation of a date value.
Parameters:
Name | Type | Description |
---|---|---|
str |
String | The date value as a string. |
Returns:
The parsed date object.
- Type
- Date
addDefaultHeader()
- Source:
Adds request headers to the API client. Useful for Authentication.
applyAuthToRequest(requestConfig, authNames)
- Source:
Applies authentication headers to the request.
Parameters:
Name | Type | Description |
---|---|---|
requestConfig |
Object | The request configuration object used for |
authNames |
Array.<String> | An array of authentication method names. |
buildCollectionParam(param, collectionFormat) → {String|Array}
- Source:
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:
A string representation of the supplied collection, using the specified delimiter. Returns
param
as is if collectionFormat
is multi
.
- Type
- String | Array
buildUrl(path, pathParams) → {String}
- Source:
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:
The encoded path with parameter values substituted.
- Type
- String
callApi(path, httpMethod, pathParams, queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, returnType, callback) → {Object}
- Source:
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. |
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 |
callback |
module:ApiClient~callApiCallback | The callback function. If this is left undefined, this method will return a promise instead. |
Returns:
The axios request object if a callback is specified, else {Promise} A Promise object.
- Type
- Object
configureJWTAuthorizationFlow(privateKeyFilename, oAuthBasePath, clientId, userId, expiresIn, callback)
- Source:
- Deprecated:
- since version 4.1.0 Configures the current instance of ApiClient with a fresh OAuth JWT access token from Docusign
Parameters:
Name | Type | Description |
---|---|---|
privateKeyFilename |
the filename of the RSA private key |
|
oAuthBasePath |
Docusign OAuth base path (account-d.docusign.com for the developer sandbox |
|
clientId |
Docusign OAuth Client Id (AKA Integrator Key) |
|
userId |
Docusign user Id to be impersonated (This is a UUID) |
|
expiresIn |
in seconds for the token time-to-live |
|
callback |
the callback function. |
deserialize(response, returnType)
- Source:
Deserializes an HTTP response body into a value of the specified type.
Parameters:
Name | Type | Description |
---|---|---|
response |
Object | An Axios response object. |
returnType |
String | Array.<String> | Object.<String, Object> | function | The type to return. Pass a string for simple types |
Returns:
A value of the specified type.
generateAccessToken(clientId, clientSecret, code)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
clientId |
OAuth2 client ID: Identifies the client making the request. |
|
clientSecret |
the secret key you generated when you set up the integration in Docusign Admin console. |
|
code |
The authorization code that you received from the getAuthorizationUri callback. |
Returns:
OAuthToken object.xx
getAuthorizationUri(clientId, scopes, redirectUri, responseType, state)
- Source:
Helper method to configure the OAuth accessCode/implicit flow parameters
Parameters:
Name | Type | Description |
---|---|---|
clientId |
OAuth2 client ID: Identifies the client making the request. |
|
scopes |
the list of requested scopes. |
|
redirectUri |
this determines where to deliver the response containing the authorization code or access token. |
|
responseType |
determines the response type of the authorization request. |
|
state |
Allows for arbitrary state that may be useful to your application. |
getBasePath()
- Source:
Gets the API endpoint base URL.
getJWTUri(clientId, redirectURI, oAuthBasePath) → {string}
- Source:
Helper method to build the OAuth JWT grant uri (used once to get a user consent for impersonation)
Parameters:
Name | Type | Description |
---|---|---|
clientId |
OAuth2 client ID |
|
redirectURI |
OAuth2 redirect uri |
|
oAuthBasePath |
Docusign OAuth base path (account-d.docusign.com for the developer sandbox |
Returns:
the OAuth JWT grant uri as a String
- Type
- string
getOAuthBasePath()
- Source:
Gets the authentication server endpoint base URL.
getUserInfo(accessToken)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
accessToken |
the bearer token to use to authenticate for this call. |
Returns:
OAuth UserInfo model
isFileParam(param) → {Boolean}
- Source:
Checks whether the given parameter value represents file-like content.
Parameters:
Name | Type | Description |
---|---|---|
param |
The parameter to check. |
Returns:
true
if param
represents a file.
- Type
- Boolean
isJsonMime(contentType) → {Boolean}
- Source:
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:
true
if contentType
represents JSON, otherwise false
.
- Type
- Boolean
jsonPreferredMime(contentTypes) → {String}
- Source:
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:
The chosen content type, preferring JSON.
- Type
- String
normalizeParams(params) → {Object.<String, Object>}
- Source:
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:
normalized parameters.
- Type
- Object.<String, Object>
paramToString(param) → {String}
- Source:
Returns a string representation for an actual parameter.
Parameters:
Name | Type | Description |
---|---|---|
param |
The actual parameter. |
Returns:
The string representation of param
.
- Type
- String
setBasePath()
- Source:
Sets the API endpoint base URL.
setJWTToken()
- Source:
Sets default JWT authorization token for APIs.
setOAuthBasePath()
- Source:
Sets the authentication server endpoint base URL.
Type Definitions
callApiCallback(error, data, response)
- Source:
(Optional)Callback function to receive the result of the
Parameters:
Name | Type | Description |
---|---|---|
error |
String | Error message, if any. |
data |
The data returned by the service call. |
|
response |
String | The complete HTTP response. |