@veryfi/veryfi-sdk 1.2.0 → 1.2.2

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 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'];
@@ -273,9 +275,9 @@ Client.prototype.process_document_buffer = async function (
273
275
  * @param {Array} file_urls Required if file_url isn't specified. List of publicly accessible URLs to multiple files, e.g. ["https://cdn.example.com/receipt1.jpg", "https://cdn.example.com/receipt2.jpg"]
274
276
  * @param {Array} categories List of categories to use when categorizing the document
275
277
  * @param {boolean} delete_after_processing Delete this document from Veryfi after data has been extracted
276
- * @param {int} max_pages_to_process When sending a long document to Veryfi for processing, this parameter controls how many pages of the document will be read and processed, starting from page 1.
277
278
  * @param {int} boost_mode Flag that tells Veryfi whether boost mode should be enabled. When set to 1, Veryfi will skip data enrichment steps, but will process the document faster. Default value for this flag is 0
278
279
  * @param {string} external_id Optional custom document identifier. Use this if you would like to assign your own ID to documents
280
+ * @param {int} max_pages_to_process When sending a long document to Veryfi for processing, this parameter controls how many pages of the document will be read and processed, starting from page 1.
279
281
  * @param {Object} kwargs Additional request parameters
280
282
  * @return {JSON} Data extracted from the document.
281
283
  */
@@ -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 response = await this._request("GET", endpoint_name, request_arguments)
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
 
@@ -211,20 +211,20 @@ export declare class Client {
211
211
  * @param {string[]} file_urls Required if file_url isn't specified. List of publicly accessible URLs to multiple files, e.g. ['https://cdn.example.com/receipt1.jpg', 'https://cdn.example.com/receipt2.jpg']
212
212
  * @param {string[]} categories List of categories to use when categorizing the document
213
213
  * @param {boolean} delete_after_processing Delete this document from Veryfi after data has been extracted
214
- * @param {number} max_pages_to_process When sending a long document to Veryfi for processing, this parameter controls how many pages of the document will be read and processed, starting from page 1.
215
214
  * @param {number} boost_mode Flag that tells Veryfi whether boost mode should be enabled. When set to 1, Veryfi will skip data enrichment steps, but will process the document faster. Default value for this flag is 0
216
215
  * @param {string} external_id Optional custom document identifier. Use this if you would like to assign your own ID to documents
216
+ * @param {number} max_pages_to_process When sending a long document to Veryfi for processing, this parameter controls how many pages of the document will be read and processed, starting from page 1.
217
217
  * @param {VeryfiExtraArgs} kwargs Additional request parameters
218
218
  * @return {Promise<VeryfiDocument>} Object of data extracted from the document
219
219
  */
220
220
  public process_document_url(
221
221
  file_url?: string,
222
+ file_urls?: string[],
222
223
  categories?: string[],
223
224
  delete_after_processing?: boolean,
224
225
  boost_mode?: number,
225
226
  external_id?: string,
226
227
  max_pages_to_process?: number,
227
- file_urls?: string[],
228
228
  { ...kwargs }?: VeryfiExtraArgs
229
229
  ): Promise<VeryfiDocument>;
230
230
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veryfi/veryfi-sdk",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Node.js module for communicating with the Veryfi OCR API",
5
5
  "main": "lib/main.js",
6
6
  "typings": "types/main.d.ts",