Constructor
new Client(endpoint, apiToken, signingKey, options)
Client Constructor.
Client Constructor.
Parameters:
Name | Type | Description |
---|---|---|
endpoint |
URL | string | |
apiToken |
string | |
signingKey |
string | |
options |
Object |
- Source:
- See:
Members
(static, constant) SIGN_DIGEST_NONE
Constant SIGN_DIGEST_NONE
.Constant SIGN_DIGEST_NONE
(static, constant) SIGN_DIGEST_SHA1
Constant SIGN_DIGEST_SHA1
.Constant SIGN_DIGEST_SHA1
(static, constant) SIGN_DIGEST_SHA256
Constant SIGN_DIGEST_SHA256
.Constant SIGN_DIGEST_SHA256
Methods
createRequest(name, modelnullable)
Create a Request object by name.
Create a Request object by name.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
name |
string | |||
model |
Model |
<nullable> |
null |
Throws:
generateAuthHeader(data) → {string}
Generates the authentication header value.
Generates the authentication header value.
Parameters:
Name | Type | Description |
---|---|---|
data |
string |
Returns:
- Type
- string
getApiToken() → {string}
Get the api token used to authenticate the request.
Get the api token used to authenticate the request.
Returns:
- Type
- string
getEndpoint() → {URL}
Get the API endpoint URL.
Get the API endpoint URL.
Returns:
- Type
- URL
getOption(key) → {*}
Get a client option.
Get a client option.
Parameters:
Name | Type | Description |
---|---|---|
key |
string |
Returns:
- Type
- *
getSigningKey() → {string}
Get the signing key used to sign requests.
Get the signing key used to sign requests. Base64 encoded.
Returns:
- Type
- string
promise(request) → {Promise}
Queue a Request object for a Promise.
Queue a Request object for a Promise.
Parameters:
Name | Type | Description |
---|---|---|
request |
Request |
Returns:
- Type
- Promise
send(request, callback) → {void}
Send a Request object with callback.
Send a Request object with callback.
Parameters:
Name | Type | Description |
---|---|---|
request |
Request | |
callback |
Client~sendCallback |
Throws:
-
When an invalid callback is supplied
- Type
- Error
Returns:
- Type
- void
sendLowLevel(data, callback) → {http.ClientRequest|https.ClientRequest}
Send an low level API request with callback.
Send an low level API request with callback.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | |
callback |
Client~sendLowLevelCallback |
Returns:
- Type
- http.ClientRequest | https.ClientRequest
setApiToken(apiToken) → {Client}
Set the api token used to authenticate the request.
Set the api token used to authenticate the request.
Parameters:
Name | Type | Description |
---|---|---|
apiToken |
string |
Returns:
- Type
- Client
setEndpoint(endpoint) → {Client}
Set the API endpoint URL.
Set the API endpoint URL.
Parameters:
Name | Type | Description |
---|---|---|
endpoint |
URL | string |
Returns:
- Type
- Client
setOption(key, value) → {Client}
Set a client option.
Set a client option.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | |
value |
* |
Returns:
- Type
- Client
setSigningKey(signingKey) → {Client}
Set the signing key used to sign requests.
Set the signing key used to sign requests. Base64 encoded.
Parameters:
Name | Type | Description |
---|---|---|
signingKey |
string |
Returns:
- Type
- Client