@veryfi/veryfi-sdk 1.4.8 → 1.5.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.
Files changed (176) hide show
  1. package/README.md +19 -2
  2. package/lib/anydocs/deleteAnyDocumentTag.js +14 -0
  3. package/lib/anydocs/getAnyDocument.js +3 -3
  4. package/lib/anydocs/getAnyDocumentTags.js +15 -0
  5. package/lib/anydocs/getAnyDocuments.js +3 -3
  6. package/lib/anydocs/getBlueprints.js +17 -0
  7. package/lib/anydocs/processAnyDocumentAsync.js +31 -0
  8. package/lib/anydocs/processAnyDocumentAsyncBase64.js +30 -0
  9. package/lib/anydocs/processAnyDocumentAsyncStream.js +30 -0
  10. package/lib/anydocs/processAnyDocumentAsyncUrl.js +30 -0
  11. package/lib/anydocs/tags/addAnyDocumentTag.js +15 -0
  12. package/lib/anydocs/tags/addAnyDocumentTags.js +15 -0
  13. package/lib/anydocs/tags/deleteAnyDocumentTags.js +12 -0
  14. package/lib/anydocs/updateAnyDocument.js +14 -0
  15. package/lib/bankstatements/getBankStatement.js +3 -3
  16. package/lib/bankstatements/getBankStatementSet.js +14 -0
  17. package/lib/bankstatements/getBankStatementSets.js +23 -0
  18. package/lib/bankstatements/getBankStatements.js +3 -3
  19. package/lib/bankstatements/processBankStatementAsync.js +31 -0
  20. package/lib/bankstatements/processBankStatementAsyncBase64.js +30 -0
  21. package/lib/bankstatements/processBankStatementAsyncStream.js +30 -0
  22. package/lib/bankstatements/processBankStatementAsyncUrl.js +30 -0
  23. package/lib/bankstatements/splitBankStatements.js +25 -0
  24. package/lib/bankstatements/splitBankStatementsBase64.js +24 -0
  25. package/lib/bankstatements/splitBankStatementsStream.js +24 -0
  26. package/lib/bankstatements/splitBankStatementsUrl.js +24 -0
  27. package/lib/bankstatements/tags/addBankStatementTag.js +15 -0
  28. package/lib/bankstatements/tags/addBankStatementTags.js +15 -0
  29. package/lib/bankstatements/tags/deleteBankStatementTag.js +13 -0
  30. package/lib/bankstatements/tags/deleteBankStatementTags.js +12 -0
  31. package/lib/bankstatements/tags/getBankStatementTags.js +14 -0
  32. package/lib/bankstatements/updateBankStatement.js +14 -0
  33. package/lib/businesscards/getBusinessCard.js +3 -3
  34. package/lib/businesscards/getBusinessCards.js +3 -3
  35. package/lib/businesscards/tags/addBusinessCardTag.js +15 -0
  36. package/lib/businesscards/tags/addBusinessCardTags.js +15 -0
  37. package/lib/businesscards/tags/deleteBusinessCardTag.js +13 -0
  38. package/lib/businesscards/tags/deleteBusinessCardTags.js +12 -0
  39. package/lib/businesscards/tags/getBusinessCardTags.js +14 -0
  40. package/lib/businesscards/updateBusinessCard.js +14 -0
  41. package/lib/checks/getCheck.js +3 -3
  42. package/lib/checks/getChecks.js +3 -3
  43. package/lib/checks/processCheckAsync.js +31 -0
  44. package/lib/checks/processCheckAsyncBase64.js +30 -0
  45. package/lib/checks/processCheckAsyncStream.js +30 -0
  46. package/lib/checks/processCheckAsyncUrl.js +30 -0
  47. package/lib/checks/processCheckWithRemittance.js +31 -0
  48. package/lib/checks/processCheckWithRemittanceBase64.js +30 -0
  49. package/lib/checks/processCheckWithRemittanceStream.js +30 -0
  50. package/lib/checks/processCheckWithRemittanceUrl.js +30 -0
  51. package/lib/checks/tags/addCheckTag.js +15 -0
  52. package/lib/checks/tags/addCheckTags.js +15 -0
  53. package/lib/checks/tags/deleteCheckTag.js +13 -0
  54. package/lib/checks/tags/deleteCheckTags.js +12 -0
  55. package/lib/checks/tags/getCheckTags.js +14 -0
  56. package/lib/checks/updateCheck.js +14 -0
  57. package/lib/classify/classifyDocument.js +25 -0
  58. package/lib/classify/classifyDocumentBase64.js +3 -3
  59. package/lib/classify/classifyDocumentStream.js +24 -0
  60. package/lib/classify/classifyDocumentUrl.js +4 -4
  61. package/lib/classify/extractDocument.js +28 -0
  62. package/lib/classify/extractDocumentBase64.js +27 -0
  63. package/lib/classify/extractDocumentStream.js +27 -0
  64. package/lib/classify/extractDocumentUrl.js +27 -0
  65. package/lib/client/client.js +151 -4
  66. package/lib/client/request.js +7 -2
  67. package/lib/contracts/deleteContract.js +12 -0
  68. package/lib/contracts/getContract.js +18 -0
  69. package/lib/contracts/getContracts.js +23 -0
  70. package/lib/contracts/processContract.js +25 -0
  71. package/lib/contracts/processContractBase64.js +24 -0
  72. package/lib/contracts/processContractStream.js +24 -0
  73. package/lib/contracts/processContractUrl.js +24 -0
  74. package/lib/contracts/tags/addContractTag.js +15 -0
  75. package/lib/contracts/tags/addContractTags.js +15 -0
  76. package/lib/contracts/tags/deleteContractTag.js +13 -0
  77. package/lib/contracts/tags/deleteContractTags.js +12 -0
  78. package/lib/contracts/tags/getContractTags.js +14 -0
  79. package/lib/contracts/updateContract.js +14 -0
  80. package/lib/documents/getDocument.js +1 -2
  81. package/lib/documents/getDocuments.js +5 -5
  82. package/lib/documents/lineitems/createLineItem.js +14 -0
  83. package/lib/documents/lineitems/deleteDocumentLineItems.js +12 -0
  84. package/lib/documents/lineitems/deleteLineItem.js +13 -0
  85. package/lib/documents/lineitems/getDocumentLineItems.js +14 -0
  86. package/lib/documents/lineitems/getLineItem.js +15 -0
  87. package/lib/documents/lineitems/updateLineItem.js +15 -0
  88. package/lib/documents/processDocument.js +3 -0
  89. package/lib/documents/processDocumentStream.js +1 -1
  90. package/lib/documents/processDocumentUrl.js +1 -1
  91. package/lib/documents/processDocumentsBulk.js +15 -0
  92. package/lib/documents/tags/getDocumentTags.js +14 -0
  93. package/lib/documents/taxlines/createTaxLine.js +14 -0
  94. package/lib/documents/taxlines/deleteTaxLine.js +13 -0
  95. package/lib/documents/taxlines/getTaxLine.js +15 -0
  96. package/lib/documents/taxlines/getTaxLines.js +14 -0
  97. package/lib/documents/taxlines/updateTaxLine.js +15 -0
  98. package/lib/fraud/addDevicesToBlocklist.js +20 -0
  99. package/lib/fraud/getFraudBlocklist.js +17 -0
  100. package/lib/fraud/removeDeviceFromBlocklist.js +12 -0
  101. package/lib/parse/deleteMarkdownDocument.js +12 -0
  102. package/lib/parse/getMarkdownDocument.js +14 -0
  103. package/lib/parse/getMarkdownDocumentSet.js +14 -0
  104. package/lib/parse/getMarkdownDocumentSets.js +23 -0
  105. package/lib/parse/getMarkdownDocuments.js +23 -0
  106. package/lib/parse/processMarkdownDocument.js +25 -0
  107. package/lib/parse/processMarkdownDocumentAsync.js +25 -0
  108. package/lib/parse/processMarkdownDocumentAsyncBase64.js +24 -0
  109. package/lib/parse/processMarkdownDocumentAsyncStream.js +24 -0
  110. package/lib/parse/processMarkdownDocumentAsyncUrl.js +24 -0
  111. package/lib/parse/processMarkdownDocumentBase64.js +24 -0
  112. package/lib/parse/processMarkdownDocumentSet.js +25 -0
  113. package/lib/parse/processMarkdownDocumentSetBase64.js +24 -0
  114. package/lib/parse/processMarkdownDocumentSetStream.js +24 -0
  115. package/lib/parse/processMarkdownDocumentSetUrl.js +24 -0
  116. package/lib/parse/processMarkdownDocumentStream.js +24 -0
  117. package/lib/parse/processMarkdownDocumentUrl.js +24 -0
  118. package/lib/parse/updateMarkdownDocument.js +14 -0
  119. package/lib/platform/getOcrCounts.js +20 -0
  120. package/lib/platform/getOpenApiSchema.js +17 -0
  121. package/lib/platform/getReleaseNotifications.js +13 -0
  122. package/lib/settings/addWebhook.js +20 -0
  123. package/lib/settings/confirmWebhook.js +23 -0
  124. package/lib/settings/createApiKey.js +20 -0
  125. package/lib/settings/createClientKeys.js +17 -0
  126. package/lib/settings/deleteClientKey.js +12 -0
  127. package/lib/settings/deleteTlsCertificate.js +12 -0
  128. package/lib/settings/getApiKey.js +17 -0
  129. package/lib/settings/getApiKeyPermissions.js +15 -0
  130. package/lib/settings/getApiKeys.js +15 -0
  131. package/lib/settings/getClientKeys.js +15 -0
  132. package/lib/settings/getTlsCertificates.js +15 -0
  133. package/lib/settings/getWebhooks.js +15 -0
  134. package/lib/settings/processTlsCertificate.js +17 -0
  135. package/lib/settings/resetClientKeys.js +17 -0
  136. package/lib/settings/revokeApiKey.js +12 -0
  137. package/lib/settings/rotateApiKey.js +14 -0
  138. package/lib/settings/updateApiKey.js +19 -0
  139. package/lib/settings/verifyApiKey.js +15 -0
  140. package/lib/split/getSplitDocument.js +2 -3
  141. package/lib/split/getSplitDocuments.js +3 -3
  142. package/lib/split/splitDocument.js +16 -0
  143. package/lib/split/splitDocumentStream.js +19 -0
  144. package/lib/split/splitDocumentUrl.js +1 -1
  145. package/lib/types/Client.ts +537 -1
  146. package/lib/types/VeryfiExtraArgs.ts +4 -5
  147. package/lib/w2s/getW2.js +1 -2
  148. package/lib/w2s/getW2Set.js +14 -0
  149. package/lib/w2s/getW2Sets.js +23 -0
  150. package/lib/w2s/splitW2s.js +25 -0
  151. package/lib/w2s/splitW2sBase64.js +24 -0
  152. package/lib/w2s/splitW2sStream.js +24 -0
  153. package/lib/w2s/splitW2sUrl.js +24 -0
  154. package/lib/w2s/tags/addW2Tag.js +15 -0
  155. package/lib/w2s/tags/addW2Tags.js +15 -0
  156. package/lib/w2s/tags/deleteW2Tag.js +13 -0
  157. package/lib/w2s/tags/deleteW2Tags.js +12 -0
  158. package/lib/w2s/tags/getW2Tags.js +14 -0
  159. package/lib/w2s/updateW2.js +14 -0
  160. package/lib/w8bene/getW8BENE.js +3 -3
  161. package/lib/w8bene/getW8BENEs.js +3 -3
  162. package/lib/w8bene/tags/addW8beneTag.js +15 -0
  163. package/lib/w8bene/tags/addW8beneTags.js +15 -0
  164. package/lib/w8bene/tags/deleteW8beneTag.js +13 -0
  165. package/lib/w8bene/tags/deleteW8beneTags.js +12 -0
  166. package/lib/w8bene/tags/getW8beneTags.js +14 -0
  167. package/lib/w8bene/updateW8BENE.js +14 -0
  168. package/lib/w9s/getW9.js +3 -3
  169. package/lib/w9s/getW9s.js +3 -3
  170. package/lib/w9s/tags/addW9Tag.js +15 -0
  171. package/lib/w9s/tags/addW9Tags.js +15 -0
  172. package/lib/w9s/tags/deleteW9Tag.js +13 -0
  173. package/lib/w9s/tags/deleteW9Tags.js +12 -0
  174. package/lib/w9s/tags/getW9Tags.js +14 -0
  175. package/lib/w9s/updateW9.js +14 -0
  176. package/package.json +5 -5
package/README.md CHANGED
@@ -63,7 +63,7 @@ This submits a document for processing (3-5 seconds for a response)
63
63
 
64
64
  ```js
65
65
  let veryfi_client = new Client(client_id, client_secret, username, api_key);
66
- let response = veryfi_client.process_document(file_path, categories=categories).then(response => {
66
+ let response = veryfi_client.process_document(file_path, categories).then(response => {
67
67
  console.log(response)
68
68
  });
69
69
  ```
@@ -71,11 +71,28 @@ let response = veryfi_client.process_document(file_path, categories=categories).
71
71
  ...or with a URL
72
72
 
73
73
  ```js
74
- let response = veryfi_client.process_document_url(url, external_id=some_id).then(response => {
74
+ let response = veryfi_client.process_document_from_url(url, null, categories, false, false, some_id).then(response => {
75
75
  console.log(response)
76
76
  });
77
77
  ```
78
78
 
79
+ ### Line items, tags, and other products
80
+
81
+ ```js
82
+ const document_id = '123';
83
+ await veryfi_client.create_line_item(document_id, { description: 'Milk', total: 3.5 });
84
+ await veryfi_client.get_document_line_items(document_id);
85
+ await veryfi_client.add_tag(document_id, 'reviewed');
86
+ await veryfi_client.get_document_tags(document_id);
87
+
88
+ await veryfi_client.process_contract_from_url('https://cdn.example.com/contract.pdf');
89
+ await veryfi_client.process_markdown_document_from_url('https://cdn.example.com/invoice.pdf');
90
+ await veryfi_client.classify_document_from_url('https://cdn.example.com/receipt.jpg', null, {
91
+ document_types: ['receipt', 'invoice']
92
+ });
93
+ await veryfi_client.extract_document_from_url('https://cdn.example.com/receipt.jpg', null, ['receipt', 'invoice']);
94
+ ```
95
+
79
96
  ### Response
80
97
 
81
98
  ```json
@@ -0,0 +1,14 @@
1
+ const Client = require('../client/constructor');
2
+ /**
3
+ * Unlink a tag from a specific any document. https://docs.veryfi.com/api/anydocs/unlink-a-tag-from-a-A-doc/
4
+ *
5
+ * @memberof Client
6
+ * @param {string} document_id ID of the document you'd like to unlink the tag from
7
+ * @param {string} tag_id ID of the tag you'd like to unlink
8
+ * @return {JSON} response about the unlinked tag.
9
+ */
10
+ Client.prototype.delete_any_document_tag = async function (document_id, tag_id) {
11
+ let endpoint_name = `/any-documents/${document_id}/tags/${tag_id}/`;
12
+ let request_arguments = {};
13
+ return this._request("DELETE", endpoint_name, request_arguments);
14
+ }
@@ -13,10 +13,10 @@ Client.prototype.get_any_document = async function (document_id,
13
13
  confidence_details = false,
14
14
  {...kwargs} = {}) {
15
15
  let endpoint_name = `/any-documents/${document_id}/`;
16
- let request_arguments = {
16
+ let query = Object.assign({
17
17
  "bounding_boxes": bounding_boxes,
18
18
  "confidence_details": confidence_details
19
- };
20
- let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false);
19
+ }, kwargs);
20
+ let document = await this._request("GET", endpoint_name, {}, query, false);
21
21
  return document['data'];
22
22
  }
@@ -0,0 +1,15 @@
1
+ const Client = require('../client/constructor');
2
+ /**
3
+ * Return all tags assigned to a specific any document. https://docs.veryfi.com/api/anydocs/get-A-doc-tags/
4
+ *
5
+ * @memberof Client
6
+ * @param {number} document_id The unique identifier of the document.
7
+ * @param {Object} kwargs Additional request parameters
8
+ * @returns {JSON} List of tags assigned to a specific any document.
9
+ */
10
+ Client.prototype.get_any_document_tags = async function (document_id, {...kwargs} = {}) {
11
+ let endpoint_name = `/any-documents/${document_id}/tags/`;
12
+ let request_arguments = {};
13
+ let response = await this._request("GET", endpoint_name, request_arguments, kwargs, false);
14
+ return response['data'];
15
+ }
@@ -16,13 +16,13 @@ Client.prototype.get_any_documents = async function (
16
16
  confidence_details = false,
17
17
  {...kwargs} = {}) {
18
18
  let endpoint_name = "/any-documents/";
19
- let request_arguments = {
19
+ let query = Object.assign({
20
20
  "page": page,
21
21
  "page_size": page_size,
22
22
  "bounding_boxes": bounding_boxes,
23
23
  "confidence_details": confidence_details
24
- };
25
- let documents = await this._request("GET", endpoint_name, request_arguments, kwargs, false);
24
+ }, kwargs);
25
+ let documents = await this._request("GET", endpoint_name, {}, query, false);
26
26
  if ("data" in documents) {
27
27
  documents = documents["data"];
28
28
  }
@@ -0,0 +1,17 @@
1
+ const Client = require('../client/constructor');
2
+ /**
3
+ * Get Blueprints. https://docs.veryfi.com/api/get-blueprints/
4
+ *
5
+ * @memberof Client
6
+ * @param {Object} kwargs Additional request parameters
7
+ * @returns {JSON} API response data
8
+ */
9
+ Client.prototype.get_blueprints = async function (
10
+ {...kwargs} = {}
11
+ ) {
12
+ let endpoint_name = "/blueprints/";
13
+ let query = Object.assign({
14
+ }, kwargs);
15
+ let response = await this._request("GET", endpoint_name, {}, query, false);
16
+ return response['data'];
17
+ }
@@ -0,0 +1,31 @@
1
+ const Client = require('../client/constructor');
2
+ const path = require('path');
3
+ const fs = require('fs');
4
+ /**
5
+ * Process a any document asynchronously. https://docs.veryfi.com/api/anydocs/process-a-A-doc-asynchronously/
6
+ * @example
7
+ * veryfi_client.process_any_document_async('file/path')
8
+ *
9
+ * @memberof Client
10
+ * @param {String} file_path Path on disk to a file to submit
11
+ * @param {String} blueprint_name The name of the extraction blueprints to use.
12
+ * @param {number} max_pages_to_process The number of pages to process for the document.
13
+ * @param {Object} kwargs Additional request parameters
14
+ * @returns {JSON} API response data
15
+ */
16
+ Client.prototype.process_any_document_async = async function (
17
+ file_path,
18
+ blueprint_name = null,
19
+ max_pages_to_process = 20,
20
+ {...kwargs} = {}
21
+ ) {
22
+ let file = fs.createReadStream(file_path);
23
+ let file_name = path.basename(file_path);
24
+ return this.process_any_document_async_from_stream(
25
+ file,
26
+ file_name,
27
+ blueprint_name,
28
+ max_pages_to_process,
29
+ kwargs
30
+ );
31
+ }
@@ -0,0 +1,30 @@
1
+ const Client = require('../client/constructor');
2
+ /**
3
+ * Process a any document asynchronously from a base64 string. https://docs.veryfi.com/api/anydocs/process-a-A-doc-asynchronously/
4
+ *
5
+ * @memberof Client
6
+ * @param {String} file_name The file name including the extension
7
+ * @param {String} file_base64_string Base64-encoded file contents (raw or data URI)
8
+ * @param {String} blueprint_name The name of the extraction blueprints to use.
9
+ * @param {number} max_pages_to_process The number of pages to process for the document.
10
+ * @param {Object} kwargs Additional request parameters
11
+ * @returns {JSON} API response data
12
+ */
13
+ Client.prototype.process_any_document_async_from_base64 = async function (
14
+ file_name,
15
+ file_base64_string,
16
+ blueprint_name = null,
17
+ max_pages_to_process = 20,
18
+ {...kwargs} = {}
19
+ ) {
20
+ let endpoint_name = "/any-documents/async/";
21
+ let request_arguments = {
22
+ "file_name": file_name,
23
+ "file_data": file_base64_string,
24
+ "blueprint_name": blueprint_name,
25
+ "max_pages_to_process": max_pages_to_process,
26
+ };
27
+ request_arguments = Object.assign(request_arguments, kwargs);
28
+ let response = await this._request("POST", endpoint_name, request_arguments, null, false);
29
+ return response['data'];
30
+ }
@@ -0,0 +1,30 @@
1
+ const Client = require('../client/constructor');
2
+ /**
3
+ * Process a any document asynchronously from a file stream. https://docs.veryfi.com/api/anydocs/process-a-A-doc-asynchronously/
4
+ *
5
+ * @memberof Client
6
+ * @param {stream.Readable} file ReadStream of a file to submit
7
+ * @param {String} file_name The file name including the extension
8
+ * @param {String} blueprint_name The name of the extraction blueprints to use.
9
+ * @param {number} max_pages_to_process The number of pages to process for the document.
10
+ * @param {Object} kwargs Additional request parameters
11
+ * @returns {JSON} API response data
12
+ */
13
+ Client.prototype.process_any_document_async_from_stream = async function (
14
+ file,
15
+ file_name,
16
+ blueprint_name = null,
17
+ max_pages_to_process = 20,
18
+ {...kwargs} = {}
19
+ ) {
20
+ let endpoint_name = "/any-documents/async/";
21
+ let request_arguments = {
22
+ "file": file,
23
+ "file_name": file_name,
24
+ "blueprint_name": blueprint_name,
25
+ "max_pages_to_process": max_pages_to_process,
26
+ };
27
+ request_arguments = Object.assign(request_arguments, kwargs);
28
+ let response = await this._request("POST", endpoint_name, request_arguments, null, true);
29
+ return response['data'];
30
+ }
@@ -0,0 +1,30 @@
1
+ const Client = require('../client/constructor');
2
+ /**
3
+ * Process a any document asynchronously from a URL. https://docs.veryfi.com/api/anydocs/process-a-A-doc-asynchronously/
4
+ *
5
+ * @memberof Client
6
+ * @param {string|null} file_url Required if file_urls isn't specified. Publicly accessible URL to a file.
7
+ * @param {string[]} file_urls Required if file_url isn't specified. List of publicly accessible URLs.
8
+ * @param {String} blueprint_name The name of the extraction blueprints to use.
9
+ * @param {number} max_pages_to_process The number of pages to process for the document.
10
+ * @param {Object} kwargs Additional request parameters
11
+ * @returns {JSON} API response data
12
+ */
13
+ Client.prototype.process_any_document_async_from_url = async function (
14
+ file_url = null,
15
+ file_urls = null,
16
+ blueprint_name = null,
17
+ max_pages_to_process = 20,
18
+ {...kwargs} = {}
19
+ ) {
20
+ let endpoint_name = "/any-documents/async/";
21
+ let request_arguments = {
22
+ "file_url": file_url,
23
+ "file_urls": file_urls,
24
+ "blueprint_name": blueprint_name,
25
+ "max_pages_to_process": max_pages_to_process,
26
+ };
27
+ request_arguments = Object.assign(request_arguments, kwargs);
28
+ let response = await this._request("POST", endpoint_name, request_arguments, null, false);
29
+ return response['data'];
30
+ }
@@ -0,0 +1,15 @@
1
+ const Client = require('../../client/constructor');
2
+ /**
3
+ * Add a tag to a any document. https://docs.veryfi.com/api/anydocs/add-a-tag-to-a-A-doc/
4
+ *
5
+ * @memberof Client
6
+ * @param {string} document_id ID of the document
7
+ * @param {string} tag Tag name to add
8
+ * @returns {JSON} Tag response
9
+ */
10
+ Client.prototype.add_any_document_tag = async function (document_id, tag) {
11
+ let endpoint_name = `/any-documents/${document_id}/tags/`;
12
+ let request_arguments = {"name": tag};
13
+ let response = await this._request("PUT", endpoint_name, request_arguments);
14
+ return response['data'];
15
+ }
@@ -0,0 +1,15 @@
1
+ const Client = require('../../client/constructor');
2
+ /**
3
+ * Add tags to a any document. https://docs.veryfi.com/api/anydocs/add-tags-to-a-A-doc/
4
+ *
5
+ * @memberof Client
6
+ * @param {string} document_id ID of the document
7
+ * @param {string[]} tags Tag names to add
8
+ * @returns {JSON} Tags response
9
+ */
10
+ Client.prototype.add_any_document_tags = async function (document_id, tags) {
11
+ let endpoint_name = `/any-documents/${document_id}/tags/`;
12
+ let request_arguments = {"tags": tags};
13
+ let response = await this._request("POST", endpoint_name, request_arguments);
14
+ return response['data'];
15
+ }
@@ -0,0 +1,12 @@
1
+ const Client = require('../../client/constructor');
2
+ /**
3
+ * Unlink all tags from a any document. https://docs.veryfi.com/api/anydocs/unlink-all-tags-from-a-A-doc/
4
+ *
5
+ * @memberof Client
6
+ * @param {string} document_id ID of the document
7
+ * @returns {JSON} Delete response
8
+ */
9
+ Client.prototype.delete_any_document_tags = async function (document_id) {
10
+ let endpoint_name = `/any-documents/${document_id}/tags/`;
11
+ return this._request("DELETE", endpoint_name, {});
12
+ }
@@ -0,0 +1,14 @@
1
+ const Client = require('../client/constructor');
2
+ /**
3
+ * Update a any document. https://docs.veryfi.com/api/anydocs/update-a-A-doc/
4
+ *
5
+ * @memberof Client
6
+ * @param {string} document_id ID of the resource
7
+ * @param {Object} kwargs Fields to update
8
+ * @returns {JSON} Updated resource
9
+ */
10
+ Client.prototype.update_any_document = async function (document_id, {...kwargs} = {}) {
11
+ let endpoint_name = `/any-documents/${document_id}/`;
12
+ let response = await this._request("PUT", endpoint_name, kwargs);
13
+ return response['data'];
14
+ }
@@ -15,10 +15,10 @@ Client.prototype.get_bank_statement = async function (
15
15
  {...kwargs} = {}
16
16
  ) {
17
17
  let endpoint_name = `/bank-statements/${document_id}/`;
18
- let request_arguments = {
18
+ let query = Object.assign({
19
19
  "bounding_boxes": bounding_boxes,
20
20
  "confidence_details": confidence_details
21
- };
22
- let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false);
21
+ }, kwargs);
22
+ let document = await this._request("GET", endpoint_name, {}, query, false);
23
23
  return document['data'];
24
24
  }
@@ -0,0 +1,14 @@
1
+ const Client = require('../client/constructor');
2
+ /**
3
+ * Get a Bank Statement set. https://docs.veryfi.com/api/get-a-bank-statement-set/
4
+ *
5
+ * @memberof Client
6
+ * @param {string} document_id ID of the resource
7
+ * @param {Object} kwargs Additional request parameters
8
+ * @returns {JSON} API response data
9
+ */
10
+ Client.prototype.get_bank_statement_set = async function (document_id, {...kwargs} = {}) {
11
+ let endpoint_name = `/bank-statements-set/${document_id}/`;
12
+ let response = await this._request("GET", endpoint_name, {}, kwargs, false);
13
+ return response['data'];
14
+ }
@@ -0,0 +1,23 @@
1
+ const Client = require('../client/constructor');
2
+ /**
3
+ * Get Bank Statement sets. https://docs.veryfi.com/api/get-bank-statement-sets/
4
+ *
5
+ * @memberof Client
6
+ * @param {number} page Page number
7
+ * @param {number} page_size Results per page
8
+ * @param {Object} kwargs Additional request parameters
9
+ * @returns {JSON} API response data
10
+ */
11
+ Client.prototype.get_bank_statement_sets = async function (
12
+ page = 1,
13
+ page_size = 50,
14
+ {...kwargs} = {}
15
+ ) {
16
+ let endpoint_name = "/bank-statements-set/";
17
+ let query = Object.assign({
18
+ "page": page,
19
+ "page_size": page_size,
20
+ }, kwargs);
21
+ let response = await this._request("GET", endpoint_name, {}, query, false);
22
+ return response['data'];
23
+ }
@@ -17,12 +17,12 @@ Client.prototype.get_bank_statements = async function (
17
17
  {...kwargs} = {}
18
18
  ) {
19
19
  let endpoint_name = `/bank-statements/`;
20
- let request_arguments = {
20
+ let query = Object.assign({
21
21
  "page": page,
22
22
  "page_size": page_size,
23
23
  "bounding_boxes": bounding_boxes,
24
24
  "confidence_details": confidence_details
25
- };
26
- let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false);
25
+ }, kwargs);
26
+ let document = await this._request("GET", endpoint_name, {}, query, false);
27
27
  return document['data'];
28
28
  }
@@ -0,0 +1,31 @@
1
+ const Client = require('../client/constructor');
2
+ const path = require('path');
3
+ const fs = require('fs');
4
+ /**
5
+ * Process a bank statement asynchronously. https://docs.veryfi.com/api/bank-statements/process-a-bank-statement-asynchronously/
6
+ * @example
7
+ * veryfi_client.process_bank_statement_async('file/path')
8
+ *
9
+ * @memberof Client
10
+ * @param {String} file_path Path on disk to a file to submit
11
+ * @param {boolean} bounding_boxes Return bounding_box and bounding_region for extracted fields.
12
+ * @param {boolean} confidence_details Return score and ocr_score fields.
13
+ * @param {Object} kwargs Additional request parameters
14
+ * @returns {JSON} API response data
15
+ */
16
+ Client.prototype.process_bank_statement_async = async function (
17
+ file_path,
18
+ bounding_boxes = false,
19
+ confidence_details = false,
20
+ {...kwargs} = {}
21
+ ) {
22
+ let file = fs.createReadStream(file_path);
23
+ let file_name = path.basename(file_path);
24
+ return this.process_bank_statement_async_from_stream(
25
+ file,
26
+ file_name,
27
+ bounding_boxes,
28
+ confidence_details,
29
+ kwargs
30
+ );
31
+ }
@@ -0,0 +1,30 @@
1
+ const Client = require('../client/constructor');
2
+ /**
3
+ * Process a bank statement asynchronously from a base64 string. https://docs.veryfi.com/api/bank-statements/process-a-bank-statement-asynchronously/
4
+ *
5
+ * @memberof Client
6
+ * @param {String} file_name The file name including the extension
7
+ * @param {String} file_base64_string Base64-encoded file contents (raw or data URI)
8
+ * @param {boolean} bounding_boxes Return bounding_box and bounding_region for extracted fields.
9
+ * @param {boolean} confidence_details Return score and ocr_score fields.
10
+ * @param {Object} kwargs Additional request parameters
11
+ * @returns {JSON} API response data
12
+ */
13
+ Client.prototype.process_bank_statement_async_from_base64 = async function (
14
+ file_name,
15
+ file_base64_string,
16
+ bounding_boxes = false,
17
+ confidence_details = false,
18
+ {...kwargs} = {}
19
+ ) {
20
+ let endpoint_name = "/bank-statements/async/";
21
+ let request_arguments = {
22
+ "file_name": file_name,
23
+ "file_data": file_base64_string,
24
+ "bounding_boxes": bounding_boxes,
25
+ "confidence_details": confidence_details,
26
+ };
27
+ request_arguments = Object.assign(request_arguments, kwargs);
28
+ let response = await this._request("POST", endpoint_name, request_arguments, null, false);
29
+ return response['data'];
30
+ }
@@ -0,0 +1,30 @@
1
+ const Client = require('../client/constructor');
2
+ /**
3
+ * Process a bank statement asynchronously from a file stream. https://docs.veryfi.com/api/bank-statements/process-a-bank-statement-asynchronously/
4
+ *
5
+ * @memberof Client
6
+ * @param {stream.Readable} file ReadStream of a file to submit
7
+ * @param {String} file_name The file name including the extension
8
+ * @param {boolean} bounding_boxes Return bounding_box and bounding_region for extracted fields.
9
+ * @param {boolean} confidence_details Return score and ocr_score fields.
10
+ * @param {Object} kwargs Additional request parameters
11
+ * @returns {JSON} API response data
12
+ */
13
+ Client.prototype.process_bank_statement_async_from_stream = async function (
14
+ file,
15
+ file_name,
16
+ bounding_boxes = false,
17
+ confidence_details = false,
18
+ {...kwargs} = {}
19
+ ) {
20
+ let endpoint_name = "/bank-statements/async/";
21
+ let request_arguments = {
22
+ "file": file,
23
+ "file_name": file_name,
24
+ "bounding_boxes": bounding_boxes,
25
+ "confidence_details": confidence_details,
26
+ };
27
+ request_arguments = Object.assign(request_arguments, kwargs);
28
+ let response = await this._request("POST", endpoint_name, request_arguments, null, true);
29
+ return response['data'];
30
+ }
@@ -0,0 +1,30 @@
1
+ const Client = require('../client/constructor');
2
+ /**
3
+ * Process a bank statement asynchronously from a URL. https://docs.veryfi.com/api/bank-statements/process-a-bank-statement-asynchronously/
4
+ *
5
+ * @memberof Client
6
+ * @param {string|null} file_url Required if file_urls isn't specified. Publicly accessible URL to a file.
7
+ * @param {string[]} file_urls Required if file_url isn't specified. List of publicly accessible URLs.
8
+ * @param {boolean} bounding_boxes Return bounding_box and bounding_region for extracted fields.
9
+ * @param {boolean} confidence_details Return score and ocr_score fields.
10
+ * @param {Object} kwargs Additional request parameters
11
+ * @returns {JSON} API response data
12
+ */
13
+ Client.prototype.process_bank_statement_async_from_url = async function (
14
+ file_url = null,
15
+ file_urls = null,
16
+ bounding_boxes = false,
17
+ confidence_details = false,
18
+ {...kwargs} = {}
19
+ ) {
20
+ let endpoint_name = "/bank-statements/async/";
21
+ let request_arguments = {
22
+ "file_url": file_url,
23
+ "file_urls": file_urls,
24
+ "bounding_boxes": bounding_boxes,
25
+ "confidence_details": confidence_details,
26
+ };
27
+ request_arguments = Object.assign(request_arguments, kwargs);
28
+ let response = await this._request("POST", endpoint_name, request_arguments, null, false);
29
+ return response['data'];
30
+ }
@@ -0,0 +1,25 @@
1
+ const Client = require('../client/constructor');
2
+ const path = require('path');
3
+ const fs = require('fs');
4
+ /**
5
+ * Split and process multiple bank statements. https://docs.veryfi.com/api/split-and-process-multiple-bank-statements/
6
+ * @example
7
+ * veryfi_client.split_bank_statements('file/path')
8
+ *
9
+ * @memberof Client
10
+ * @param {String} file_path Path on disk to a file to submit
11
+ * @param {Object} kwargs Additional request parameters
12
+ * @returns {JSON} API response data
13
+ */
14
+ Client.prototype.split_bank_statements = async function (
15
+ file_path,
16
+ {...kwargs} = {}
17
+ ) {
18
+ let file = fs.createReadStream(file_path);
19
+ let file_name = path.basename(file_path);
20
+ return this.split_bank_statements_from_stream(
21
+ file,
22
+ file_name,
23
+ kwargs
24
+ );
25
+ }
@@ -0,0 +1,24 @@
1
+ const Client = require('../client/constructor');
2
+ /**
3
+ * Split and process multiple bank statements from a base64 string. https://docs.veryfi.com/api/split-and-process-multiple-bank-statements/
4
+ *
5
+ * @memberof Client
6
+ * @param {String} file_name The file name including the extension
7
+ * @param {String} file_base64_string Base64-encoded file contents (raw or data URI)
8
+ * @param {Object} kwargs Additional request parameters
9
+ * @returns {JSON} API response data
10
+ */
11
+ Client.prototype.split_bank_statements_from_base64 = async function (
12
+ file_name,
13
+ file_base64_string,
14
+ {...kwargs} = {}
15
+ ) {
16
+ let endpoint_name = "/bank-statements-set/";
17
+ let request_arguments = {
18
+ "file_name": file_name,
19
+ "file_data": file_base64_string,
20
+ };
21
+ request_arguments = Object.assign(request_arguments, kwargs);
22
+ let response = await this._request("POST", endpoint_name, request_arguments, null, false);
23
+ return response['data'];
24
+ }
@@ -0,0 +1,24 @@
1
+ const Client = require('../client/constructor');
2
+ /**
3
+ * Split and process multiple bank statements from a file stream. https://docs.veryfi.com/api/split-and-process-multiple-bank-statements/
4
+ *
5
+ * @memberof Client
6
+ * @param {stream.Readable} file ReadStream of a file to submit
7
+ * @param {String} file_name The file name including the extension
8
+ * @param {Object} kwargs Additional request parameters
9
+ * @returns {JSON} API response data
10
+ */
11
+ Client.prototype.split_bank_statements_from_stream = async function (
12
+ file,
13
+ file_name,
14
+ {...kwargs} = {}
15
+ ) {
16
+ let endpoint_name = "/bank-statements-set/";
17
+ let request_arguments = {
18
+ "file": file,
19
+ "file_name": file_name,
20
+ };
21
+ request_arguments = Object.assign(request_arguments, kwargs);
22
+ let response = await this._request("POST", endpoint_name, request_arguments, null, true);
23
+ return response['data'];
24
+ }
@@ -0,0 +1,24 @@
1
+ const Client = require('../client/constructor');
2
+ /**
3
+ * Split and process multiple bank statements from a URL. https://docs.veryfi.com/api/split-and-process-multiple-bank-statements/
4
+ *
5
+ * @memberof Client
6
+ * @param {string|null} file_url Required if file_urls isn't specified. Publicly accessible URL to a file.
7
+ * @param {string[]} file_urls Required if file_url isn't specified. List of publicly accessible URLs.
8
+ * @param {Object} kwargs Additional request parameters
9
+ * @returns {JSON} API response data
10
+ */
11
+ Client.prototype.split_bank_statements_from_url = async function (
12
+ file_url = null,
13
+ file_urls = null,
14
+ {...kwargs} = {}
15
+ ) {
16
+ let endpoint_name = "/bank-statements-set/";
17
+ let request_arguments = {
18
+ "file_url": file_url,
19
+ "file_urls": file_urls,
20
+ };
21
+ request_arguments = Object.assign(request_arguments, kwargs);
22
+ let response = await this._request("POST", endpoint_name, request_arguments, null, false);
23
+ return response['data'];
24
+ }
@@ -0,0 +1,15 @@
1
+ const Client = require('../../client/constructor');
2
+ /**
3
+ * Add a tag to a bank statement. https://docs.veryfi.com/api/bank-statements/add-a-tag-to-a-bank-statement/
4
+ *
5
+ * @memberof Client
6
+ * @param {string} document_id ID of the document
7
+ * @param {string} tag Tag name to add
8
+ * @returns {JSON} Tag response
9
+ */
10
+ Client.prototype.add_bank_statement_tag = async function (document_id, tag) {
11
+ let endpoint_name = `/bank-statements/${document_id}/tags/`;
12
+ let request_arguments = {"name": tag};
13
+ let response = await this._request("PUT", endpoint_name, request_arguments);
14
+ return response['data'];
15
+ }
@@ -0,0 +1,15 @@
1
+ const Client = require('../../client/constructor');
2
+ /**
3
+ * Add tags to a bank statement. https://docs.veryfi.com/api/bank-statements/add-tags-to-a-bank-statement/
4
+ *
5
+ * @memberof Client
6
+ * @param {string} document_id ID of the document
7
+ * @param {string[]} tags Tag names to add
8
+ * @returns {JSON} Tags response
9
+ */
10
+ Client.prototype.add_bank_statement_tags = async function (document_id, tags) {
11
+ let endpoint_name = `/bank-statements/${document_id}/tags/`;
12
+ let request_arguments = {"tags": tags};
13
+ let response = await this._request("POST", endpoint_name, request_arguments);
14
+ return response['data'];
15
+ }