@veryfi/veryfi-sdk 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/main.js +11 -4
- package/package.json +1 -1
package/lib/main.js
CHANGED
|
@@ -116,10 +116,11 @@ Client.prototype._generate_signature = function (payload_params, timestamp) {
|
|
|
116
116
|
* @param {string} http_verb HTTP Method
|
|
117
117
|
* @param {string} endpoint_name Endpoint name such as 'documents', 'users', etc.
|
|
118
118
|
* @param {{}} request_arguments JSON payload to send to Veryfi
|
|
119
|
+
* @param params {{}} query params.
|
|
119
120
|
* @param file_stream file stream of the document
|
|
120
121
|
* @returns {JSON} A JSON of the response data.
|
|
121
122
|
*/
|
|
122
|
-
Client.prototype._request = async function (http_verb, endpoint_name, request_arguments, file_stream = null) {
|
|
123
|
+
Client.prototype._request = async function (http_verb, endpoint_name, request_arguments, params = {}, file_stream = null) {
|
|
123
124
|
let has_files = (Boolean(file_stream));
|
|
124
125
|
let headers = this._get_headers(has_files);
|
|
125
126
|
let api_url = `${this._get_url()}/partner${endpoint_name}`;
|
|
@@ -145,7 +146,8 @@ Client.prototype._request = async function (http_verb, endpoint_name, request_ar
|
|
|
145
146
|
url: api_url,
|
|
146
147
|
headers: headers,
|
|
147
148
|
data: request_arguments,
|
|
148
|
-
timeout: this.timeout * 1000
|
|
149
|
+
timeout: this.timeout * 1000,
|
|
150
|
+
params: params
|
|
149
151
|
});
|
|
150
152
|
} catch (response) {
|
|
151
153
|
let errorStatus = response['response']['status'];
|
|
@@ -338,13 +340,18 @@ Client.prototype.update_document = async function (document_id, {...kwargs} = {}
|
|
|
338
340
|
/**
|
|
339
341
|
* Get all w2 documents.
|
|
340
342
|
* @memberOf Client
|
|
343
|
+
* @param {int} page number, response is capped to maximum of 50 results per page.
|
|
341
344
|
* @return {Array} An array of JSON with all w2 documents.
|
|
342
345
|
*/
|
|
343
|
-
Client.prototype.get_w2_documents = async function () {
|
|
346
|
+
Client.prototype.get_w2_documents = async function (page = null) {
|
|
344
347
|
this._check_w2_version()
|
|
345
348
|
let endpoint_name = "/w2s/"
|
|
346
349
|
let request_arguments = {}
|
|
347
|
-
let
|
|
350
|
+
let params = {}
|
|
351
|
+
if (page !== null) {
|
|
352
|
+
params = {"page": page}
|
|
353
|
+
}
|
|
354
|
+
let response = await this._request("GET", endpoint_name, request_arguments, params)
|
|
348
355
|
return response['data']['results']
|
|
349
356
|
}
|
|
350
357
|
|