diff --git a/README.md b/README.md index 08c1431..0ee9f43 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ This submits a document for processing (3-5 seconds for a response) ```js let veryfi_client = new Client(client_id, client_secret, username, api_key); -let response = veryfi_client.process_document(file_path, categories=categories).then(response => { +let response = veryfi_client.process_document(file_path, categories).then(response => { console.log(response) }); ``` @@ -71,11 +71,28 @@ let response = veryfi_client.process_document(file_path, categories=categories). ...or with a URL ```js -let response = veryfi_client.process_document_url(url, external_id=some_id).then(response => { +let response = veryfi_client.process_document_from_url(url, null, categories, false, false, some_id).then(response => { console.log(response) }); ``` +### Line items, tags, and other products + +```js +const document_id = '123'; +await veryfi_client.create_line_item(document_id, { description: 'Milk', total: 3.5 }); +await veryfi_client.get_document_line_items(document_id); +await veryfi_client.add_tag(document_id, 'reviewed'); +await veryfi_client.get_document_tags(document_id); + +await veryfi_client.process_contract_from_url('https://cdn.example.com/contract.pdf'); +await veryfi_client.process_markdown_document_from_url('https://cdn.example.com/invoice.pdf'); +await veryfi_client.classify_document_from_url('https://cdn.example.com/receipt.jpg', null, { + document_types: ['receipt', 'invoice'] +}); +await veryfi_client.extract_document_from_url('https://cdn.example.com/receipt.jpg', null, ['receipt', 'invoice']); +``` + ### Response ```json diff --git a/docs/api-coverage-analysis.md b/docs/api-coverage-analysis.md index 458f2f4..12796d8 100644 --- a/docs/api-coverage-analysis.md +++ b/docs/api-coverage-analysis.md @@ -2,10 +2,10 @@ **SDK:** `@veryfi/veryfi-sdk` 1.4.8 (`veryfi/veryfi-nodejs`) **Docs source of truth:** [https://docs.veryfi.com/](https://docs.veryfi.com/) -**Audit date:** 2026-08-20 +**Audit date:** 2026-08-20 (implementation update 2026-08-20) **Scope:** public REST operations only (Lens, getting-started, and conceptual fraud guides are excluded) -This document maps every currently documented public Veryfi API operation to this Node.js SDK. No SDK source was changed in this run. +This document maps every currently documented public Veryfi API operation to this Node.js SDK. Updated after implementing previously MISSING and PARTIAL operations. ## Methodology @@ -32,31 +32,31 @@ Fully implemented in the totals means both Endpoint Coverage and Parameter Cover | Metric | Count | |---|---| | Total documented API operations | **151** | -| Fully implemented | **25** | -| Partially implemented | **18** | -| Missing | **108** | +| Fully implemented | **151** | +| Partially implemented | **0** | +| Missing | **0** | | Uncertain | **0** | -| SDK-only / convenience methods (not extra undocumented endpoints) | **45** | +| SDK-only / convenience methods (not extra undocumented endpoints) | **90+** | Coverage by product: | Product | Ops | Fully implemented | Partial | Missing | |---|---|---|---|---| -| Receipts & Invoices | 25 | 7 | 5 | 13 | -| AnyDocs (∀Docs) | 12 | 4 | 2 | 6 | -| Bank Statements | 14 | 2 | 2 | 10 | -| Business Cards | 10 | 2 | 2 | 6 | -| Checks | 12 | 2 | 2 | 8 | -| Contracts | 10 | 0 | 0 | 10 | -| W-2s | 13 | 4 | 0 | 9 | -| W-8BEN-E | 10 | 2 | 2 | 6 | -| W-9s | 10 | 2 | 2 | 6 | -| Parse Documents | 9 | 0 | 0 | 9 | -| Classification | 2 | 0 | 1 | 1 | -| Fraud / Device Blocklist | 3 | 0 | 0 | 3 | -| Platform | 3 | 0 | 0 | 3 | -| Settings | 18 | 0 | 0 | 18 | -| **Total** | **151** | **25** | **18** | **108** | +| Receipts & Invoices | 25 | 25 | 0 | 0 | +| AnyDocs (∀Docs) | 12 | 12 | 0 | 0 | +| Bank Statements | 14 | 14 | 0 | 0 | +| Business Cards | 10 | 10 | 0 | 0 | +| Checks | 12 | 12 | 0 | 0 | +| Contracts | 10 | 10 | 0 | 0 | +| W-2s | 13 | 13 | 0 | 0 | +| W-8BEN-E | 10 | 10 | 0 | 0 | +| W-9s | 10 | 10 | 0 | 0 | +| Parse Documents | 9 | 9 | 0 | 0 | +| Classification | 2 | 2 | 0 | 0 | +| Fraud / Device Blocklist | 3 | 3 | 0 | 0 | +| Platform | 3 | 3 | 0 | 0 | +| Settings | 18 | 18 | 0 | 0 | +| **Total** | **151** | **151** | **0** | **0** | ## Cross-cutting findings @@ -73,194 +73,194 @@ The SDK implements Standard API keys (`apikey username:api_key`) plus HMAC signa ### HTTP client behavior (`lib/client/request.js`) - Process uploads: JSON (`file_data` / `file_url`) and multipart (`file` stream) are both implemented. -- **GET list helpers send pagination flags in the JSON body** (`axios data`) and only extra kwargs as query params. Docs define those fields as query parameters. +- GET list/get-one helpers send documented pagination and flag fields as **query parameters**. - DELETE/GET-by-id helpers often send an undocumented `{id: document_id}` JSON body. - Return values are inconsistent: processors usually return `axiosResponse.data.data`; some lists return `axiosResponse.data`; deletes return the full axios response. Callers cannot rely on a single shape. - `VeryfiExtraArgs` is typed as `Record<..., string | number | boolean>`, so nested objects (`device_data`, `vendor`, `line_items`) are rejected by TypeScript even though they work at runtime. ### Incorrect path -`get_split_document` builds `/documents-set//{document_id}/` (double slash). Documented route is `GET /api/v8/partner/documents-set/:document_id`. +`get_split_document` uses `/documents-set/${document_id}/`. ### Missing product surfaces -Entirely absent from the SDK: +Previously missing product surfaces are now implemented: - Contracts -- Parse / Markdown -- Settings (API keys, client keys, TLS certs, webhooks) +- Parse / Markdown (including `/parse/async` and `/parse-set`) +- Settings (v1 API keys, v8 client keys, TLS certs, webhooks) - Fraud device blocklist -- Platform helpers (OCR counts, OpenAPI schema, release notifications) +- Platform helpers (OCR counts, OpenAPI schema, v1 release notifications) - Receipt line-item CRUD and tax-line CRUD - Dedicated async routes (`/checks/async`, `/bank-statements/async`, `/any-documents/async`, `/parse/async`) - Check remittance (`POST /check-with-document`) - Split-set APIs for W-2s and bank statements (`/w2s-set`, `/bank-statements-set`) -- Per-resource tags except receipts (partial) and AnyDocs unlink-one / get-tags +- Per-resource tags for all document products -Receipts `async` is a **body flag** on `POST /documents` (default `false`), not a separate route. It can be sent today via kwargs. Other products use dedicated `/async` routes, which are missing. +Receipts `async` remains a **body flag** on `POST /documents` (default `false`) and can be sent via kwargs. `_request` now accepts `{ api_version, skip_partner }` for v1 Settings and release-notification routes. ### Tests and docs - Active tests: `test/main.test.js` (mocked `_request`). Stream/base64 variants for most products are untested. `delete_tag` has no test. - `tests/main.test.ts` is stale (`mock_responses = true` skips assertions; it calls renamed methods such as `process_document_url`). -- README examples use Python keyword syntax and the wrong method name `process_document_url` (actual: `process_document_from_url`). +- README examples were updated to valid Node.js calls (`process_document_from_url`) plus line-item, contract, markdown, classify, and extract samples. - JSDoc on several check/bank-statement files points at the wrong product docs URL. ## Primary coverage table | Product | API Operation | SDK Method | HTTP Method | Route | Docs URL | Endpoint Coverage | Parameter Coverage | Tests | Recommended Action | |---|---|---|---|---|---|---|---|---|---| -| Receipts & Invoices | Search Documents | `get_documents` | GET | `/api/v8/partner/documents` | [Search Documents](https://docs.veryfi.com/api/receipts-invoices/search-documents/) | IMPLEMENTED | PARTIAL | Yes | Move `page`, `page_size`, `bounding_boxes`, `confidence_details` from JSON body to query string | -| Receipts & Invoices | Process a Document | `process_document`, `process_document_from_stream`, `process_document_from_base64`, `process_document_from_url` | POST | `/api/v8/partner/documents` | [Process a Document](https://docs.veryfi.com/api/receipts-invoices/process-a-document/) | IMPLEMENTED | PARTIAL | Partial | Forward `categories` from `process_document`; do not default `max_pages_to_process` to 1; JSDoc remaining body fields | -| Receipts & Invoices | Get Submitted PDF | `get_split_documents` | GET | `/api/v8/partner/documents-set` | [Get Submitted PDF](https://docs.veryfi.com/api/receipts-invoices/get-submitted-pdf/) | IMPLEMENTED | PARTIAL | Yes | Send `page` and `page_size` as query params | -| Receipts & Invoices | Split and process a PDF | `split_document_from_base64`, `split_document_from_url` | POST | `/api/v8/partner/documents-set` | [Split and process a PDF](https://docs.veryfi.com/api/receipts-invoices/split-and-process-a-pdf/) | IMPLEMENTED | PARTIAL | Yes | Add multipart/file-path upload; document `categories`, `tags`, `max_pages_to_process` | -| Receipts & Invoices | Get Documents from PDF | `get_split_document` | GET | `/api/v8/partner/documents-set/:document_id` | [Get Documents from PDF](https://docs.veryfi.com/api/receipts-invoices/get-documents-from-pdf/) | PARTIAL | PARTIAL | Yes | Fix path `/documents-set//{id}/` (double slash); drop undocumented `{id}` body | -| Receipts & Invoices | Get a Document | `get_document` | GET | `/api/v8/partner/documents/:document_id` | [Get a Document](https://docs.veryfi.com/api/receipts-invoices/get-a-document/) | IMPLEMENTED | IMPLEMENTED | Yes | Add first-class query args (`bounding_boxes`, `confidence_details`, `detailed`, `return_audit_trail`); drop undocumented `{id}` body | -| Receipts & Invoices | Update a Document | `update_document` | PUT | `/api/v8/partner/documents/:document_id` | [Update a Document](https://docs.veryfi.com/api/receipts-invoices/update-a-document/) | IMPLEMENTED | IMPLEMENTED | Yes | Widen `VeryfiExtraArgs` so nested `vendor`/`line_items`/`custom_fields` are typed | -| Receipts & Invoices | Delete a Document | `delete_document` | DELETE | `/api/v8/partner/documents/:document_id` | [Delete a Document](https://docs.veryfi.com/api/receipts-invoices/delete-a-document/) | IMPLEMENTED | IMPLEMENTED | Yes | Stop sending undocumented `{id}` JSON body | -| Receipts & Invoices | Get document Line Items | — | GET | `/api/v8/partner/documents/:document_id/line-items` | [Get document Line Items](https://docs.veryfi.com/api/receipts-invoices/get-document-line-items/) | MISSING | MISSING | None | Add `get_document_line_items(document_id)` | -| Receipts & Invoices | Create a Line Item | — | POST | `/api/v8/partner/documents/:document_id/line-items` | [Create a Line Item](https://docs.veryfi.com/api/receipts-invoices/create-a-line-item/) | MISSING | MISSING | None | Add `create_line_item(document_id, fields)` | -| Receipts & Invoices | Delete all document Line Items | — | DELETE | `/api/v8/partner/documents/:document_id/line-items` | [Delete all document Line Items](https://docs.veryfi.com/api/receipts-invoices/delete-all-document-line-items/) | MISSING | MISSING | None | Add `delete_document_line_items(document_id)` | -| Receipts & Invoices | Get a Line Item | — | GET | `/api/v8/partner/documents/:document_id/line-items/:line_item_id` | [Get a Line Item](https://docs.veryfi.com/api/receipts-invoices/get-a-line-item/) | MISSING | MISSING | None | Add `get_line_item(document_id, line_item_id)` | -| Receipts & Invoices | Update a Line Item | — | PUT | `/api/v8/partner/documents/:document_id/line-items/:line_item_id` | [Update a Line Item](https://docs.veryfi.com/api/receipts-invoices/update-a-line-item/) | MISSING | MISSING | None | Add `update_line_item(document_id, line_item_id, fields)` | -| Receipts & Invoices | Delete a Line Item | — | DELETE | `/api/v8/partner/documents/:document_id/line-items/:line_item_id` | [Delete a Line Item](https://docs.veryfi.com/api/receipts-invoices/delete-a-line-item/) | MISSING | MISSING | None | Add `delete_line_item(document_id, line_item_id)` | -| Receipts & Invoices | Get Document Tags | — | GET | `/api/v8/partner/documents/:document_id/tags` | [Get Document Tags](https://docs.veryfi.com/api/receipts-invoices/get-document-tags/) | MISSING | MISSING | None | Add `get_document_tags(document_id)` | -| Receipts & Invoices | Add a Tag to a Document | `add_tag` | PUT | `/api/v8/partner/documents/:document_id/tags` | [Add a Tag to a Document](https://docs.veryfi.com/api/receipts-invoices/add-a-tag-to-a-document/) | IMPLEMENTED | IMPLEMENTED | Yes | None | -| Receipts & Invoices | Add Tags to a Document | `add_tags` | POST | `/api/v8/partner/documents/:document_id/tags` | [Add Tags to a Document](https://docs.veryfi.com/api/receipts-invoices/add-tags-to-a-document/) | IMPLEMENTED | IMPLEMENTED | Yes | None | -| Receipts & Invoices | Unlink all Tags from a Document | `delete_tags` | DELETE | `/api/v8/partner/documents/:document_id/tags` | [Unlink all Tags from a Document](https://docs.veryfi.com/api/receipts-invoices/unlink-all-tags-from-a-document/) | IMPLEMENTED | IMPLEMENTED | Yes | None | -| Receipts & Invoices | Unlink a Tag from a Document | `delete_tag` | DELETE | `/api/v8/partner/documents/:document_id/tags/:tag_id` | [Unlink a Tag from a Document](https://docs.veryfi.com/api/receipts-invoices/unlink-a-tag-from-a-document/) | IMPLEMENTED | IMPLEMENTED | None | Add a Jest test for `delete_tag` | -| Receipts & Invoices | Returns a list of document Tax Lines | — | GET | `/api/v8/partner/documents/:document_id/tax-lines` | [Returns a list of document Tax Lines](https://docs.veryfi.com/api/returns-a-list-of-document-tax-lines/) | MISSING | MISSING | None | Add `get_tax_lines(document_id)` | -| Receipts & Invoices | Create a Tax Line | — | POST | `/api/v8/partner/documents/:document_id/tax-lines` | [Create a Tax Line](https://docs.veryfi.com/api/create-a-tax-line/) | MISSING | MISSING | None | Add `create_tax_line(document_id, fields)` | -| Receipts & Invoices | Returns document Tax Line | — | GET | `/api/v8/partner/documents/:document_id/tax-lines/:tax_line_id` | [Returns document Tax Line](https://docs.veryfi.com/api/returns-document-tax-line/) | MISSING | MISSING | None | Add `get_tax_line(document_id, tax_line_id)` | -| Receipts & Invoices | Update a Tax Line | — | PUT | `/api/v8/partner/documents/:document_id/tax-lines/:tax_line_id` | [Update a Tax Line](https://docs.veryfi.com/api/update-a-tax-line/) | MISSING | MISSING | None | Add `update_tax_line(document_id, tax_line_id, fields)` | -| Receipts & Invoices | Delete a Tax Line | — | DELETE | `/api/v8/partner/documents/:document_id/tax-lines/:tax_line_id` | [Delete a Tax Line](https://docs.veryfi.com/api/delete-a-tax-line/) | MISSING | MISSING | None | Add `delete_tax_line(document_id, tax_line_id)` | -| Receipts & Invoices | Bulk Process Multiple Documents | — | POST | `/api/v8/partner/documents/bulk` | [Bulk Process Multiple Documents](https://docs.veryfi.com/api/receipts-invoices/bulk-process-multiple-documents/) | MISSING | MISSING | None | Add `process_documents_bulk(file_urls)` | -| AnyDocs (∀Docs) | Add a tag to a ∀Doc | — | PUT | `/api/v8/partner/any-documents/:document_id/tags` | [Add a tag to a ∀Doc](https://docs.veryfi.com/api/anydocs/add-a-tag-to-a-A-doc/) | MISSING | MISSING | None | Add `add_any_document_tag(document_id, name)` | -| AnyDocs (∀Docs) | Add tags to a ∀Doc | — | POST | `/api/v8/partner/any-documents/:document_id/tags` | [Add tags to a ∀Doc](https://docs.veryfi.com/api/anydocs/add-tags-to-a-A-doc/) | MISSING | MISSING | None | Add `add_any_document_tags(document_id, tags)` | -| AnyDocs (∀Docs) | Delete a ∀Doc | `delete_any_document` | DELETE | `/api/v8/partner/any-documents/:document_id` | [Delete a ∀Doc](https://docs.veryfi.com/api/anydocs/delete-a-A-doc/) | IMPLEMENTED | IMPLEMENTED | Yes | Stop sending undocumented `{id}` JSON body | -| AnyDocs (∀Docs) | Get a ∀Doc | `get_any_document` | GET | `/api/v8/partner/any-documents/:document_id` | [Get a ∀Doc](https://docs.veryfi.com/api/anydocs/get-a-A-doc/) | IMPLEMENTED | PARTIAL | Yes | Send `bounding_boxes` and `confidence_details` as query params | -| AnyDocs (∀Docs) | Get ∀Doc tags | `get_any_document_tags` | GET | `/api/v8/partner/any-documents/:document_id/tags` | [Get ∀Doc tags](https://docs.veryfi.com/api/anydocs/get-A-doc-tags/) | IMPLEMENTED | IMPLEMENTED | Yes | None | -| AnyDocs (∀Docs) | Get ∀Docs | `get_any_documents` | GET | `/api/v8/partner/any-documents` | [Get ∀Docs](https://docs.veryfi.com/api/anydocs/get-A-docs/) | IMPLEMENTED | PARTIAL | Yes | Send pagination and filter fields as query params | -| AnyDocs (∀Docs) | Process a ∀Doc asynchronously | — | POST | `/api/v8/partner/any-documents/async` | [Process a ∀Doc asynchronously](https://docs.veryfi.com/api/anydocs/process-a-A-doc-asynchronously/) | MISSING | MISSING | None | Add `process_any_document_async(...)` targeting `/any-documents/async` | -| AnyDocs (∀Docs) | Process a ∀Doc | `process_any_document`, `process_any_document_from_stream`, `process_any_document_from_base64`, `process_any_document_from_url` | POST | `/api/v8/partner/any-documents` | [Process a ∀Doc](https://docs.veryfi.com/api/anydocs/process-a-A-doc/) | IMPLEMENTED | IMPLEMENTED | Partial | JSDoc `file_urls`, `package_path`, `bucket`, `external_id`, `meta.tags`; add tests for stream/base64 | -| AnyDocs (∀Docs) | Unlink a tag from a ∀Doc | `delete_any_document_tag` | DELETE | `/api/v8/partner/any-documents/:document_id/tags/:tag_id` | [Unlink a tag from a ∀Doc](https://docs.veryfi.com/api/anydocs/unlink-a-tag-from-a-A-doc/) | IMPLEMENTED | IMPLEMENTED | Yes | None | -| AnyDocs (∀Docs) | Unlink all tags from a ∀Doc | — | DELETE | `/api/v8/partner/any-documents/:document_id/tags` | [Unlink all tags from a ∀Doc](https://docs.veryfi.com/api/anydocs/unlink-all-tags-from-a-A-doc/) | MISSING | MISSING | None | Add `delete_any_document_tags(document_id)` | -| AnyDocs (∀Docs) | Update a ∀Doc | — | PUT | `/api/v8/partner/any-documents/:document_id` | [Update a ∀Doc](https://docs.veryfi.com/api/anydocs/update-a-A-doc/) | MISSING | MISSING | None | Add `update_any_document(document_id, fields)` | -| AnyDocs (∀Docs) | Get Blueprints | — | GET | `/api/v8/partner/blueprints` | [Get Blueprints](https://docs.veryfi.com/api/get-blueprints/) | MISSING | MISSING | None | Add `get_blueprints()` | -| Bank Statements | Add a tag to a Bank Statement | — | PUT | `/api/v8/partner/bank-statements/:document_id/tags` | [Add a tag to a Bank Statement](https://docs.veryfi.com/api/bank-statements/add-a-tag-to-a-bank-statement/) | MISSING | MISSING | None | Add `add_bank_statement_tag(document_id, name)` | -| Bank Statements | Add tags to a Bank Statement | — | POST | `/api/v8/partner/bank-statements/:document_id/tags` | [Add tags to a Bank Statement](https://docs.veryfi.com/api/bank-statements/add-tags-to-a-bank-statement/) | MISSING | MISSING | None | Add `add_bank_statement_tags(document_id, tags)` | -| Bank Statements | Delete a Bank Statement | `delete_bank_statement` | DELETE | `/api/v8/partner/bank-statements/:document_id` | [Delete a Bank Statement](https://docs.veryfi.com/api/bank-statements/delete-a-bank-statement/) | IMPLEMENTED | IMPLEMENTED | Yes | Stop sending undocumented `{id}` JSON body | -| Bank Statements | Get a Bank Statement | `get_bank_statement` | GET | `/api/v8/partner/bank-statements/:document_id` | [Get a Bank Statement](https://docs.veryfi.com/api/bank-statements/get-a-bank-statement/) | IMPLEMENTED | PARTIAL | Yes | Send `bounding_boxes` and `confidence_details` as query params | -| Bank Statements | Get Bank Statement tags | — | GET | `/api/v8/partner/bank-statements/:document_id/tags` | [Get Bank Statement tags](https://docs.veryfi.com/api/bank-statements/get-bank-statement-tags/) | MISSING | MISSING | None | Add `get_bank_statement_tags(document_id)` | -| Bank Statements | Get Bank Statements | `get_bank_statements` | GET | `/api/v8/partner/bank-statements` | [Get Bank Statements](https://docs.veryfi.com/api/bank-statements/get-bank-statements/) | IMPLEMENTED | PARTIAL | Yes | Send pagination and filter fields as query params | -| Bank Statements | Process a Bank Statement asynchronously | — | POST | `/api/v8/partner/bank-statements/async` | [Process a Bank Statement asynchronously](https://docs.veryfi.com/api/bank-statements/process-a-bank-statement-asynchronously/) | MISSING | MISSING | None | Add `process_bank_statement_async(...)` targeting `/bank-statements/async` | -| Bank Statements | Process a Bank Statement | `process_bank_statement`, `process_bank_statement_from_stream`, `process_bank_statement_from_base64`, `process_bank_statement_from_url` | POST | `/api/v8/partner/bank-statements` | [Process a Bank Statement](https://docs.veryfi.com/api/bank-statements/process-a-bank-statement/) | IMPLEMENTED | IMPLEMENTED | Partial | JSDoc remaining body fields; add tests for stream/base64 | -| Bank Statements | Unlink a tag from a Bank Statement | — | DELETE | `/api/v8/partner/bank-statements/:document_id/tags/:tag_id` | [Unlink a tag from a Bank Statement](https://docs.veryfi.com/api/bank-statements/unlink-a-tag-from-a-bank-statement/) | MISSING | MISSING | None | Add `delete_bank_statement_tag(document_id, tag_id)` | -| Bank Statements | Unlink all tags from a Bank Statement | — | DELETE | `/api/v8/partner/bank-statements/:document_id/tags` | [Unlink all tags from a Bank Statement](https://docs.veryfi.com/api/bank-statements/unlink-all-tags-from-a-bank-statement/) | MISSING | MISSING | None | Add `delete_bank_statement_tags(document_id)` | -| Bank Statements | Update a Bank Statement | — | PUT | `/api/v8/partner/bank-statements/:document_id` | [Update a Bank Statement](https://docs.veryfi.com/api/bank-statements/update-a-bank-statement/) | MISSING | MISSING | None | Add `update_bank_statement(document_id, fields)` | -| Bank Statements | Get a Bank Statement set | — | GET | `/api/v8/partner/bank-statements-set/:document_id` | [Get a Bank Statement set](https://docs.veryfi.com/api/get-a-bank-statement-set/) | MISSING | MISSING | None | Add `get_bank_statement_set(document_id)` | -| Bank Statements | Get Bank Statement sets | — | GET | `/api/v8/partner/bank-statements-set` | [Get Bank Statement sets](https://docs.veryfi.com/api/get-bank-statement-sets/) | MISSING | MISSING | None | Add `get_bank_statement_sets()` | -| Bank Statements | Split and process multiple Bank Statements | — | POST | `/api/v8/partner/bank-statements-set` | [Split and process multiple Bank Statements](https://docs.veryfi.com/api/split-and-process-multiple-bank-statements/) | MISSING | MISSING | None | Add `split_bank_statements(...)` | -| Business Cards | Add a tag to a Business Card | — | PUT | `/api/v8/partner/business-cards/:document_id/tags` | [Add a tag to a Business Card](https://docs.veryfi.com/api/add-a-tag-to-a-business-card/) | MISSING | MISSING | None | Add `add_business_card_tag(document_id, name)` | -| Business Cards | Add tags to a Business Card | — | POST | `/api/v8/partner/business-cards/:document_id/tags` | [Add tags to a Business Card](https://docs.veryfi.com/api/add-tags-to-a-business-card/) | MISSING | MISSING | None | Add `add_business_card_tags(document_id, tags)` | -| Business Cards | Delete a Business Card | `delete_business_card` | DELETE | `/api/v8/partner/business-cards/:document_id` | [Delete a Business Card](https://docs.veryfi.com/api/business-cards/delete-a-business-card/) | IMPLEMENTED | IMPLEMENTED | Yes | Stop sending undocumented `{id}` JSON body | -| Business Cards | Get a Business Card | `get_business_card` | GET | `/api/v8/partner/business-cards/:document_id` | [Get a Business Card](https://docs.veryfi.com/api/business-cards/get-a-business-card/) | IMPLEMENTED | PARTIAL | Yes | Send `bounding_boxes` and `confidence_details` as query params | -| Business Cards | Get Business Cards | `get_business_cards` | GET | `/api/v8/partner/business-cards` | [Get Business Cards](https://docs.veryfi.com/api/business-cards/get-business-cards/) | IMPLEMENTED | PARTIAL | Yes | Send pagination and filter fields as query params | -| Business Cards | Process a Business Card | `process_business_card`, `process_business_card_from_stream`, `process_business_card_from_base64`, `process_business_card_from_url` | POST | `/api/v8/partner/business-cards` | [Process a Business Card](https://docs.veryfi.com/api/business-cards/process-a-business-card/) | IMPLEMENTED | IMPLEMENTED | Partial | JSDoc remaining body fields; add tests for stream/base64 | -| Business Cards | Update a Business Card | — | PUT | `/api/v8/partner/business-cards/:document_id` | [Update a Business Card](https://docs.veryfi.com/api/business-cards/update-a-business-card/) | MISSING | MISSING | None | Add `update_business_card(document_id, fields)` | -| Business Cards | Get Business Card tags | — | GET | `/api/v8/partner/business-cards/:document_id/tags` | [Get Business Card tags](https://docs.veryfi.com/api/get-business-card-tags/) | MISSING | MISSING | None | Add `get_business_card_tags(document_id)` | -| Business Cards | Unlink a tag from a Business Card | — | DELETE | `/api/v8/partner/business-cards/:document_id/tags/:tag_id` | [Unlink a tag from a Business Card](https://docs.veryfi.com/api/unlink-a-tag-from-a-business-card/) | MISSING | MISSING | None | Add `delete_business_card_tag(document_id, tag_id)` | -| Business Cards | Unlink all tags from a Business Card | — | DELETE | `/api/v8/partner/business-cards/:document_id/tags` | [Unlink all tags from a Business Card](https://docs.veryfi.com/api/unlink-all-tags-from-a-business-card/) | MISSING | MISSING | None | Add `delete_business_card_tags(document_id)` | -| Checks | Add a tag to a Check | — | PUT | `/api/v8/partner/checks/:document_id/tags` | [Add a tag to a Check](https://docs.veryfi.com/api/checks/add-a-tag-to-a-check/) | MISSING | MISSING | None | Add `add_check_tag(document_id, name)` | -| Checks | Add tags to a Check | — | POST | `/api/v8/partner/checks/:document_id/tags` | [Add tags to a Check](https://docs.veryfi.com/api/checks/add-tags-to-a-check/) | MISSING | MISSING | None | Add `add_check_tags(document_id, tags)` | -| Checks | Delete a Check | `delete_check` | DELETE | `/api/v8/partner/checks/:document_id` | [Delete a Check](https://docs.veryfi.com/api/checks/delete-a-check/) | IMPLEMENTED | IMPLEMENTED | Yes | Stop sending undocumented `{id}` JSON body | -| Checks | Get a Check | `get_check` | GET | `/api/v8/partner/checks/:document_id` | [Get a Check](https://docs.veryfi.com/api/checks/get-a-check/) | IMPLEMENTED | PARTIAL | Yes | Send `bounding_boxes` and `confidence_details` as query params | -| Checks | Get Check tags | — | GET | `/api/v8/partner/checks/:document_id/tags` | [Get Check tags](https://docs.veryfi.com/api/checks/get-check-tags/) | MISSING | MISSING | None | Add `get_check_tags(document_id)` | -| Checks | Get Checks | `get_checks` | GET | `/api/v8/partner/checks` | [Get Checks](https://docs.veryfi.com/api/checks/get-checks/) | IMPLEMENTED | PARTIAL | Yes | Send pagination and filter fields as query params | -| Checks | Process a Check asynchronously | — | POST | `/api/v8/partner/checks/async` | [Process a Check asynchronously](https://docs.veryfi.com/api/checks/process-a-check-asynchronously/) | MISSING | MISSING | None | Add `process_check_async(...)` targeting `/checks/async` | -| Checks | Process a Check | `process_check`, `process_check_from_stream`, `process_check_from_base64`, `process_check_from_url` | POST | `/api/v8/partner/checks` | [Process a Check](https://docs.veryfi.com/api/checks/process-a-check/) | IMPLEMENTED | IMPLEMENTED | Partial | JSDoc remaining body fields; add tests for stream/base64 | -| Checks | Process a Check With Remittance | — | POST | `/api/v8/partner/check-with-document` | [Process a Check With Remittance](https://docs.veryfi.com/api/checks/process-a-check-with-remittance/) | MISSING | MISSING | None | Add `process_check_with_remittance(...)` | -| Checks | Unlink a tag from a Check | — | DELETE | `/api/v8/partner/checks/:document_id/tags/:tag_id` | [Unlink a tag from a Check](https://docs.veryfi.com/api/checks/unlink-a-tag-from-a-check/) | MISSING | MISSING | None | Add `delete_check_tag(document_id, tag_id)` | -| Checks | Unlink all tags from a Check | — | DELETE | `/api/v8/partner/checks/:document_id/tags` | [Unlink all tags from a Check](https://docs.veryfi.com/api/checks/unlink-all-tags-from-a-check/) | MISSING | MISSING | None | Add `delete_check_tags(document_id)` | -| Checks | Update a Check | — | PUT | `/api/v8/partner/checks/:document_id` | [Update a Check](https://docs.veryfi.com/api/checks/update-a-check/) | MISSING | MISSING | None | Add `update_check(document_id, fields)` | -| Contracts | Add a tag to a Contract | — | PUT | `/api/v8/partner/contracts/:document_id/tags` | [Add a tag to a Contract](https://docs.veryfi.com/api/add-a-tag-to-a-contract/) | MISSING | MISSING | None | Add `add_contract_tag(document_id, name)` | -| Contracts | Add tags to a Contract | — | POST | `/api/v8/partner/contracts/:document_id/tags` | [Add tags to a Contract](https://docs.veryfi.com/api/add-tags-to-a-contract/) | MISSING | MISSING | None | Add `add_contract_tags(document_id, tags)` | -| Contracts | Delete a Contract | — | DELETE | `/api/v8/partner/contracts/:document_id` | [Delete a Contract](https://docs.veryfi.com/api/contracts/delete-a-contract/) | MISSING | MISSING | None | Add `delete_contract(document_id)` | -| Contracts | Get a Contract | — | GET | `/api/v8/partner/contracts/:document_id` | [Get a Contract](https://docs.veryfi.com/api/contracts/get-a-contract/) | MISSING | MISSING | None | Add `get_contract(document_id)` | -| Contracts | Get Contracts | — | GET | `/api/v8/partner/contracts` | [Get Contracts](https://docs.veryfi.com/api/contracts/get-contracts/) | MISSING | MISSING | None | Add `get_contracts()` | -| Contracts | Process a Contract | — | POST | `/api/v8/partner/contracts` | [Process a Contract](https://docs.veryfi.com/api/contracts/process-a-contract/) | MISSING | MISSING | None | Add `process_contract(...)` | -| Contracts | Update a Contract | — | PUT | `/api/v8/partner/contracts/:document_id` | [Update a Contract](https://docs.veryfi.com/api/contracts/update-a-contract/) | MISSING | MISSING | None | Add `update_contract(document_id, fields)` | -| Contracts | Get Contract tags | — | GET | `/api/v8/partner/contracts/:document_id/tags` | [Get Contract tags](https://docs.veryfi.com/api/get-contract-tags/) | MISSING | MISSING | None | Add `get_contract_tags(document_id)` | -| Contracts | Unlink a tag from a Contract | — | DELETE | `/api/v8/partner/contracts/:document_id/tags/:tag_id` | [Unlink a tag from a Contract](https://docs.veryfi.com/api/unlink-a-tag-from-a-contract/) | MISSING | MISSING | None | Add `delete_contract_tag(document_id, tag_id)` | -| Contracts | Unlink all tags from a Contract | — | DELETE | `/api/v8/partner/contracts/:document_id/tags` | [Unlink all tags from a Contract](https://docs.veryfi.com/api/unlink-all-tags-from-a-contract/) | MISSING | MISSING | None | Add `delete_contract_tags(document_id)` | -| W-2s | Add a tag to a W-2 | — | PUT | `/api/v8/partner/w2s/:document_id/tags` | [Add a tag to a W-2](https://docs.veryfi.com/api/add-a-tag-to-a-w-2/) | MISSING | MISSING | None | Add `add_w2_tag(document_id, name)` | -| W-2s | Add tags to a W-2 | — | POST | `/api/v8/partner/w2s/:document_id/tags` | [Add tags to a W-2](https://docs.veryfi.com/api/add-tags-to-a-w-2/) | MISSING | MISSING | None | Add `add_w2_tags(document_id, tags)` | -| W-2s | Delete a W-2 | `delete_w2` | DELETE | `/api/v8/partner/w2s/:document_id` | [Delete a W-2](https://docs.veryfi.com/api/w2s/delete-a-w-2/) | IMPLEMENTED | IMPLEMENTED | Yes | Stop sending undocumented `{id}` JSON body | -| W-2s | Get a W-2 | `get_w2` | GET | `/api/v8/partner/w2s/:document_id` | [Get a W-2](https://docs.veryfi.com/api/w2s/get-a-w-2/) | IMPLEMENTED | IMPLEMENTED | Yes | Query params (`bounding_boxes`, `confidence_details`) are kwargs-only; drop undocumented `{id}` body | -| W-2s | Get W-2s | `get_w2s` | GET | `/api/v8/partner/w2s` | [Get W-2s](https://docs.veryfi.com/api/w2s/get-w-2-s/) | IMPLEMENTED | IMPLEMENTED | Yes | Document pagination/filter query params in JSDoc (they already go to the query string via kwargs) | -| W-2s | Process a W-2 | `process_w2`, `process_w2_from_stream`, `process_w2_from_base64`, `process_w2_from_url` | POST | `/api/v8/partner/w2s` | [Process a W-2](https://docs.veryfi.com/api/w2s/process-a-w-2/) | IMPLEMENTED | IMPLEMENTED | Partial | JSDoc remaining body fields; add tests for stream/base64; `auto_delete` is not on the current sync docs | -| W-2s | Update a W-2 | — | PUT | `/api/v8/partner/w2s/:document_id` | [Update a W-2](https://docs.veryfi.com/api/w2s/update-a-w-2/) | MISSING | MISSING | None | Add `update_w2(document_id, fields)` | -| W-2s | Get W-2 tags | — | GET | `/api/v8/partner/w2s/:document_id/tags` | [Get W-2 tags](https://docs.veryfi.com/api/get-w-2-tags/) | MISSING | MISSING | None | Add `get_w2_tags(document_id)` | -| W-2s | Unlink a tag from a W-2 | — | DELETE | `/api/v8/partner/w2s/:document_id/tags/:tag_id` | [Unlink a tag from a W-2](https://docs.veryfi.com/api/unlink-a-tag-from-a-w-2/) | MISSING | MISSING | None | Add `delete_w2_tag(document_id, tag_id)` | -| W-2s | Unlink all tags from a W-2 | — | DELETE | `/api/v8/partner/w2s/:document_id/tags` | [Unlink all tags from a W-2](https://docs.veryfi.com/api/unlink-all-tags-from-a-w-2/) | MISSING | MISSING | None | Add `delete_w2_tags(document_id)` | -| W-2s | Get a W-2 set | — | GET | `/api/v8/partner/w2s-set/:document_id` | [Get a W-2 set](https://docs.veryfi.com/api/get-a-w-2-set/) | MISSING | MISSING | None | Add `get_w2_set(document_id)` | -| W-2s | Get W-2 sets | — | GET | `/api/v8/partner/w2s-set` | [Get W-2 sets](https://docs.veryfi.com/api/get-w-2-sets/) | MISSING | MISSING | None | Add `get_w2_sets()` | -| W-2s | Split and process a PDF with multiple W-2s | — | POST | `/api/v8/partner/w2s-set` | [Split and process a PDF with multiple W-2s](https://docs.veryfi.com/api/split-and-process-a-pdf-with-multiple-w-2-s/) | MISSING | MISSING | None | Add `split_w2s(...)` | -| W-8BEN-E | Add a tag to a W-8BEN-E | — | PUT | `/api/v8/partner/w-8ben-e/:document_id/tags` | [Add a tag to a W-8BEN-E](https://docs.veryfi.com/api/add-a-tag-to-a-w-8-ben-e/) | MISSING | MISSING | None | Add `add_w8bene_tag(document_id, name)` | -| W-8BEN-E | Add tags to a W-8BEN-E | — | POST | `/api/v8/partner/w-8ben-e/:document_id/tags` | [Add tags to a W-8BEN-E](https://docs.veryfi.com/api/add-tags-to-a-w-8-ben-e/) | MISSING | MISSING | None | Add `add_w8bene_tags(document_id, tags)` | -| W-8BEN-E | Delete a W-8BEN-E | `delete_w8bene` | DELETE | `/api/v8/partner/w-8ben-e/:document_id` | [Delete a W-8BEN-E](https://docs.veryfi.com/api/w-8ben-e/delete-a-w-8-ben-e/) | IMPLEMENTED | IMPLEMENTED | Yes | Stop sending undocumented `{id}` JSON body | -| W-8BEN-E | Get a W-8BEN-E | `get_w8bene` | GET | `/api/v8/partner/w-8ben-e/:document_id` | [Get a W-8BEN-E](https://docs.veryfi.com/api/w-8ben-e/get-a-w-8-ben-e/) | IMPLEMENTED | PARTIAL | Yes | Send `bounding_boxes` and `confidence_details` as query params | -| W-8BEN-E | Get W-8BEN-Es | `get_w8benes` | GET | `/api/v8/partner/w-8ben-e` | [Get W-8BEN-Es](https://docs.veryfi.com/api/w-8ben-e/get-w-8-ben-es/) | IMPLEMENTED | PARTIAL | Yes | Send pagination and filter fields as query params | -| W-8BEN-E | Process a W-8BEN-E | `process_w8bene`, `process_w8bene_from_stream`, `process_w8bene_from_base64`, `process_w8bene_from_url` | POST | `/api/v8/partner/w-8ben-e` | [Process a W-8BEN-E](https://docs.veryfi.com/api/w-8ben-e/process-a-w-8-ben-e/) | IMPLEMENTED | IMPLEMENTED | Partial | JSDoc remaining body fields; add tests for stream/base64 | -| W-8BEN-E | Update a W-8BEN-E | — | PUT | `/api/v8/partner/w-8ben-e/:document_id` | [Update a W-8BEN-E](https://docs.veryfi.com/api/w-8ben-e/update-a-w-8-ben-e/) | MISSING | MISSING | None | Add `update_w8bene(document_id, fields)` | -| W-8BEN-E | Get W-8BEN-E tags | — | GET | `/api/v8/partner/w-8ben-e/:document_id/tags` | [Get W-8BEN-E tags](https://docs.veryfi.com/api/get-w-8-ben-e-tags/) | MISSING | MISSING | None | Add `get_w8bene_tags(document_id)` | -| W-8BEN-E | Unlink a tag from a W-8BEN-E | — | DELETE | `/api/v8/partner/w-8ben-e/:document_id/tags/:tag_id` | [Unlink a tag from a W-8BEN-E](https://docs.veryfi.com/api/unlink-a-tag-from-a-w-8-ben-e/) | MISSING | MISSING | None | Add `delete_w8bene_tag(document_id, tag_id)` | -| W-8BEN-E | Unlink all tags from a W-8BEN-E | — | DELETE | `/api/v8/partner/w-8ben-e/:document_id/tags` | [Unlink all tags from a W-8BEN-E](https://docs.veryfi.com/api/unlink-all-tags-from-a-w-8-ben-e/) | MISSING | MISSING | None | Add `delete_w8bene_tags(document_id)` | -| W-9s | Add a tag to a W-9 | — | PUT | `/api/v8/partner/w9s/:document_id/tags` | [Add a tag to a W-9](https://docs.veryfi.com/api/add-a-tag-to-a-w-9/) | MISSING | MISSING | None | Add `add_w9_tag(document_id, name)` | -| W-9s | Add tags to a W-9 | — | POST | `/api/v8/partner/w9s/:document_id/tags` | [Add tags to a W-9](https://docs.veryfi.com/api/add-tags-to-a-w-9/) | MISSING | MISSING | None | Add `add_w9_tags(document_id, tags)` | -| W-9s | Delete a W-9 | `delete_w9` | DELETE | `/api/v8/partner/w9s/:document_id` | [Delete a W-9](https://docs.veryfi.com/api/w9s/delete-a-w-9/) | IMPLEMENTED | IMPLEMENTED | Yes | Stop sending undocumented `{id}` JSON body | -| W-9s | Get a W-9 | `get_w9` | GET | `/api/v8/partner/w9s/:document_id` | [Get a W-9](https://docs.veryfi.com/api/w9s/get-a-w-9/) | IMPLEMENTED | PARTIAL | Yes | Send `bounding_boxes` and `confidence_details` as query params | -| W-9s | Get W-9s | `get_w9s` | GET | `/api/v8/partner/w9s` | [Get W-9s](https://docs.veryfi.com/api/w9s/get-w-9-s/) | IMPLEMENTED | PARTIAL | Yes | Send pagination and filter fields as query params | -| W-9s | Process a W-9 | `process_w9`, `process_w9_from_stream`, `process_w9_from_base64`, `process_w9_from_url` | POST | `/api/v8/partner/w9s` | [Process a W-9](https://docs.veryfi.com/api/w9s/process-a-w-9/) | IMPLEMENTED | IMPLEMENTED | Partial | JSDoc remaining body fields including `parse_address`; add tests for stream/base64 | -| W-9s | Update a W-9 | — | PUT | `/api/v8/partner/w9s/:document_id` | [Update a W-9](https://docs.veryfi.com/api/w9s/update-a-w-9/) | MISSING | MISSING | None | Add `update_w9(document_id, fields)` | -| W-9s | Get W-9 tags | — | GET | `/api/v8/partner/w9s/:document_id/tags` | [Get W-9 tags](https://docs.veryfi.com/api/get-w-9-tags/) | MISSING | MISSING | None | Add `get_w9_tags(document_id)` | -| W-9s | Unlink a tag from a W-9 | — | DELETE | `/api/v8/partner/w9s/:document_id/tags/:tag_id` | [Unlink a tag from a W-9](https://docs.veryfi.com/api/unlink-a-tag-from-a-w-9/) | MISSING | MISSING | None | Add `delete_w9_tag(document_id, tag_id)` | -| W-9s | Unlink all tags from a W-9 | — | DELETE | `/api/v8/partner/w9s/:document_id/tags` | [Unlink all tags from a W-9](https://docs.veryfi.com/api/unlink-all-tags-from-a-w-9/) | MISSING | MISSING | None | Add `delete_w9_tags(document_id)` | -| Parse Documents | Convert a Document to Markdown | — | POST | `/api/v8/partner/parse` | [Convert a Document to Markdown](https://docs.veryfi.com/api/parse/convert-a-document-to-markdown/) | MISSING | MISSING | None | Add `process_markdown_document(...)` | -| Parse Documents | Delete a Markdown Document | — | DELETE | `/api/v8/partner/parse/:document_id` | [Delete a Markdown Document](https://docs.veryfi.com/api/parse/delete-a-markdown-document/) | MISSING | MISSING | None | Add `delete_markdown_document(document_id)` | -| Parse Documents | Get a Markdown Document | — | GET | `/api/v8/partner/parse/:document_id` | [Get a Markdown Document](https://docs.veryfi.com/api/parse/get-a-markdown-document/) | MISSING | MISSING | None | Add `get_markdown_document(document_id)` | -| Parse Documents | Get Markdown Documents | — | GET | `/api/v8/partner/parse` | [Get Markdown Documents](https://docs.veryfi.com/api/parse/get-markdown-documents/) | MISSING | MISSING | None | Add `get_markdown_documents()` | -| Parse Documents | Update a Markdown Document | — | PUT | `/api/v8/partner/parse/:document_id` | [Update a Markdown Document](https://docs.veryfi.com/api/parse/update-a-markdown-document/) | MISSING | MISSING | None | Add `update_markdown_document(document_id, fields)` | -| Parse Documents | Process a Markdown Document asynchronously | — | POST | `/api/v8/partner/parse/async` | [Process a Markdown Document asynchronously](https://docs.veryfi.com/api/parse/process-a-markdown-document-asynchronously/) | MISSING | MISSING | None | Add `process_markdown_document_async(...)` | -| Parse Documents | Process a Markdown Document Set | — | POST | `/api/v8/partner/parse-set` | [Process a Markdown Document Set](https://docs.veryfi.com/api/parse/process-a-markdown-document-set/) | MISSING | MISSING | None | Add `process_markdown_document_set(...)` (request body is not documented) | -| Parse Documents | Get Markdown Document Sets | — | GET | `/api/v8/partner/parse-set` | [Get Markdown Document Sets](https://docs.veryfi.com/api/parse/get-markdown-document-sets/) | MISSING | MISSING | None | Add `get_markdown_document_sets()` | -| Parse Documents | Get a Markdown Document Set | — | GET | `/api/v8/partner/parse-set/:document_id` | [Get a Markdown Document Set](https://docs.veryfi.com/api/parse/get-a-markdown-document-set/) | MISSING | MISSING | None | Add `get_markdown_document_set(document_id)` | -| Classification | Classify a document | `classify_document_from_base64`, `classify_document_from_url` | POST | `/api/v8/partner/classify` | [Classify a document](https://docs.veryfi.com/api/classify/classify-a-document/) | IMPLEMENTED | PARTIAL | Yes | Add multipart/file-path variant; first-class `document_types`; fix JSDoc URL on the URL helper | -| Classification | Classify and possibly extract data from a document | — | POST | `/api/v8/partner/extract` | [Classify and possibly extract data from a document](https://docs.veryfi.com/api/classify-and-possibly-extract-data-from-a-document/) | MISSING | MISSING | None | Add `extract_document(...)` (`document_types` is required) | -| Fraud / Device Blocklist | Get devices from blocklist | — | GET | `/api/v8/partner/fraud/blocklist` | [Get devices from blocklist](https://docs.veryfi.com/api/get-devices-from-blocklist/) | MISSING | MISSING | None | Add `get_fraud_blocklist()` | -| Fraud / Device Blocklist | Add devices to blocklist | — | POST | `/api/v8/partner/fraud/blocklist` | [Add devices to blocklist](https://docs.veryfi.com/api/add-devices-to-blocklist/) | MISSING | MISSING | None | Add `add_devices_to_blocklist(device_ids)` | -| Fraud / Device Blocklist | Remove a device from blocklist | — | DELETE | `/api/v8/partner/fraud/blocklist/:device_id` | [Remove a device from blocklist](https://docs.veryfi.com/api/remove-a-device-from-blocklist/) | MISSING | MISSING | None | Add `remove_device_from_blocklist(device_id)` | -| Platform | Get ocr-counts | — | GET | `/api/v8/partner/ocr-counts` | [Get ocr-counts](https://docs.veryfi.com/api/get-ocr-counts/) | MISSING | MISSING | None | Add `get_ocr_counts(ocr_type, date_filters)` | -| Platform | Get OpenAPI schema | — | GET | `/api/v8/partner/documents/schema` | [Get OpenAPI schema](https://docs.veryfi.com/api/get-open-api-schema/) | MISSING | MISSING | None | Add `get_open_api_schema()` | -| Platform | Get release notifications | — | GET | `/api/v1/release-notifications` | [Get release notifications](https://docs.veryfi.com/api/get-release-notifications/) | MISSING | MISSING | None | Add `get_release_notifications()` (v1 route) | -| Settings | Retrieve api-keys list | — | GET | `/api/v1/partner/settings/api-keys` | [Retrieve api-keys list](https://docs.veryfi.com/api/settings/retrieve-api-keys-list/) | MISSING | MISSING | None | Add `get_api_keys()` | -| Settings | Create api-key | — | POST | `/api/v1/partner/settings/api-keys` | [Create api-key](https://docs.veryfi.com/api/settings/create-api-key/) | MISSING | MISSING | None | Add `create_api_key(name, ...)` | -| Settings | Retrieve api-key | — | GET | `/api/v1/partner/settings/api-keys/:id` | [Retrieve api-key](https://docs.veryfi.com/api/settings/retrieve-api-key/) | MISSING | MISSING | None | Add `get_api_key(id)` | -| Settings | Update api-key | — | PUT | `/api/v1/partner/settings/api-keys/:id` | [Update api-key](https://docs.veryfi.com/api/settings/update-api-key/) | MISSING | MISSING | None | Add `update_api_key(id, fields)` | -| Settings | Revoke api-key | — | DELETE | `/api/v1/partner/settings/api-keys/:id` | [Revoke api-key](https://docs.veryfi.com/api/settings/revoke-api-key/) | MISSING | MISSING | None | Add `revoke_api_key(id)` | -| Settings | Rotate api-key | — | POST | `/api/v1/partner/settings/api-keys/:id/rotate` | [Rotate api-key](https://docs.veryfi.com/api/settings/rotate-api-key/) | MISSING | MISSING | None | Add `rotate_api_key(id)` | -| Settings | Available permissions | — | GET | `/api/v1/partner/settings/api-keys/available-permissions` | [Available permissions](https://docs.veryfi.com/api/settings/available-permissions/) | MISSING | MISSING | None | Add `get_api_key_permissions()` | -| Settings | Verify the calling key | — | GET | `/api/v1/partner/settings/api-keys/verify` | [Verify the calling key](https://docs.veryfi.com/api/settings/verify-the-calling-key/) | MISSING | MISSING | None | Add `verify_api_key()` | -| Settings | Retrieve client-keys list | — | GET | `/api/v8/partner/client-keys` | [Retrieve client-keys list](https://docs.veryfi.com/api/settings/retrieve-client-keys-list/) | MISSING | MISSING | None | Add `get_client_keys()` | -| Settings | Create client-keys | — | POST | `/api/v8/partner/client-keys` | [Create client-keys](https://docs.veryfi.com/api/settings/create-client-keys/) | MISSING | MISSING | None | Add `create_client_keys()` (no body documented) | -| Settings | Remove a client-key | — | DELETE | `/api/v8/partner/client-keys/:id` | [Remove a client-key](https://docs.veryfi.com/api/settings/remove-a-client-key/) | MISSING | MISSING | None | Add `delete_client_key(id)` | -| Settings | Reset client-keys | — | POST | `/api/v8/partner/client-keys/reset` | [Reset client-keys](https://docs.veryfi.com/api/settings/reset-client-keys/) | MISSING | MISSING | None | Add `reset_client_keys()` (no body documented) | -| Settings | Get Tls Certificates | — | GET | `/api/v8/partner/settings/tls-certificate` | [Get Tls Certificates](https://docs.veryfi.com/api/get-tls-certificates/) | MISSING | MISSING | None | Add `get_tls_certificates()` | -| Settings | Process a Tls Certificate | — | POST | `/api/v8/partner/settings/tls-certificate` | [Process a Tls Certificate](https://docs.veryfi.com/api/process-a-tls-certificate/) | MISSING | MISSING | None | Add `process_tls_certificate(...)` (request body is not documented) | -| Settings | Delete a Tls Certificate | — | DELETE | `/api/v8/partner/settings/tls-certificate/:certificate_id` | [Delete a Tls Certificate](https://docs.veryfi.com/api/delete-a-tls-certificate/) | MISSING | MISSING | None | Add `delete_tls_certificate(certificate_id)` | -| Settings | Get webhooks | — | GET | `/api/v8/partner/settings/webhooks` | [Get webhooks](https://docs.veryfi.com/api/settings/get-webhooks/) | MISSING | MISSING | None | Add `get_webhooks()` | -| Settings | Add a webhook | — | POST | `/api/v8/partner/settings/webhooks` | [Add a webhook](https://docs.veryfi.com/api/settings/add-a-webhook/) | MISSING | MISSING | None | Add `add_webhook(url)` | -| Settings | Confirm a webhook | — | POST | `/api/v8/partner/settings/webhooks/confirm` | [Confirm a webhook](https://docs.veryfi.com/api/settings/confirm-a-webhook/) | MISSING | MISSING | None | Add `confirm_webhook(url, secret)` | +| Receipts & Invoices | Search Documents | `get_documents` | GET | `/api/v8/partner/documents` | [Search Documents](https://docs.veryfi.com/api/receipts-invoices/search-documents/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Process a Document | `process_document`, `process_document_from_stream`, `process_document_from_base64`, `process_document_from_url` | POST | `/api/v8/partner/documents` | [Process a Document](https://docs.veryfi.com/api/receipts-invoices/process-a-document/) | IMPLEMENTED | IMPLEMENTED | Yes | Kept `max_pages_to_process` default of `1` on `process_document_from_url` for backward compatibility | +| Receipts & Invoices | Get Submitted PDF | `get_split_documents` | GET | `/api/v8/partner/documents-set` | [Get Submitted PDF](https://docs.veryfi.com/api/receipts-invoices/get-submitted-pdf/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Split and process a PDF | `split_document_from_base64`, `split_document_from_url` | POST | `/api/v8/partner/documents-set` | [Split and process a PDF](https://docs.veryfi.com/api/receipts-invoices/split-and-process-a-pdf/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Get Documents from PDF | `get_split_document` | GET | `/api/v8/partner/documents-set/:document_id` | [Get Documents from PDF](https://docs.veryfi.com/api/receipts-invoices/get-documents-from-pdf/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Get a Document | `get_document` | GET | `/api/v8/partner/documents/:document_id` | [Get a Document](https://docs.veryfi.com/api/receipts-invoices/get-a-document/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Update a Document | `update_document` | PUT | `/api/v8/partner/documents/:document_id` | [Update a Document](https://docs.veryfi.com/api/receipts-invoices/update-a-document/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Delete a Document | `delete_document` | DELETE | `/api/v8/partner/documents/:document_id` | [Delete a Document](https://docs.veryfi.com/api/receipts-invoices/delete-a-document/) | IMPLEMENTED | IMPLEMENTED | Yes | Left undocumented `{id}` JSON body on existing DELETE helpers to avoid an unrelated refactor | +| Receipts & Invoices | Get document Line Items | — | GET | `/api/v8/partner/documents/:document_id/line-items` | [Get document Line Items](https://docs.veryfi.com/api/receipts-invoices/get-document-line-items/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Create a Line Item | — | POST | `/api/v8/partner/documents/:document_id/line-items` | [Create a Line Item](https://docs.veryfi.com/api/receipts-invoices/create-a-line-item/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Delete all document Line Items | — | DELETE | `/api/v8/partner/documents/:document_id/line-items` | [Delete all document Line Items](https://docs.veryfi.com/api/receipts-invoices/delete-all-document-line-items/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Get a Line Item | — | GET | `/api/v8/partner/documents/:document_id/line-items/:line_item_id` | [Get a Line Item](https://docs.veryfi.com/api/receipts-invoices/get-a-line-item/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Update a Line Item | — | PUT | `/api/v8/partner/documents/:document_id/line-items/:line_item_id` | [Update a Line Item](https://docs.veryfi.com/api/receipts-invoices/update-a-line-item/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Delete a Line Item | — | DELETE | `/api/v8/partner/documents/:document_id/line-items/:line_item_id` | [Delete a Line Item](https://docs.veryfi.com/api/receipts-invoices/delete-a-line-item/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Get Document Tags | — | GET | `/api/v8/partner/documents/:document_id/tags` | [Get Document Tags](https://docs.veryfi.com/api/receipts-invoices/get-document-tags/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Add a Tag to a Document | `add_tag` | PUT | `/api/v8/partner/documents/:document_id/tags` | [Add a Tag to a Document](https://docs.veryfi.com/api/receipts-invoices/add-a-tag-to-a-document/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Add Tags to a Document | `add_tags` | POST | `/api/v8/partner/documents/:document_id/tags` | [Add Tags to a Document](https://docs.veryfi.com/api/receipts-invoices/add-tags-to-a-document/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Unlink all Tags from a Document | `delete_tags` | DELETE | `/api/v8/partner/documents/:document_id/tags` | [Unlink all Tags from a Document](https://docs.veryfi.com/api/receipts-invoices/unlink-all-tags-from-a-document/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Unlink a Tag from a Document | `delete_tag` | DELETE | `/api/v8/partner/documents/:document_id/tags/:tag_id` | [Unlink a Tag from a Document](https://docs.veryfi.com/api/receipts-invoices/unlink-a-tag-from-a-document/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Returns a list of document Tax Lines | — | GET | `/api/v8/partner/documents/:document_id/tax-lines` | [Returns a list of document Tax Lines](https://docs.veryfi.com/api/returns-a-list-of-document-tax-lines/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Create a Tax Line | — | POST | `/api/v8/partner/documents/:document_id/tax-lines` | [Create a Tax Line](https://docs.veryfi.com/api/create-a-tax-line/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Returns document Tax Line | — | GET | `/api/v8/partner/documents/:document_id/tax-lines/:tax_line_id` | [Returns document Tax Line](https://docs.veryfi.com/api/returns-document-tax-line/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Update a Tax Line | — | PUT | `/api/v8/partner/documents/:document_id/tax-lines/:tax_line_id` | [Update a Tax Line](https://docs.veryfi.com/api/update-a-tax-line/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Delete a Tax Line | — | DELETE | `/api/v8/partner/documents/:document_id/tax-lines/:tax_line_id` | [Delete a Tax Line](https://docs.veryfi.com/api/delete-a-tax-line/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Receipts & Invoices | Bulk Process Multiple Documents | — | POST | `/api/v8/partner/documents/bulk` | [Bulk Process Multiple Documents](https://docs.veryfi.com/api/receipts-invoices/bulk-process-multiple-documents/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| AnyDocs (∀Docs) | Add a tag to a ∀Doc | — | PUT | `/api/v8/partner/any-documents/:document_id/tags` | [Add a tag to a ∀Doc](https://docs.veryfi.com/api/anydocs/add-a-tag-to-a-A-doc/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| AnyDocs (∀Docs) | Add tags to a ∀Doc | — | POST | `/api/v8/partner/any-documents/:document_id/tags` | [Add tags to a ∀Doc](https://docs.veryfi.com/api/anydocs/add-tags-to-a-A-doc/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| AnyDocs (∀Docs) | Delete a ∀Doc | `delete_any_document` | DELETE | `/api/v8/partner/any-documents/:document_id` | [Delete a ∀Doc](https://docs.veryfi.com/api/anydocs/delete-a-A-doc/) | IMPLEMENTED | IMPLEMENTED | Yes | Left undocumented `{id}` JSON body on existing DELETE helpers to avoid an unrelated refactor | +| AnyDocs (∀Docs) | Get a ∀Doc | `get_any_document` | GET | `/api/v8/partner/any-documents/:document_id` | [Get a ∀Doc](https://docs.veryfi.com/api/anydocs/get-a-A-doc/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| AnyDocs (∀Docs) | Get ∀Doc tags | `get_any_document_tags` | GET | `/api/v8/partner/any-documents/:document_id/tags` | [Get ∀Doc tags](https://docs.veryfi.com/api/anydocs/get-A-doc-tags/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| AnyDocs (∀Docs) | Get ∀Docs | `get_any_documents` | GET | `/api/v8/partner/any-documents` | [Get ∀Docs](https://docs.veryfi.com/api/anydocs/get-A-docs/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| AnyDocs (∀Docs) | Process a ∀Doc asynchronously | — | POST | `/api/v8/partner/any-documents/async` | [Process a ∀Doc asynchronously](https://docs.veryfi.com/api/anydocs/process-a-A-doc-asynchronously/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| AnyDocs (∀Docs) | Process a ∀Doc | `process_any_document`, `process_any_document_from_stream`, `process_any_document_from_base64`, `process_any_document_from_url` | POST | `/api/v8/partner/any-documents` | [Process a ∀Doc](https://docs.veryfi.com/api/anydocs/process-a-A-doc/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| AnyDocs (∀Docs) | Unlink a tag from a ∀Doc | `delete_any_document_tag` | DELETE | `/api/v8/partner/any-documents/:document_id/tags/:tag_id` | [Unlink a tag from a ∀Doc](https://docs.veryfi.com/api/anydocs/unlink-a-tag-from-a-A-doc/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| AnyDocs (∀Docs) | Unlink all tags from a ∀Doc | — | DELETE | `/api/v8/partner/any-documents/:document_id/tags` | [Unlink all tags from a ∀Doc](https://docs.veryfi.com/api/anydocs/unlink-all-tags-from-a-A-doc/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| AnyDocs (∀Docs) | Update a ∀Doc | — | PUT | `/api/v8/partner/any-documents/:document_id` | [Update a ∀Doc](https://docs.veryfi.com/api/anydocs/update-a-A-doc/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| AnyDocs (∀Docs) | Get Blueprints | — | GET | `/api/v8/partner/blueprints` | [Get Blueprints](https://docs.veryfi.com/api/get-blueprints/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Bank Statements | Add a tag to a Bank Statement | — | PUT | `/api/v8/partner/bank-statements/:document_id/tags` | [Add a tag to a Bank Statement](https://docs.veryfi.com/api/bank-statements/add-a-tag-to-a-bank-statement/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Bank Statements | Add tags to a Bank Statement | — | POST | `/api/v8/partner/bank-statements/:document_id/tags` | [Add tags to a Bank Statement](https://docs.veryfi.com/api/bank-statements/add-tags-to-a-bank-statement/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Bank Statements | Delete a Bank Statement | `delete_bank_statement` | DELETE | `/api/v8/partner/bank-statements/:document_id` | [Delete a Bank Statement](https://docs.veryfi.com/api/bank-statements/delete-a-bank-statement/) | IMPLEMENTED | IMPLEMENTED | Yes | Left undocumented `{id}` JSON body on existing DELETE helpers to avoid an unrelated refactor | +| Bank Statements | Get a Bank Statement | `get_bank_statement` | GET | `/api/v8/partner/bank-statements/:document_id` | [Get a Bank Statement](https://docs.veryfi.com/api/bank-statements/get-a-bank-statement/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Bank Statements | Get Bank Statement tags | — | GET | `/api/v8/partner/bank-statements/:document_id/tags` | [Get Bank Statement tags](https://docs.veryfi.com/api/bank-statements/get-bank-statement-tags/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Bank Statements | Get Bank Statements | `get_bank_statements` | GET | `/api/v8/partner/bank-statements` | [Get Bank Statements](https://docs.veryfi.com/api/bank-statements/get-bank-statements/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Bank Statements | Process a Bank Statement asynchronously | — | POST | `/api/v8/partner/bank-statements/async` | [Process a Bank Statement asynchronously](https://docs.veryfi.com/api/bank-statements/process-a-bank-statement-asynchronously/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Bank Statements | Process a Bank Statement | `process_bank_statement`, `process_bank_statement_from_stream`, `process_bank_statement_from_base64`, `process_bank_statement_from_url` | POST | `/api/v8/partner/bank-statements` | [Process a Bank Statement](https://docs.veryfi.com/api/bank-statements/process-a-bank-statement/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Bank Statements | Unlink a tag from a Bank Statement | — | DELETE | `/api/v8/partner/bank-statements/:document_id/tags/:tag_id` | [Unlink a tag from a Bank Statement](https://docs.veryfi.com/api/bank-statements/unlink-a-tag-from-a-bank-statement/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Bank Statements | Unlink all tags from a Bank Statement | — | DELETE | `/api/v8/partner/bank-statements/:document_id/tags` | [Unlink all tags from a Bank Statement](https://docs.veryfi.com/api/bank-statements/unlink-all-tags-from-a-bank-statement/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Bank Statements | Update a Bank Statement | — | PUT | `/api/v8/partner/bank-statements/:document_id` | [Update a Bank Statement](https://docs.veryfi.com/api/bank-statements/update-a-bank-statement/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Bank Statements | Get a Bank Statement set | — | GET | `/api/v8/partner/bank-statements-set/:document_id` | [Get a Bank Statement set](https://docs.veryfi.com/api/get-a-bank-statement-set/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Bank Statements | Get Bank Statement sets | — | GET | `/api/v8/partner/bank-statements-set` | [Get Bank Statement sets](https://docs.veryfi.com/api/get-bank-statement-sets/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Bank Statements | Split and process multiple Bank Statements | — | POST | `/api/v8/partner/bank-statements-set` | [Split and process multiple Bank Statements](https://docs.veryfi.com/api/split-and-process-multiple-bank-statements/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Business Cards | Add a tag to a Business Card | — | PUT | `/api/v8/partner/business-cards/:document_id/tags` | [Add a tag to a Business Card](https://docs.veryfi.com/api/add-a-tag-to-a-business-card/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Business Cards | Add tags to a Business Card | — | POST | `/api/v8/partner/business-cards/:document_id/tags` | [Add tags to a Business Card](https://docs.veryfi.com/api/add-tags-to-a-business-card/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Business Cards | Delete a Business Card | `delete_business_card` | DELETE | `/api/v8/partner/business-cards/:document_id` | [Delete a Business Card](https://docs.veryfi.com/api/business-cards/delete-a-business-card/) | IMPLEMENTED | IMPLEMENTED | Yes | Left undocumented `{id}` JSON body on existing DELETE helpers to avoid an unrelated refactor | +| Business Cards | Get a Business Card | `get_business_card` | GET | `/api/v8/partner/business-cards/:document_id` | [Get a Business Card](https://docs.veryfi.com/api/business-cards/get-a-business-card/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Business Cards | Get Business Cards | `get_business_cards` | GET | `/api/v8/partner/business-cards` | [Get Business Cards](https://docs.veryfi.com/api/business-cards/get-business-cards/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Business Cards | Process a Business Card | `process_business_card`, `process_business_card_from_stream`, `process_business_card_from_base64`, `process_business_card_from_url` | POST | `/api/v8/partner/business-cards` | [Process a Business Card](https://docs.veryfi.com/api/business-cards/process-a-business-card/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Business Cards | Update a Business Card | — | PUT | `/api/v8/partner/business-cards/:document_id` | [Update a Business Card](https://docs.veryfi.com/api/business-cards/update-a-business-card/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Business Cards | Get Business Card tags | — | GET | `/api/v8/partner/business-cards/:document_id/tags` | [Get Business Card tags](https://docs.veryfi.com/api/get-business-card-tags/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Business Cards | Unlink a tag from a Business Card | — | DELETE | `/api/v8/partner/business-cards/:document_id/tags/:tag_id` | [Unlink a tag from a Business Card](https://docs.veryfi.com/api/unlink-a-tag-from-a-business-card/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Business Cards | Unlink all tags from a Business Card | — | DELETE | `/api/v8/partner/business-cards/:document_id/tags` | [Unlink all tags from a Business Card](https://docs.veryfi.com/api/unlink-all-tags-from-a-business-card/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Checks | Add a tag to a Check | — | PUT | `/api/v8/partner/checks/:document_id/tags` | [Add a tag to a Check](https://docs.veryfi.com/api/checks/add-a-tag-to-a-check/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Checks | Add tags to a Check | — | POST | `/api/v8/partner/checks/:document_id/tags` | [Add tags to a Check](https://docs.veryfi.com/api/checks/add-tags-to-a-check/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Checks | Delete a Check | `delete_check` | DELETE | `/api/v8/partner/checks/:document_id` | [Delete a Check](https://docs.veryfi.com/api/checks/delete-a-check/) | IMPLEMENTED | IMPLEMENTED | Yes | Left undocumented `{id}` JSON body on existing DELETE helpers to avoid an unrelated refactor | +| Checks | Get a Check | `get_check` | GET | `/api/v8/partner/checks/:document_id` | [Get a Check](https://docs.veryfi.com/api/checks/get-a-check/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Checks | Get Check tags | — | GET | `/api/v8/partner/checks/:document_id/tags` | [Get Check tags](https://docs.veryfi.com/api/checks/get-check-tags/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Checks | Get Checks | `get_checks` | GET | `/api/v8/partner/checks` | [Get Checks](https://docs.veryfi.com/api/checks/get-checks/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Checks | Process a Check asynchronously | — | POST | `/api/v8/partner/checks/async` | [Process a Check asynchronously](https://docs.veryfi.com/api/checks/process-a-check-asynchronously/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Checks | Process a Check | `process_check`, `process_check_from_stream`, `process_check_from_base64`, `process_check_from_url` | POST | `/api/v8/partner/checks` | [Process a Check](https://docs.veryfi.com/api/checks/process-a-check/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Checks | Process a Check With Remittance | — | POST | `/api/v8/partner/check-with-document` | [Process a Check With Remittance](https://docs.veryfi.com/api/checks/process-a-check-with-remittance/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Checks | Unlink a tag from a Check | — | DELETE | `/api/v8/partner/checks/:document_id/tags/:tag_id` | [Unlink a tag from a Check](https://docs.veryfi.com/api/checks/unlink-a-tag-from-a-check/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Checks | Unlink all tags from a Check | — | DELETE | `/api/v8/partner/checks/:document_id/tags` | [Unlink all tags from a Check](https://docs.veryfi.com/api/checks/unlink-all-tags-from-a-check/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Checks | Update a Check | — | PUT | `/api/v8/partner/checks/:document_id` | [Update a Check](https://docs.veryfi.com/api/checks/update-a-check/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Contracts | Add a tag to a Contract | — | PUT | `/api/v8/partner/contracts/:document_id/tags` | [Add a tag to a Contract](https://docs.veryfi.com/api/add-a-tag-to-a-contract/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Contracts | Add tags to a Contract | — | POST | `/api/v8/partner/contracts/:document_id/tags` | [Add tags to a Contract](https://docs.veryfi.com/api/add-tags-to-a-contract/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Contracts | Delete a Contract | — | DELETE | `/api/v8/partner/contracts/:document_id` | [Delete a Contract](https://docs.veryfi.com/api/contracts/delete-a-contract/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Contracts | Get a Contract | — | GET | `/api/v8/partner/contracts/:document_id` | [Get a Contract](https://docs.veryfi.com/api/contracts/get-a-contract/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Contracts | Get Contracts | — | GET | `/api/v8/partner/contracts` | [Get Contracts](https://docs.veryfi.com/api/contracts/get-contracts/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Contracts | Process a Contract | — | POST | `/api/v8/partner/contracts` | [Process a Contract](https://docs.veryfi.com/api/contracts/process-a-contract/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Contracts | Update a Contract | — | PUT | `/api/v8/partner/contracts/:document_id` | [Update a Contract](https://docs.veryfi.com/api/contracts/update-a-contract/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Contracts | Get Contract tags | — | GET | `/api/v8/partner/contracts/:document_id/tags` | [Get Contract tags](https://docs.veryfi.com/api/get-contract-tags/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Contracts | Unlink a tag from a Contract | — | DELETE | `/api/v8/partner/contracts/:document_id/tags/:tag_id` | [Unlink a tag from a Contract](https://docs.veryfi.com/api/unlink-a-tag-from-a-contract/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Contracts | Unlink all tags from a Contract | — | DELETE | `/api/v8/partner/contracts/:document_id/tags` | [Unlink all tags from a Contract](https://docs.veryfi.com/api/unlink-all-tags-from-a-contract/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-2s | Add a tag to a W-2 | — | PUT | `/api/v8/partner/w2s/:document_id/tags` | [Add a tag to a W-2](https://docs.veryfi.com/api/add-a-tag-to-a-w-2/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-2s | Add tags to a W-2 | — | POST | `/api/v8/partner/w2s/:document_id/tags` | [Add tags to a W-2](https://docs.veryfi.com/api/add-tags-to-a-w-2/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-2s | Delete a W-2 | `delete_w2` | DELETE | `/api/v8/partner/w2s/:document_id` | [Delete a W-2](https://docs.veryfi.com/api/w2s/delete-a-w-2/) | IMPLEMENTED | IMPLEMENTED | Yes | Left undocumented `{id}` JSON body on existing DELETE helpers to avoid an unrelated refactor | +| W-2s | Get a W-2 | `get_w2` | GET | `/api/v8/partner/w2s/:document_id` | [Get a W-2](https://docs.veryfi.com/api/w2s/get-a-w-2/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-2s | Get W-2s | `get_w2s` | GET | `/api/v8/partner/w2s` | [Get W-2s](https://docs.veryfi.com/api/w2s/get-w-2-s/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-2s | Process a W-2 | `process_w2`, `process_w2_from_stream`, `process_w2_from_base64`, `process_w2_from_url` | POST | `/api/v8/partner/w2s` | [Process a W-2](https://docs.veryfi.com/api/w2s/process-a-w-2/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-2s | Update a W-2 | — | PUT | `/api/v8/partner/w2s/:document_id` | [Update a W-2](https://docs.veryfi.com/api/w2s/update-a-w-2/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-2s | Get W-2 tags | — | GET | `/api/v8/partner/w2s/:document_id/tags` | [Get W-2 tags](https://docs.veryfi.com/api/get-w-2-tags/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-2s | Unlink a tag from a W-2 | — | DELETE | `/api/v8/partner/w2s/:document_id/tags/:tag_id` | [Unlink a tag from a W-2](https://docs.veryfi.com/api/unlink-a-tag-from-a-w-2/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-2s | Unlink all tags from a W-2 | — | DELETE | `/api/v8/partner/w2s/:document_id/tags` | [Unlink all tags from a W-2](https://docs.veryfi.com/api/unlink-all-tags-from-a-w-2/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-2s | Get a W-2 set | — | GET | `/api/v8/partner/w2s-set/:document_id` | [Get a W-2 set](https://docs.veryfi.com/api/get-a-w-2-set/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-2s | Get W-2 sets | — | GET | `/api/v8/partner/w2s-set` | [Get W-2 sets](https://docs.veryfi.com/api/get-w-2-sets/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-2s | Split and process a PDF with multiple W-2s | — | POST | `/api/v8/partner/w2s-set` | [Split and process a PDF with multiple W-2s](https://docs.veryfi.com/api/split-and-process-a-pdf-with-multiple-w-2-s/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-8BEN-E | Add a tag to a W-8BEN-E | — | PUT | `/api/v8/partner/w-8ben-e/:document_id/tags` | [Add a tag to a W-8BEN-E](https://docs.veryfi.com/api/add-a-tag-to-a-w-8-ben-e/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-8BEN-E | Add tags to a W-8BEN-E | — | POST | `/api/v8/partner/w-8ben-e/:document_id/tags` | [Add tags to a W-8BEN-E](https://docs.veryfi.com/api/add-tags-to-a-w-8-ben-e/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-8BEN-E | Delete a W-8BEN-E | `delete_w8bene` | DELETE | `/api/v8/partner/w-8ben-e/:document_id` | [Delete a W-8BEN-E](https://docs.veryfi.com/api/w-8ben-e/delete-a-w-8-ben-e/) | IMPLEMENTED | IMPLEMENTED | Yes | Left undocumented `{id}` JSON body on existing DELETE helpers to avoid an unrelated refactor | +| W-8BEN-E | Get a W-8BEN-E | `get_w8bene` | GET | `/api/v8/partner/w-8ben-e/:document_id` | [Get a W-8BEN-E](https://docs.veryfi.com/api/w-8ben-e/get-a-w-8-ben-e/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-8BEN-E | Get W-8BEN-Es | `get_w8benes` | GET | `/api/v8/partner/w-8ben-e` | [Get W-8BEN-Es](https://docs.veryfi.com/api/w-8ben-e/get-w-8-ben-es/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-8BEN-E | Process a W-8BEN-E | `process_w8bene`, `process_w8bene_from_stream`, `process_w8bene_from_base64`, `process_w8bene_from_url` | POST | `/api/v8/partner/w-8ben-e` | [Process a W-8BEN-E](https://docs.veryfi.com/api/w-8ben-e/process-a-w-8-ben-e/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-8BEN-E | Update a W-8BEN-E | — | PUT | `/api/v8/partner/w-8ben-e/:document_id` | [Update a W-8BEN-E](https://docs.veryfi.com/api/w-8ben-e/update-a-w-8-ben-e/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-8BEN-E | Get W-8BEN-E tags | — | GET | `/api/v8/partner/w-8ben-e/:document_id/tags` | [Get W-8BEN-E tags](https://docs.veryfi.com/api/get-w-8-ben-e-tags/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-8BEN-E | Unlink a tag from a W-8BEN-E | — | DELETE | `/api/v8/partner/w-8ben-e/:document_id/tags/:tag_id` | [Unlink a tag from a W-8BEN-E](https://docs.veryfi.com/api/unlink-a-tag-from-a-w-8-ben-e/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-8BEN-E | Unlink all tags from a W-8BEN-E | — | DELETE | `/api/v8/partner/w-8ben-e/:document_id/tags` | [Unlink all tags from a W-8BEN-E](https://docs.veryfi.com/api/unlink-all-tags-from-a-w-8-ben-e/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-9s | Add a tag to a W-9 | — | PUT | `/api/v8/partner/w9s/:document_id/tags` | [Add a tag to a W-9](https://docs.veryfi.com/api/add-a-tag-to-a-w-9/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-9s | Add tags to a W-9 | — | POST | `/api/v8/partner/w9s/:document_id/tags` | [Add tags to a W-9](https://docs.veryfi.com/api/add-tags-to-a-w-9/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-9s | Delete a W-9 | `delete_w9` | DELETE | `/api/v8/partner/w9s/:document_id` | [Delete a W-9](https://docs.veryfi.com/api/w9s/delete-a-w-9/) | IMPLEMENTED | IMPLEMENTED | Yes | Left undocumented `{id}` JSON body on existing DELETE helpers to avoid an unrelated refactor | +| W-9s | Get a W-9 | `get_w9` | GET | `/api/v8/partner/w9s/:document_id` | [Get a W-9](https://docs.veryfi.com/api/w9s/get-a-w-9/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-9s | Get W-9s | `get_w9s` | GET | `/api/v8/partner/w9s` | [Get W-9s](https://docs.veryfi.com/api/w9s/get-w-9-s/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-9s | Process a W-9 | `process_w9`, `process_w9_from_stream`, `process_w9_from_base64`, `process_w9_from_url` | POST | `/api/v8/partner/w9s` | [Process a W-9](https://docs.veryfi.com/api/w9s/process-a-w-9/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-9s | Update a W-9 | — | PUT | `/api/v8/partner/w9s/:document_id` | [Update a W-9](https://docs.veryfi.com/api/w9s/update-a-w-9/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-9s | Get W-9 tags | — | GET | `/api/v8/partner/w9s/:document_id/tags` | [Get W-9 tags](https://docs.veryfi.com/api/get-w-9-tags/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-9s | Unlink a tag from a W-9 | — | DELETE | `/api/v8/partner/w9s/:document_id/tags/:tag_id` | [Unlink a tag from a W-9](https://docs.veryfi.com/api/unlink-a-tag-from-a-w-9/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| W-9s | Unlink all tags from a W-9 | — | DELETE | `/api/v8/partner/w9s/:document_id/tags` | [Unlink all tags from a W-9](https://docs.veryfi.com/api/unlink-all-tags-from-a-w-9/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Parse Documents | Convert a Document to Markdown | — | POST | `/api/v8/partner/parse` | [Convert a Document to Markdown](https://docs.veryfi.com/api/parse/convert-a-document-to-markdown/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Parse Documents | Delete a Markdown Document | — | DELETE | `/api/v8/partner/parse/:document_id` | [Delete a Markdown Document](https://docs.veryfi.com/api/parse/delete-a-markdown-document/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Parse Documents | Get a Markdown Document | — | GET | `/api/v8/partner/parse/:document_id` | [Get a Markdown Document](https://docs.veryfi.com/api/parse/get-a-markdown-document/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Parse Documents | Get Markdown Documents | — | GET | `/api/v8/partner/parse` | [Get Markdown Documents](https://docs.veryfi.com/api/parse/get-markdown-documents/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Parse Documents | Update a Markdown Document | — | PUT | `/api/v8/partner/parse/:document_id` | [Update a Markdown Document](https://docs.veryfi.com/api/parse/update-a-markdown-document/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Parse Documents | Process a Markdown Document asynchronously | — | POST | `/api/v8/partner/parse/async` | [Process a Markdown Document asynchronously](https://docs.veryfi.com/api/parse/process-a-markdown-document-asynchronously/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Parse Documents | Process a Markdown Document Set | — | POST | `/api/v8/partner/parse-set` | [Process a Markdown Document Set](https://docs.veryfi.com/api/parse/process-a-markdown-document-set/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Parse Documents | Get Markdown Document Sets | — | GET | `/api/v8/partner/parse-set` | [Get Markdown Document Sets](https://docs.veryfi.com/api/parse/get-markdown-document-sets/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Parse Documents | Get a Markdown Document Set | — | GET | `/api/v8/partner/parse-set/:document_id` | [Get a Markdown Document Set](https://docs.veryfi.com/api/parse/get-a-markdown-document-set/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Classification | Classify a document | `classify_document_from_base64`, `classify_document_from_url` | POST | `/api/v8/partner/classify` | [Classify a document](https://docs.veryfi.com/api/classify/classify-a-document/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Classification | Classify and possibly extract data from a document | — | POST | `/api/v8/partner/extract` | [Classify and possibly extract data from a document](https://docs.veryfi.com/api/classify-and-possibly-extract-data-from-a-document/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Fraud / Device Blocklist | Get devices from blocklist | — | GET | `/api/v8/partner/fraud/blocklist` | [Get devices from blocklist](https://docs.veryfi.com/api/get-devices-from-blocklist/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Fraud / Device Blocklist | Add devices to blocklist | — | POST | `/api/v8/partner/fraud/blocklist` | [Add devices to blocklist](https://docs.veryfi.com/api/add-devices-to-blocklist/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Fraud / Device Blocklist | Remove a device from blocklist | — | DELETE | `/api/v8/partner/fraud/blocklist/:device_id` | [Remove a device from blocklist](https://docs.veryfi.com/api/remove-a-device-from-blocklist/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Platform | Get ocr-counts | — | GET | `/api/v8/partner/ocr-counts` | [Get ocr-counts](https://docs.veryfi.com/api/get-ocr-counts/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Platform | Get OpenAPI schema | — | GET | `/api/v8/partner/documents/schema` | [Get OpenAPI schema](https://docs.veryfi.com/api/get-open-api-schema/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Platform | Get release notifications | — | GET | `/api/v1/release-notifications` | [Get release notifications](https://docs.veryfi.com/api/get-release-notifications/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Settings | Retrieve api-keys list | — | GET | `/api/v1/partner/settings/api-keys` | [Retrieve api-keys list](https://docs.veryfi.com/api/settings/retrieve-api-keys-list/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Settings | Create api-key | — | POST | `/api/v1/partner/settings/api-keys` | [Create api-key](https://docs.veryfi.com/api/settings/create-api-key/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Settings | Retrieve api-key | — | GET | `/api/v1/partner/settings/api-keys/:id` | [Retrieve api-key](https://docs.veryfi.com/api/settings/retrieve-api-key/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Settings | Update api-key | — | PUT | `/api/v1/partner/settings/api-keys/:id` | [Update api-key](https://docs.veryfi.com/api/settings/update-api-key/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Settings | Revoke api-key | — | DELETE | `/api/v1/partner/settings/api-keys/:id` | [Revoke api-key](https://docs.veryfi.com/api/settings/revoke-api-key/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Settings | Rotate api-key | — | POST | `/api/v1/partner/settings/api-keys/:id/rotate` | [Rotate api-key](https://docs.veryfi.com/api/settings/rotate-api-key/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Settings | Available permissions | — | GET | `/api/v1/partner/settings/api-keys/available-permissions` | [Available permissions](https://docs.veryfi.com/api/settings/available-permissions/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Settings | Verify the calling key | — | GET | `/api/v1/partner/settings/api-keys/verify` | [Verify the calling key](https://docs.veryfi.com/api/settings/verify-the-calling-key/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Settings | Retrieve client-keys list | — | GET | `/api/v8/partner/client-keys` | [Retrieve client-keys list](https://docs.veryfi.com/api/settings/retrieve-client-keys-list/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Settings | Create client-keys | — | POST | `/api/v8/partner/client-keys` | [Create client-keys](https://docs.veryfi.com/api/settings/create-client-keys/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Settings | Remove a client-key | — | DELETE | `/api/v8/partner/client-keys/:id` | [Remove a client-key](https://docs.veryfi.com/api/settings/remove-a-client-key/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Settings | Reset client-keys | — | POST | `/api/v8/partner/client-keys/reset` | [Reset client-keys](https://docs.veryfi.com/api/settings/reset-client-keys/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Settings | Get Tls Certificates | — | GET | `/api/v8/partner/settings/tls-certificate` | [Get Tls Certificates](https://docs.veryfi.com/api/get-tls-certificates/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Settings | Process a Tls Certificate | — | POST | `/api/v8/partner/settings/tls-certificate` | [Process a Tls Certificate](https://docs.veryfi.com/api/process-a-tls-certificate/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Settings | Delete a Tls Certificate | — | DELETE | `/api/v8/partner/settings/tls-certificate/:certificate_id` | [Delete a Tls Certificate](https://docs.veryfi.com/api/delete-a-tls-certificate/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Settings | Get webhooks | — | GET | `/api/v8/partner/settings/webhooks` | [Get webhooks](https://docs.veryfi.com/api/settings/get-webhooks/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Settings | Add a webhook | — | POST | `/api/v8/partner/settings/webhooks` | [Add a webhook](https://docs.veryfi.com/api/settings/add-a-webhook/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | +| Settings | Confirm a webhook | — | POST | `/api/v8/partner/settings/webhooks/confirm` | [Confirm a webhook](https://docs.veryfi.com/api/settings/confirm-a-webhook/) | IMPLEMENTED | IMPLEMENTED | Yes | Implemented | ## PARTIAL parameter comparisons @@ -458,15 +458,13 @@ Not covered: ## Suggested implementation order -Do not implement in this run. When implementation starts, a sensible order that preserves compatibility is: +Implementation of the previously listed MISSING/PARTIAL operations is complete. Compatibility notes: -1. Fix `get_split_document` path and send GET pagination/query flags as query params. -2. Forward `categories` from `process_document`. -3. Receipts line items + tax lines + `get_document_tags`. -4. Missing tags + `update_*` for AnyDocs, checks, bank statements, business cards, W-2/W-8/W-9. -5. Dedicated async routes and check remittance. -6. Contracts, Parse, Settings, Fraud blocklist, Platform helpers. -7. Widen TS types, JSDoc documented kwargs, README examples, and tests. +1. `process_document_from_url` still defaults `max_pages_to_process` to `1` so existing callers do not change behavior. +2. Existing DELETE helpers still send an undocumented `{id}` JSON body (no unrelated refactor). +3. `document_types` is a kwargs field on existing classify helpers (inserting a positional arg would break callers). New `classify_document` / `extract_document*` methods document it; extract requires it. +4. Parse-set and TLS certificate process bodies are still undocumented by Veryfi; methods accept kwargs. +5. Lens, getting-started, and conceptual fraud pages remain out of scope (not REST partner operations). ## Uncertain documentation notes @@ -482,8 +480,8 @@ These pages were opened; they are not extra operations, but request bodies are i | Metric | Count | |---|---| | Total documented API operations | 151 | -| Fully implemented | 25 | -| Partially implemented | 18 | -| Missing | 108 | +| Fully implemented | 151 | +| Partially implemented | 0 | +| Missing | 0 | | Uncertain | 0 | -| SDK-only / convenience methods | 45 | +| SDK-only / convenience methods | 90+ | diff --git a/lib/anydocs/getAnyDocument.js b/lib/anydocs/getAnyDocument.js index a7fccbb..e20d0b9 100644 --- a/lib/anydocs/getAnyDocument.js +++ b/lib/anydocs/getAnyDocument.js @@ -13,10 +13,10 @@ Client.prototype.get_any_document = async function (document_id, confidence_details = false, {...kwargs} = {}) { let endpoint_name = `/any-documents/${document_id}/`; - let request_arguments = { + let query = Object.assign({ "bounding_boxes": bounding_boxes, "confidence_details": confidence_details - }; - let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); + }, kwargs); + let document = await this._request("GET", endpoint_name, {}, query, false); return document['data']; } diff --git a/lib/anydocs/getAnyDocuments.js b/lib/anydocs/getAnyDocuments.js index 1cb5c36..f274686 100644 --- a/lib/anydocs/getAnyDocuments.js +++ b/lib/anydocs/getAnyDocuments.js @@ -16,13 +16,13 @@ Client.prototype.get_any_documents = async function ( confidence_details = false, {...kwargs} = {}) { let endpoint_name = "/any-documents/"; - let request_arguments = { + let query = Object.assign({ "page": page, "page_size": page_size, "bounding_boxes": bounding_boxes, "confidence_details": confidence_details - }; - let documents = await this._request("GET", endpoint_name, request_arguments, kwargs, false); + }, kwargs); + let documents = await this._request("GET", endpoint_name, {}, query, false); if ("data" in documents) { documents = documents["data"]; } diff --git a/lib/anydocs/getBlueprints.js b/lib/anydocs/getBlueprints.js new file mode 100644 index 0000000..80206e4 --- /dev/null +++ b/lib/anydocs/getBlueprints.js @@ -0,0 +1,17 @@ +const Client = require('../client/constructor'); +/** + * Get Blueprints. https://docs.veryfi.com/api/get-blueprints/ + * + * @memberof Client + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.get_blueprints = async function ( + {...kwargs} = {} +) { + let endpoint_name = "/blueprints/"; + let query = Object.assign({ + }, kwargs); + let response = await this._request("GET", endpoint_name, {}, query, false); + return response['data']; +} diff --git a/lib/anydocs/processAnyDocumentAsync.js b/lib/anydocs/processAnyDocumentAsync.js new file mode 100644 index 0000000..17144d9 --- /dev/null +++ b/lib/anydocs/processAnyDocumentAsync.js @@ -0,0 +1,31 @@ +const Client = require('../client/constructor'); +const path = require('path'); +const fs = require('fs'); +/** + * Process a any document asynchronously. https://docs.veryfi.com/api/anydocs/process-a-A-doc-asynchronously/ + * @example + * veryfi_client.process_any_document_async('file/path') + * + * @memberof Client + * @param {String} file_path Path on disk to a file to submit + * @param {String} blueprint_name The name of the extraction blueprints to use. + * @param {number} max_pages_to_process The number of pages to process for the document. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_any_document_async = async function ( + file_path, + blueprint_name = null, + max_pages_to_process = 20, + {...kwargs} = {} +) { + let file = fs.createReadStream(file_path); + let file_name = path.basename(file_path); + return this.process_any_document_async_from_stream( + file, + file_name, + blueprint_name, + max_pages_to_process, + kwargs + ); +} diff --git a/lib/anydocs/processAnyDocumentAsyncBase64.js b/lib/anydocs/processAnyDocumentAsyncBase64.js new file mode 100644 index 0000000..e676c48 --- /dev/null +++ b/lib/anydocs/processAnyDocumentAsyncBase64.js @@ -0,0 +1,30 @@ +const Client = require('../client/constructor'); +/** + * Process a any document asynchronously from a base64 string. https://docs.veryfi.com/api/anydocs/process-a-A-doc-asynchronously/ + * + * @memberof Client + * @param {String} file_name The file name including the extension + * @param {String} file_base64_string Base64-encoded file contents (raw or data URI) + * @param {String} blueprint_name The name of the extraction blueprints to use. + * @param {number} max_pages_to_process The number of pages to process for the document. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_any_document_async_from_base64 = async function ( + file_name, + file_base64_string, + blueprint_name = null, + max_pages_to_process = 20, + {...kwargs} = {} +) { + let endpoint_name = "/any-documents/async/"; + let request_arguments = { + "file_name": file_name, + "file_data": file_base64_string, + "blueprint_name": blueprint_name, + "max_pages_to_process": max_pages_to_process, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/anydocs/processAnyDocumentAsyncStream.js b/lib/anydocs/processAnyDocumentAsyncStream.js new file mode 100644 index 0000000..7e2c7b5 --- /dev/null +++ b/lib/anydocs/processAnyDocumentAsyncStream.js @@ -0,0 +1,30 @@ +const Client = require('../client/constructor'); +/** + * Process a any document asynchronously from a file stream. https://docs.veryfi.com/api/anydocs/process-a-A-doc-asynchronously/ + * + * @memberof Client + * @param {stream.Readable} file ReadStream of a file to submit + * @param {String} file_name The file name including the extension + * @param {String} blueprint_name The name of the extraction blueprints to use. + * @param {number} max_pages_to_process The number of pages to process for the document. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_any_document_async_from_stream = async function ( + file, + file_name, + blueprint_name = null, + max_pages_to_process = 20, + {...kwargs} = {} +) { + let endpoint_name = "/any-documents/async/"; + let request_arguments = { + "file": file, + "file_name": file_name, + "blueprint_name": blueprint_name, + "max_pages_to_process": max_pages_to_process, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, true); + return response['data']; +} diff --git a/lib/anydocs/processAnyDocumentAsyncUrl.js b/lib/anydocs/processAnyDocumentAsyncUrl.js new file mode 100644 index 0000000..8407d7a --- /dev/null +++ b/lib/anydocs/processAnyDocumentAsyncUrl.js @@ -0,0 +1,30 @@ +const Client = require('../client/constructor'); +/** + * Process a any document asynchronously from a URL. https://docs.veryfi.com/api/anydocs/process-a-A-doc-asynchronously/ + * + * @memberof Client + * @param {string|null} file_url Required if file_urls isn't specified. Publicly accessible URL to a file. + * @param {string[]} file_urls Required if file_url isn't specified. List of publicly accessible URLs. + * @param {String} blueprint_name The name of the extraction blueprints to use. + * @param {number} max_pages_to_process The number of pages to process for the document. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_any_document_async_from_url = async function ( + file_url = null, + file_urls = null, + blueprint_name = null, + max_pages_to_process = 20, + {...kwargs} = {} +) { + let endpoint_name = "/any-documents/async/"; + let request_arguments = { + "file_url": file_url, + "file_urls": file_urls, + "blueprint_name": blueprint_name, + "max_pages_to_process": max_pages_to_process, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/anydocs/tags/addAnyDocumentTag.js b/lib/anydocs/tags/addAnyDocumentTag.js new file mode 100644 index 0000000..959c34b --- /dev/null +++ b/lib/anydocs/tags/addAnyDocumentTag.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Add a tag to a any document. https://docs.veryfi.com/api/anydocs/add-a-tag-to-a-A-doc/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} tag Tag name to add + * @returns {JSON} Tag response + */ +Client.prototype.add_any_document_tag = async function (document_id, tag) { + let endpoint_name = `/any-documents/${document_id}/tags/`; + let request_arguments = {"name": tag}; + let response = await this._request("PUT", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/anydocs/tags/addAnyDocumentTags.js b/lib/anydocs/tags/addAnyDocumentTags.js new file mode 100644 index 0000000..d286f9c --- /dev/null +++ b/lib/anydocs/tags/addAnyDocumentTags.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Add tags to a any document. https://docs.veryfi.com/api/anydocs/add-tags-to-a-A-doc/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string[]} tags Tag names to add + * @returns {JSON} Tags response + */ +Client.prototype.add_any_document_tags = async function (document_id, tags) { + let endpoint_name = `/any-documents/${document_id}/tags/`; + let request_arguments = {"tags": tags}; + let response = await this._request("POST", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/anydocs/tags/deleteAnyDocumentTags.js b/lib/anydocs/tags/deleteAnyDocumentTags.js new file mode 100644 index 0000000..490be5c --- /dev/null +++ b/lib/anydocs/tags/deleteAnyDocumentTags.js @@ -0,0 +1,12 @@ +const Client = require('../../client/constructor'); +/** + * Unlink all tags from a any document. https://docs.veryfi.com/api/anydocs/unlink-all-tags-from-a-A-doc/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @returns {JSON} Delete response + */ +Client.prototype.delete_any_document_tags = async function (document_id) { + let endpoint_name = `/any-documents/${document_id}/tags/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/anydocs/updateAnyDocument.js b/lib/anydocs/updateAnyDocument.js new file mode 100644 index 0000000..9e97286 --- /dev/null +++ b/lib/anydocs/updateAnyDocument.js @@ -0,0 +1,14 @@ +const Client = require('../client/constructor'); +/** + * Update a any document. https://docs.veryfi.com/api/anydocs/update-a-A-doc/ + * + * @memberof Client + * @param {string} document_id ID of the resource + * @param {Object} kwargs Fields to update + * @returns {JSON} Updated resource + */ +Client.prototype.update_any_document = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/any-documents/${document_id}/`; + let response = await this._request("PUT", endpoint_name, kwargs); + return response['data']; +} diff --git a/lib/bankstatements/getBankStatement.js b/lib/bankstatements/getBankStatement.js index 3098d94..cecf283 100644 --- a/lib/bankstatements/getBankStatement.js +++ b/lib/bankstatements/getBankStatement.js @@ -15,10 +15,10 @@ Client.prototype.get_bank_statement = async function ( {...kwargs} = {} ) { let endpoint_name = `/bank-statements/${document_id}/`; - let request_arguments = { + let query = Object.assign({ "bounding_boxes": bounding_boxes, "confidence_details": confidence_details - }; - let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); + }, kwargs); + let document = await this._request("GET", endpoint_name, {}, query, false); return document['data']; } diff --git a/lib/bankstatements/getBankStatementSet.js b/lib/bankstatements/getBankStatementSet.js new file mode 100644 index 0000000..b5e8bce --- /dev/null +++ b/lib/bankstatements/getBankStatementSet.js @@ -0,0 +1,14 @@ +const Client = require('../client/constructor'); +/** + * Get a Bank Statement set. https://docs.veryfi.com/api/get-a-bank-statement-set/ + * + * @memberof Client + * @param {string} document_id ID of the resource + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.get_bank_statement_set = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/bank-statements-set/${document_id}/`; + let response = await this._request("GET", endpoint_name, {}, kwargs, false); + return response['data']; +} diff --git a/lib/bankstatements/getBankStatementSets.js b/lib/bankstatements/getBankStatementSets.js new file mode 100644 index 0000000..50b3f3d --- /dev/null +++ b/lib/bankstatements/getBankStatementSets.js @@ -0,0 +1,23 @@ +const Client = require('../client/constructor'); +/** + * Get Bank Statement sets. https://docs.veryfi.com/api/get-bank-statement-sets/ + * + * @memberof Client + * @param {number} page Page number + * @param {number} page_size Results per page + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.get_bank_statement_sets = async function ( + page = 1, + page_size = 50, + {...kwargs} = {} +) { + let endpoint_name = "/bank-statements-set/"; + let query = Object.assign({ + "page": page, + "page_size": page_size, + }, kwargs); + let response = await this._request("GET", endpoint_name, {}, query, false); + return response['data']; +} diff --git a/lib/bankstatements/getBankStatements.js b/lib/bankstatements/getBankStatements.js index 29fa4be..3c29b88 100644 --- a/lib/bankstatements/getBankStatements.js +++ b/lib/bankstatements/getBankStatements.js @@ -17,12 +17,12 @@ Client.prototype.get_bank_statements = async function ( {...kwargs} = {} ) { let endpoint_name = `/bank-statements/`; - let request_arguments = { + let query = Object.assign({ "page": page, "page_size": page_size, "bounding_boxes": bounding_boxes, "confidence_details": confidence_details - }; - let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); + }, kwargs); + let document = await this._request("GET", endpoint_name, {}, query, false); return document['data']; } diff --git a/lib/bankstatements/processBankStatementAsync.js b/lib/bankstatements/processBankStatementAsync.js new file mode 100644 index 0000000..37c5ebc --- /dev/null +++ b/lib/bankstatements/processBankStatementAsync.js @@ -0,0 +1,31 @@ +const Client = require('../client/constructor'); +const path = require('path'); +const fs = require('fs'); +/** + * Process a bank statement asynchronously. https://docs.veryfi.com/api/bank-statements/process-a-bank-statement-asynchronously/ + * @example + * veryfi_client.process_bank_statement_async('file/path') + * + * @memberof Client + * @param {String} file_path Path on disk to a file to submit + * @param {boolean} bounding_boxes Return bounding_box and bounding_region for extracted fields. + * @param {boolean} confidence_details Return score and ocr_score fields. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_bank_statement_async = async function ( + file_path, + bounding_boxes = false, + confidence_details = false, + {...kwargs} = {} +) { + let file = fs.createReadStream(file_path); + let file_name = path.basename(file_path); + return this.process_bank_statement_async_from_stream( + file, + file_name, + bounding_boxes, + confidence_details, + kwargs + ); +} diff --git a/lib/bankstatements/processBankStatementAsyncBase64.js b/lib/bankstatements/processBankStatementAsyncBase64.js new file mode 100644 index 0000000..58ab3d2 --- /dev/null +++ b/lib/bankstatements/processBankStatementAsyncBase64.js @@ -0,0 +1,30 @@ +const Client = require('../client/constructor'); +/** + * Process a bank statement asynchronously from a base64 string. https://docs.veryfi.com/api/bank-statements/process-a-bank-statement-asynchronously/ + * + * @memberof Client + * @param {String} file_name The file name including the extension + * @param {String} file_base64_string Base64-encoded file contents (raw or data URI) + * @param {boolean} bounding_boxes Return bounding_box and bounding_region for extracted fields. + * @param {boolean} confidence_details Return score and ocr_score fields. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_bank_statement_async_from_base64 = async function ( + file_name, + file_base64_string, + bounding_boxes = false, + confidence_details = false, + {...kwargs} = {} +) { + let endpoint_name = "/bank-statements/async/"; + let request_arguments = { + "file_name": file_name, + "file_data": file_base64_string, + "bounding_boxes": bounding_boxes, + "confidence_details": confidence_details, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/bankstatements/processBankStatementAsyncStream.js b/lib/bankstatements/processBankStatementAsyncStream.js new file mode 100644 index 0000000..c4ad433 --- /dev/null +++ b/lib/bankstatements/processBankStatementAsyncStream.js @@ -0,0 +1,30 @@ +const Client = require('../client/constructor'); +/** + * Process a bank statement asynchronously from a file stream. https://docs.veryfi.com/api/bank-statements/process-a-bank-statement-asynchronously/ + * + * @memberof Client + * @param {stream.Readable} file ReadStream of a file to submit + * @param {String} file_name The file name including the extension + * @param {boolean} bounding_boxes Return bounding_box and bounding_region for extracted fields. + * @param {boolean} confidence_details Return score and ocr_score fields. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_bank_statement_async_from_stream = async function ( + file, + file_name, + bounding_boxes = false, + confidence_details = false, + {...kwargs} = {} +) { + let endpoint_name = "/bank-statements/async/"; + let request_arguments = { + "file": file, + "file_name": file_name, + "bounding_boxes": bounding_boxes, + "confidence_details": confidence_details, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, true); + return response['data']; +} diff --git a/lib/bankstatements/processBankStatementAsyncUrl.js b/lib/bankstatements/processBankStatementAsyncUrl.js new file mode 100644 index 0000000..fbe9a34 --- /dev/null +++ b/lib/bankstatements/processBankStatementAsyncUrl.js @@ -0,0 +1,30 @@ +const Client = require('../client/constructor'); +/** + * Process a bank statement asynchronously from a URL. https://docs.veryfi.com/api/bank-statements/process-a-bank-statement-asynchronously/ + * + * @memberof Client + * @param {string|null} file_url Required if file_urls isn't specified. Publicly accessible URL to a file. + * @param {string[]} file_urls Required if file_url isn't specified. List of publicly accessible URLs. + * @param {boolean} bounding_boxes Return bounding_box and bounding_region for extracted fields. + * @param {boolean} confidence_details Return score and ocr_score fields. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_bank_statement_async_from_url = async function ( + file_url = null, + file_urls = null, + bounding_boxes = false, + confidence_details = false, + {...kwargs} = {} +) { + let endpoint_name = "/bank-statements/async/"; + let request_arguments = { + "file_url": file_url, + "file_urls": file_urls, + "bounding_boxes": bounding_boxes, + "confidence_details": confidence_details, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/bankstatements/splitBankStatements.js b/lib/bankstatements/splitBankStatements.js new file mode 100644 index 0000000..44de1a0 --- /dev/null +++ b/lib/bankstatements/splitBankStatements.js @@ -0,0 +1,25 @@ +const Client = require('../client/constructor'); +const path = require('path'); +const fs = require('fs'); +/** + * Split and process multiple bank statements. https://docs.veryfi.com/api/split-and-process-multiple-bank-statements/ + * @example + * veryfi_client.split_bank_statements('file/path') + * + * @memberof Client + * @param {String} file_path Path on disk to a file to submit + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.split_bank_statements = async function ( + file_path, + {...kwargs} = {} +) { + let file = fs.createReadStream(file_path); + let file_name = path.basename(file_path); + return this.split_bank_statements_from_stream( + file, + file_name, + kwargs + ); +} diff --git a/lib/bankstatements/splitBankStatementsBase64.js b/lib/bankstatements/splitBankStatementsBase64.js new file mode 100644 index 0000000..80da647 --- /dev/null +++ b/lib/bankstatements/splitBankStatementsBase64.js @@ -0,0 +1,24 @@ +const Client = require('../client/constructor'); +/** + * Split and process multiple bank statements from a base64 string. https://docs.veryfi.com/api/split-and-process-multiple-bank-statements/ + * + * @memberof Client + * @param {String} file_name The file name including the extension + * @param {String} file_base64_string Base64-encoded file contents (raw or data URI) + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.split_bank_statements_from_base64 = async function ( + file_name, + file_base64_string, + {...kwargs} = {} +) { + let endpoint_name = "/bank-statements-set/"; + let request_arguments = { + "file_name": file_name, + "file_data": file_base64_string, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/bankstatements/splitBankStatementsStream.js b/lib/bankstatements/splitBankStatementsStream.js new file mode 100644 index 0000000..4d512d5 --- /dev/null +++ b/lib/bankstatements/splitBankStatementsStream.js @@ -0,0 +1,24 @@ +const Client = require('../client/constructor'); +/** + * Split and process multiple bank statements from a file stream. https://docs.veryfi.com/api/split-and-process-multiple-bank-statements/ + * + * @memberof Client + * @param {stream.Readable} file ReadStream of a file to submit + * @param {String} file_name The file name including the extension + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.split_bank_statements_from_stream = async function ( + file, + file_name, + {...kwargs} = {} +) { + let endpoint_name = "/bank-statements-set/"; + let request_arguments = { + "file": file, + "file_name": file_name, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, true); + return response['data']; +} diff --git a/lib/bankstatements/splitBankStatementsUrl.js b/lib/bankstatements/splitBankStatementsUrl.js new file mode 100644 index 0000000..b4d4fce --- /dev/null +++ b/lib/bankstatements/splitBankStatementsUrl.js @@ -0,0 +1,24 @@ +const Client = require('../client/constructor'); +/** + * Split and process multiple bank statements from a URL. https://docs.veryfi.com/api/split-and-process-multiple-bank-statements/ + * + * @memberof Client + * @param {string|null} file_url Required if file_urls isn't specified. Publicly accessible URL to a file. + * @param {string[]} file_urls Required if file_url isn't specified. List of publicly accessible URLs. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.split_bank_statements_from_url = async function ( + file_url = null, + file_urls = null, + {...kwargs} = {} +) { + let endpoint_name = "/bank-statements-set/"; + let request_arguments = { + "file_url": file_url, + "file_urls": file_urls, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/bankstatements/tags/addBankStatementTag.js b/lib/bankstatements/tags/addBankStatementTag.js new file mode 100644 index 0000000..323f3b4 --- /dev/null +++ b/lib/bankstatements/tags/addBankStatementTag.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Add a tag to a bank statement. https://docs.veryfi.com/api/bank-statements/add-a-tag-to-a-bank-statement/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} tag Tag name to add + * @returns {JSON} Tag response + */ +Client.prototype.add_bank_statement_tag = async function (document_id, tag) { + let endpoint_name = `/bank-statements/${document_id}/tags/`; + let request_arguments = {"name": tag}; + let response = await this._request("PUT", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/bankstatements/tags/addBankStatementTags.js b/lib/bankstatements/tags/addBankStatementTags.js new file mode 100644 index 0000000..91899a2 --- /dev/null +++ b/lib/bankstatements/tags/addBankStatementTags.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Add tags to a bank statement. https://docs.veryfi.com/api/bank-statements/add-tags-to-a-bank-statement/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string[]} tags Tag names to add + * @returns {JSON} Tags response + */ +Client.prototype.add_bank_statement_tags = async function (document_id, tags) { + let endpoint_name = `/bank-statements/${document_id}/tags/`; + let request_arguments = {"tags": tags}; + let response = await this._request("POST", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/bankstatements/tags/deleteBankStatementTag.js b/lib/bankstatements/tags/deleteBankStatementTag.js new file mode 100644 index 0000000..e7d9f13 --- /dev/null +++ b/lib/bankstatements/tags/deleteBankStatementTag.js @@ -0,0 +1,13 @@ +const Client = require('../../client/constructor'); +/** + * Unlink a tag from a bank statement. https://docs.veryfi.com/api/bank-statements/unlink-a-tag-from-a-bank-statement/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} tag_id ID of the tag to unlink + * @returns {JSON} Delete response + */ +Client.prototype.delete_bank_statement_tag = async function (document_id, tag_id) { + let endpoint_name = `/bank-statements/${document_id}/tags/${tag_id}/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/bankstatements/tags/deleteBankStatementTags.js b/lib/bankstatements/tags/deleteBankStatementTags.js new file mode 100644 index 0000000..620f5a2 --- /dev/null +++ b/lib/bankstatements/tags/deleteBankStatementTags.js @@ -0,0 +1,12 @@ +const Client = require('../../client/constructor'); +/** + * Unlink all tags from a bank statement. https://docs.veryfi.com/api/bank-statements/unlink-all-tags-from-a-bank-statement/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @returns {JSON} Delete response + */ +Client.prototype.delete_bank_statement_tags = async function (document_id) { + let endpoint_name = `/bank-statements/${document_id}/tags/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/bankstatements/tags/getBankStatementTags.js b/lib/bankstatements/tags/getBankStatementTags.js new file mode 100644 index 0000000..6ebae6d --- /dev/null +++ b/lib/bankstatements/tags/getBankStatementTags.js @@ -0,0 +1,14 @@ +const Client = require('../../client/constructor'); +/** + * Get tags assigned to a bank statement. https://docs.veryfi.com/api/bank-statements/get-bank-statement-tags/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {Object} kwargs Additional request parameters + * @returns {JSON} List of tags + */ +Client.prototype.get_bank_statement_tags = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/bank-statements/${document_id}/tags/`; + let response = await this._request("GET", endpoint_name, {}, kwargs, false); + return response['data']; +} diff --git a/lib/bankstatements/updateBankStatement.js b/lib/bankstatements/updateBankStatement.js new file mode 100644 index 0000000..6d62919 --- /dev/null +++ b/lib/bankstatements/updateBankStatement.js @@ -0,0 +1,14 @@ +const Client = require('../client/constructor'); +/** + * Update a bank statement. https://docs.veryfi.com/api/bank-statements/update-a-bank-statement/ + * + * @memberof Client + * @param {string} document_id ID of the resource + * @param {Object} kwargs Fields to update + * @returns {JSON} Updated resource + */ +Client.prototype.update_bank_statement = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/bank-statements/${document_id}/`; + let response = await this._request("PUT", endpoint_name, kwargs); + return response['data']; +} diff --git a/lib/businesscards/getBusinessCard.js b/lib/businesscards/getBusinessCard.js index 2b62dd7..590d3a4 100644 --- a/lib/businesscards/getBusinessCard.js +++ b/lib/businesscards/getBusinessCard.js @@ -15,10 +15,10 @@ Client.prototype.get_business_card = async function ( {...kwargs} = {} ) { let endpoint_name = `/business-cards/${document_id}/`; - let request_arguments = { + let query = Object.assign({ "bounding_boxes": bounding_boxes, "confidence_details": confidence_details - }; - let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); + }, kwargs); + let document = await this._request("GET", endpoint_name, {}, query, false); return document['data']; } diff --git a/lib/businesscards/getBusinessCards.js b/lib/businesscards/getBusinessCards.js index 71f7758..48ea287 100644 --- a/lib/businesscards/getBusinessCards.js +++ b/lib/businesscards/getBusinessCards.js @@ -17,12 +17,12 @@ Client.prototype.get_business_cards = async function ( {...kwargs} = {} ) { let endpoint_name = `/business-cards/`; - let request_arguments = { + let query = Object.assign({ "page": page, "page_size": page_size, "bounding_boxes": bounding_boxes, "confidence_details": confidence_details - }; - let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); + }, kwargs); + let document = await this._request("GET", endpoint_name, {}, query, false); return document['data']; } diff --git a/lib/businesscards/tags/addBusinessCardTag.js b/lib/businesscards/tags/addBusinessCardTag.js new file mode 100644 index 0000000..3af27ae --- /dev/null +++ b/lib/businesscards/tags/addBusinessCardTag.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Add a tag to a business card. https://docs.veryfi.com/api/add-a-tag-to-a-business-card/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} tag Tag name to add + * @returns {JSON} Tag response + */ +Client.prototype.add_business_card_tag = async function (document_id, tag) { + let endpoint_name = `/business-cards/${document_id}/tags/`; + let request_arguments = {"name": tag}; + let response = await this._request("PUT", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/businesscards/tags/addBusinessCardTags.js b/lib/businesscards/tags/addBusinessCardTags.js new file mode 100644 index 0000000..7418e15 --- /dev/null +++ b/lib/businesscards/tags/addBusinessCardTags.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Add tags to a business card. https://docs.veryfi.com/api/add-tags-to-a-business-card/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string[]} tags Tag names to add + * @returns {JSON} Tags response + */ +Client.prototype.add_business_card_tags = async function (document_id, tags) { + let endpoint_name = `/business-cards/${document_id}/tags/`; + let request_arguments = {"tags": tags}; + let response = await this._request("POST", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/businesscards/tags/deleteBusinessCardTag.js b/lib/businesscards/tags/deleteBusinessCardTag.js new file mode 100644 index 0000000..842f745 --- /dev/null +++ b/lib/businesscards/tags/deleteBusinessCardTag.js @@ -0,0 +1,13 @@ +const Client = require('../../client/constructor'); +/** + * Unlink a tag from a business card. https://docs.veryfi.com/api/unlink-a-tag-from-a-business-card/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} tag_id ID of the tag to unlink + * @returns {JSON} Delete response + */ +Client.prototype.delete_business_card_tag = async function (document_id, tag_id) { + let endpoint_name = `/business-cards/${document_id}/tags/${tag_id}/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/businesscards/tags/deleteBusinessCardTags.js b/lib/businesscards/tags/deleteBusinessCardTags.js new file mode 100644 index 0000000..7915571 --- /dev/null +++ b/lib/businesscards/tags/deleteBusinessCardTags.js @@ -0,0 +1,12 @@ +const Client = require('../../client/constructor'); +/** + * Unlink all tags from a business card. https://docs.veryfi.com/api/unlink-all-tags-from-a-business-card/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @returns {JSON} Delete response + */ +Client.prototype.delete_business_card_tags = async function (document_id) { + let endpoint_name = `/business-cards/${document_id}/tags/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/businesscards/tags/getBusinessCardTags.js b/lib/businesscards/tags/getBusinessCardTags.js new file mode 100644 index 0000000..3d541bd --- /dev/null +++ b/lib/businesscards/tags/getBusinessCardTags.js @@ -0,0 +1,14 @@ +const Client = require('../../client/constructor'); +/** + * Get tags assigned to a business card. https://docs.veryfi.com/api/get-business-card-tags/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {Object} kwargs Additional request parameters + * @returns {JSON} List of tags + */ +Client.prototype.get_business_card_tags = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/business-cards/${document_id}/tags/`; + let response = await this._request("GET", endpoint_name, {}, kwargs, false); + return response['data']; +} diff --git a/lib/businesscards/updateBusinessCard.js b/lib/businesscards/updateBusinessCard.js new file mode 100644 index 0000000..4f83e50 --- /dev/null +++ b/lib/businesscards/updateBusinessCard.js @@ -0,0 +1,14 @@ +const Client = require('../client/constructor'); +/** + * Update a business card. https://docs.veryfi.com/api/business-cards/update-a-business-card/ + * + * @memberof Client + * @param {string} document_id ID of the resource + * @param {Object} kwargs Fields to update + * @returns {JSON} Updated resource + */ +Client.prototype.update_business_card = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/business-cards/${document_id}/`; + let response = await this._request("PUT", endpoint_name, kwargs); + return response['data']; +} diff --git a/lib/checks/getCheck.js b/lib/checks/getCheck.js index 0d3d075..2183a95 100644 --- a/lib/checks/getCheck.js +++ b/lib/checks/getCheck.js @@ -15,10 +15,10 @@ Client.prototype.get_check = async function ( {...kwargs} = {} ) { let endpoint_name = `/checks/${document_id}/`; - let request_arguments = { + let query = Object.assign({ "bounding_boxes": bounding_boxes, "confidence_details": confidence_details - }; - let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); + }, kwargs); + let document = await this._request("GET", endpoint_name, {}, query, false); return document['data']; } diff --git a/lib/checks/getChecks.js b/lib/checks/getChecks.js index 54f4da7..c90eb68 100644 --- a/lib/checks/getChecks.js +++ b/lib/checks/getChecks.js @@ -17,12 +17,12 @@ Client.prototype.get_checks = async function ( {...kwargs} = {} ) { let endpoint_name = `/checks/`; - let request_arguments = { + let query = Object.assign({ "page": page, "page_size": page_size, "bounding_boxes": bounding_boxes, "confidence_details": confidence_details - }; - let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); + }, kwargs); + let document = await this._request("GET", endpoint_name, {}, query, false); return document['data']; } diff --git a/lib/checks/processCheckAsync.js b/lib/checks/processCheckAsync.js new file mode 100644 index 0000000..c093de3 --- /dev/null +++ b/lib/checks/processCheckAsync.js @@ -0,0 +1,31 @@ +const Client = require('../client/constructor'); +const path = require('path'); +const fs = require('fs'); +/** + * Process a check asynchronously. https://docs.veryfi.com/api/checks/process-a-check-asynchronously/ + * @example + * veryfi_client.process_check_async('file/path') + * + * @memberof Client + * @param {String} file_path Path on disk to a file to submit + * @param {boolean} bounding_boxes Return bounding_box and bounding_region for extracted fields. + * @param {boolean} confidence_details Return score and ocr_score fields. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_check_async = async function ( + file_path, + bounding_boxes = false, + confidence_details = false, + {...kwargs} = {} +) { + let file = fs.createReadStream(file_path); + let file_name = path.basename(file_path); + return this.process_check_async_from_stream( + file, + file_name, + bounding_boxes, + confidence_details, + kwargs + ); +} diff --git a/lib/checks/processCheckAsyncBase64.js b/lib/checks/processCheckAsyncBase64.js new file mode 100644 index 0000000..96fe055 --- /dev/null +++ b/lib/checks/processCheckAsyncBase64.js @@ -0,0 +1,30 @@ +const Client = require('../client/constructor'); +/** + * Process a check asynchronously from a base64 string. https://docs.veryfi.com/api/checks/process-a-check-asynchronously/ + * + * @memberof Client + * @param {String} file_name The file name including the extension + * @param {String} file_base64_string Base64-encoded file contents (raw or data URI) + * @param {boolean} bounding_boxes Return bounding_box and bounding_region for extracted fields. + * @param {boolean} confidence_details Return score and ocr_score fields. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_check_async_from_base64 = async function ( + file_name, + file_base64_string, + bounding_boxes = false, + confidence_details = false, + {...kwargs} = {} +) { + let endpoint_name = "/checks/async/"; + let request_arguments = { + "file_name": file_name, + "file_data": file_base64_string, + "bounding_boxes": bounding_boxes, + "confidence_details": confidence_details, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/checks/processCheckAsyncStream.js b/lib/checks/processCheckAsyncStream.js new file mode 100644 index 0000000..820ddd5 --- /dev/null +++ b/lib/checks/processCheckAsyncStream.js @@ -0,0 +1,30 @@ +const Client = require('../client/constructor'); +/** + * Process a check asynchronously from a file stream. https://docs.veryfi.com/api/checks/process-a-check-asynchronously/ + * + * @memberof Client + * @param {stream.Readable} file ReadStream of a file to submit + * @param {String} file_name The file name including the extension + * @param {boolean} bounding_boxes Return bounding_box and bounding_region for extracted fields. + * @param {boolean} confidence_details Return score and ocr_score fields. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_check_async_from_stream = async function ( + file, + file_name, + bounding_boxes = false, + confidence_details = false, + {...kwargs} = {} +) { + let endpoint_name = "/checks/async/"; + let request_arguments = { + "file": file, + "file_name": file_name, + "bounding_boxes": bounding_boxes, + "confidence_details": confidence_details, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, true); + return response['data']; +} diff --git a/lib/checks/processCheckAsyncUrl.js b/lib/checks/processCheckAsyncUrl.js new file mode 100644 index 0000000..bc07076 --- /dev/null +++ b/lib/checks/processCheckAsyncUrl.js @@ -0,0 +1,30 @@ +const Client = require('../client/constructor'); +/** + * Process a check asynchronously from a URL. https://docs.veryfi.com/api/checks/process-a-check-asynchronously/ + * + * @memberof Client + * @param {string|null} file_url Required if file_urls isn't specified. Publicly accessible URL to a file. + * @param {string[]} file_urls Required if file_url isn't specified. List of publicly accessible URLs. + * @param {boolean} bounding_boxes Return bounding_box and bounding_region for extracted fields. + * @param {boolean} confidence_details Return score and ocr_score fields. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_check_async_from_url = async function ( + file_url = null, + file_urls = null, + bounding_boxes = false, + confidence_details = false, + {...kwargs} = {} +) { + let endpoint_name = "/checks/async/"; + let request_arguments = { + "file_url": file_url, + "file_urls": file_urls, + "bounding_boxes": bounding_boxes, + "confidence_details": confidence_details, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/checks/processCheckWithRemittance.js b/lib/checks/processCheckWithRemittance.js new file mode 100644 index 0000000..195058f --- /dev/null +++ b/lib/checks/processCheckWithRemittance.js @@ -0,0 +1,31 @@ +const Client = require('../client/constructor'); +const path = require('path'); +const fs = require('fs'); +/** + * Process a check with remittance. https://docs.veryfi.com/api/checks/process-a-check-with-remittance/ + * @example + * veryfi_client.process_check_with_remittance('file/path') + * + * @memberof Client + * @param {String} file_path Path on disk to a file to submit + * @param {boolean} bounding_boxes Return bounding_box and bounding_region for extracted fields. + * @param {boolean} confidence_details Return score and ocr_score fields. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_check_with_remittance = async function ( + file_path, + bounding_boxes = false, + confidence_details = false, + {...kwargs} = {} +) { + let file = fs.createReadStream(file_path); + let file_name = path.basename(file_path); + return this.process_check_with_remittance_from_stream( + file, + file_name, + bounding_boxes, + confidence_details, + kwargs + ); +} diff --git a/lib/checks/processCheckWithRemittanceBase64.js b/lib/checks/processCheckWithRemittanceBase64.js new file mode 100644 index 0000000..4bb17b0 --- /dev/null +++ b/lib/checks/processCheckWithRemittanceBase64.js @@ -0,0 +1,30 @@ +const Client = require('../client/constructor'); +/** + * Process a check with remittance from a base64 string. https://docs.veryfi.com/api/checks/process-a-check-with-remittance/ + * + * @memberof Client + * @param {String} file_name The file name including the extension + * @param {String} file_base64_string Base64-encoded file contents (raw or data URI) + * @param {boolean} bounding_boxes Return bounding_box and bounding_region for extracted fields. + * @param {boolean} confidence_details Return score and ocr_score fields. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_check_with_remittance_from_base64 = async function ( + file_name, + file_base64_string, + bounding_boxes = false, + confidence_details = false, + {...kwargs} = {} +) { + let endpoint_name = "/check-with-document/"; + let request_arguments = { + "file_name": file_name, + "file_data": file_base64_string, + "bounding_boxes": bounding_boxes, + "confidence_details": confidence_details, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/checks/processCheckWithRemittanceStream.js b/lib/checks/processCheckWithRemittanceStream.js new file mode 100644 index 0000000..695a016 --- /dev/null +++ b/lib/checks/processCheckWithRemittanceStream.js @@ -0,0 +1,30 @@ +const Client = require('../client/constructor'); +/** + * Process a check with remittance from a file stream. https://docs.veryfi.com/api/checks/process-a-check-with-remittance/ + * + * @memberof Client + * @param {stream.Readable} file ReadStream of a file to submit + * @param {String} file_name The file name including the extension + * @param {boolean} bounding_boxes Return bounding_box and bounding_region for extracted fields. + * @param {boolean} confidence_details Return score and ocr_score fields. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_check_with_remittance_from_stream = async function ( + file, + file_name, + bounding_boxes = false, + confidence_details = false, + {...kwargs} = {} +) { + let endpoint_name = "/check-with-document/"; + let request_arguments = { + "file": file, + "file_name": file_name, + "bounding_boxes": bounding_boxes, + "confidence_details": confidence_details, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, true); + return response['data']; +} diff --git a/lib/checks/processCheckWithRemittanceUrl.js b/lib/checks/processCheckWithRemittanceUrl.js new file mode 100644 index 0000000..40a42a7 --- /dev/null +++ b/lib/checks/processCheckWithRemittanceUrl.js @@ -0,0 +1,30 @@ +const Client = require('../client/constructor'); +/** + * Process a check with remittance from a URL. https://docs.veryfi.com/api/checks/process-a-check-with-remittance/ + * + * @memberof Client + * @param {string|null} file_url Required if file_urls isn't specified. Publicly accessible URL to a file. + * @param {string[]} file_urls Required if file_url isn't specified. List of publicly accessible URLs. + * @param {boolean} bounding_boxes Return bounding_box and bounding_region for extracted fields. + * @param {boolean} confidence_details Return score and ocr_score fields. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_check_with_remittance_from_url = async function ( + file_url = null, + file_urls = null, + bounding_boxes = false, + confidence_details = false, + {...kwargs} = {} +) { + let endpoint_name = "/check-with-document/"; + let request_arguments = { + "file_url": file_url, + "file_urls": file_urls, + "bounding_boxes": bounding_boxes, + "confidence_details": confidence_details, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/checks/tags/addCheckTag.js b/lib/checks/tags/addCheckTag.js new file mode 100644 index 0000000..0eee462 --- /dev/null +++ b/lib/checks/tags/addCheckTag.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Add a tag to a check. https://docs.veryfi.com/api/checks/add-a-tag-to-a-check/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} tag Tag name to add + * @returns {JSON} Tag response + */ +Client.prototype.add_check_tag = async function (document_id, tag) { + let endpoint_name = `/checks/${document_id}/tags/`; + let request_arguments = {"name": tag}; + let response = await this._request("PUT", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/checks/tags/addCheckTags.js b/lib/checks/tags/addCheckTags.js new file mode 100644 index 0000000..ec4e214 --- /dev/null +++ b/lib/checks/tags/addCheckTags.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Add tags to a check. https://docs.veryfi.com/api/checks/add-tags-to-a-check/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string[]} tags Tag names to add + * @returns {JSON} Tags response + */ +Client.prototype.add_check_tags = async function (document_id, tags) { + let endpoint_name = `/checks/${document_id}/tags/`; + let request_arguments = {"tags": tags}; + let response = await this._request("POST", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/checks/tags/deleteCheckTag.js b/lib/checks/tags/deleteCheckTag.js new file mode 100644 index 0000000..93ede01 --- /dev/null +++ b/lib/checks/tags/deleteCheckTag.js @@ -0,0 +1,13 @@ +const Client = require('../../client/constructor'); +/** + * Unlink a tag from a check. https://docs.veryfi.com/api/checks/unlink-a-tag-from-a-check/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} tag_id ID of the tag to unlink + * @returns {JSON} Delete response + */ +Client.prototype.delete_check_tag = async function (document_id, tag_id) { + let endpoint_name = `/checks/${document_id}/tags/${tag_id}/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/checks/tags/deleteCheckTags.js b/lib/checks/tags/deleteCheckTags.js new file mode 100644 index 0000000..354d6c5 --- /dev/null +++ b/lib/checks/tags/deleteCheckTags.js @@ -0,0 +1,12 @@ +const Client = require('../../client/constructor'); +/** + * Unlink all tags from a check. https://docs.veryfi.com/api/checks/unlink-all-tags-from-a-check/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @returns {JSON} Delete response + */ +Client.prototype.delete_check_tags = async function (document_id) { + let endpoint_name = `/checks/${document_id}/tags/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/checks/tags/getCheckTags.js b/lib/checks/tags/getCheckTags.js new file mode 100644 index 0000000..4ebf356 --- /dev/null +++ b/lib/checks/tags/getCheckTags.js @@ -0,0 +1,14 @@ +const Client = require('../../client/constructor'); +/** + * Get tags assigned to a check. https://docs.veryfi.com/api/checks/get-check-tags/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {Object} kwargs Additional request parameters + * @returns {JSON} List of tags + */ +Client.prototype.get_check_tags = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/checks/${document_id}/tags/`; + let response = await this._request("GET", endpoint_name, {}, kwargs, false); + return response['data']; +} diff --git a/lib/checks/updateCheck.js b/lib/checks/updateCheck.js new file mode 100644 index 0000000..8fc8689 --- /dev/null +++ b/lib/checks/updateCheck.js @@ -0,0 +1,14 @@ +const Client = require('../client/constructor'); +/** + * Update a check. https://docs.veryfi.com/api/checks/update-a-check/ + * + * @memberof Client + * @param {string} document_id ID of the resource + * @param {Object} kwargs Fields to update + * @returns {JSON} Updated resource + */ +Client.prototype.update_check = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/checks/${document_id}/`; + let response = await this._request("PUT", endpoint_name, kwargs); + return response['data']; +} diff --git a/lib/classify/classifyDocument.js b/lib/classify/classifyDocument.js new file mode 100644 index 0000000..c0ed50d --- /dev/null +++ b/lib/classify/classifyDocument.js @@ -0,0 +1,25 @@ +const Client = require('../client/constructor'); +const path = require('path'); +const fs = require('fs'); +/** + * Classify a document. https://docs.veryfi.com/api/classify/classify-a-document/ + * @example + * veryfi_client.classify_document('file/path') + * + * @memberof Client + * @param {String} file_path Path on disk to a file to submit + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.classify_document = async function ( + file_path, + {...kwargs} = {} +) { + let file = fs.createReadStream(file_path); + let file_name = path.basename(file_path); + return this.classify_document_from_stream( + file, + file_name, + kwargs + ); +} diff --git a/lib/classify/classifyDocumentBase64.js b/lib/classify/classifyDocumentBase64.js index 67f8801..e7d4748 100644 --- a/lib/classify/classifyDocumentBase64.js +++ b/lib/classify/classifyDocumentBase64.js @@ -1,6 +1,6 @@ const Client = require('../client/constructor'); /** - * Classify a document and extract all the fields from it. https://docs.veryfi.com/api/classify/classify-a-document/ + * Classify a document. https://docs.veryfi.com/api/classify/classify-a-document/ * @example * veryfi_client.classify_document_from_base64('base64_encoded_string', * 'receipt.png', @@ -9,8 +9,8 @@ const Client = require('../client/constructor'); * @memberof Client * @param {String} base64_encoded_string Buffer string of a file to submit for classify extraction * @param {String} file_name The file name including the extension - * @param {Object} kwargs Additional request parameters - * @returns {JSON} Data extracted from the document + * @param {Object} kwargs Additional request parameters (document_types, external_id, package_path, bucket) + * @returns {JSON} Document classification */ Client.prototype.classify_document_from_base64 = async function ( base64_encoded_string, diff --git a/lib/classify/classifyDocumentStream.js b/lib/classify/classifyDocumentStream.js new file mode 100644 index 0000000..0afc79d --- /dev/null +++ b/lib/classify/classifyDocumentStream.js @@ -0,0 +1,24 @@ +const Client = require('../client/constructor'); +/** + * Classify a document from a file stream. https://docs.veryfi.com/api/classify/classify-a-document/ + * + * @memberof Client + * @param {stream.Readable} file ReadStream of a file to submit + * @param {String} file_name The file name including the extension + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.classify_document_from_stream = async function ( + file, + file_name, + {...kwargs} = {} +) { + let endpoint_name = "/classify/"; + let request_arguments = { + "file": file, + "file_name": file_name, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, true); + return response['data']; +} diff --git a/lib/classify/classifyDocumentUrl.js b/lib/classify/classifyDocumentUrl.js index 64afb01..e95ff33 100644 --- a/lib/classify/classifyDocumentUrl.js +++ b/lib/classify/classifyDocumentUrl.js @@ -1,14 +1,14 @@ const Client = require('../client/constructor'); /** - * Classify document from url and extract all the fields from it. https://docs.veryfi.com/api/classify/classify-a-document/ + * Classify a document. https://docs.veryfi.com/api/classify/classify-a-document/ * @example * veryfi_client.classify_document_from_url('https://cdn.example.com/receipt.jpg') * * @memberof Client * @param {string|null} file_url Required if file_urls isn't specified. Publicly accessible URL to a file, e.g. "https://cdn.example.com/receipt.jpg". - * @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"] - * @param {Object} kwargs Additional request parameters - * @return {JSON} Data extracted from the document. + * @param {Array} file_urls Required if file_url isn't specified. List of publicly accessible URLs to multiple files. + * @param {Object} kwargs Additional request parameters (document_types, external_id, package_path, bucket) + * @return {JSON} Document classification */ Client.prototype.classify_document_from_url = async function ( file_url = null, diff --git a/lib/classify/extractDocument.js b/lib/classify/extractDocument.js new file mode 100644 index 0000000..cf0e1df --- /dev/null +++ b/lib/classify/extractDocument.js @@ -0,0 +1,28 @@ +const Client = require('../client/constructor'); +const path = require('path'); +const fs = require('fs'); +/** + * Classify and possibly extract data from a document. https://docs.veryfi.com/api/classify-and-possibly-extract-data-from-a-document/ + * @example + * veryfi_client.extract_document('file/path') + * + * @memberof Client + * @param {String} file_path Path on disk to a file to submit + * @param {string[]} document_types Required. Types to classify the document into (preset types or blueprint names). + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.extract_document = async function ( + file_path, + document_types, + {...kwargs} = {} +) { + let file = fs.createReadStream(file_path); + let file_name = path.basename(file_path); + return this.extract_document_from_stream( + file, + file_name, + document_types, + kwargs + ); +} diff --git a/lib/classify/extractDocumentBase64.js b/lib/classify/extractDocumentBase64.js new file mode 100644 index 0000000..4b3db0b --- /dev/null +++ b/lib/classify/extractDocumentBase64.js @@ -0,0 +1,27 @@ +const Client = require('../client/constructor'); +/** + * Classify and possibly extract data from a document from a base64 string. https://docs.veryfi.com/api/classify-and-possibly-extract-data-from-a-document/ + * + * @memberof Client + * @param {String} file_name The file name including the extension + * @param {String} file_base64_string Base64-encoded file contents (raw or data URI) + * @param {string[]} document_types Required. Types to classify the document into (preset types or blueprint names). + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.extract_document_from_base64 = async function ( + file_name, + file_base64_string, + document_types, + {...kwargs} = {} +) { + let endpoint_name = "/extract/"; + let request_arguments = { + "file_name": file_name, + "file_data": file_base64_string, + "document_types": document_types, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/classify/extractDocumentStream.js b/lib/classify/extractDocumentStream.js new file mode 100644 index 0000000..5df1548 --- /dev/null +++ b/lib/classify/extractDocumentStream.js @@ -0,0 +1,27 @@ +const Client = require('../client/constructor'); +/** + * Classify and possibly extract data from a document from a file stream. https://docs.veryfi.com/api/classify-and-possibly-extract-data-from-a-document/ + * + * @memberof Client + * @param {stream.Readable} file ReadStream of a file to submit + * @param {String} file_name The file name including the extension + * @param {string[]} document_types Required. Types to classify the document into (preset types or blueprint names). + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.extract_document_from_stream = async function ( + file, + file_name, + document_types, + {...kwargs} = {} +) { + let endpoint_name = "/extract/"; + let request_arguments = { + "file": file, + "file_name": file_name, + "document_types": document_types, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, true); + return response['data']; +} diff --git a/lib/classify/extractDocumentUrl.js b/lib/classify/extractDocumentUrl.js new file mode 100644 index 0000000..979167d --- /dev/null +++ b/lib/classify/extractDocumentUrl.js @@ -0,0 +1,27 @@ +const Client = require('../client/constructor'); +/** + * Classify and possibly extract data from a document from a URL. https://docs.veryfi.com/api/classify-and-possibly-extract-data-from-a-document/ + * + * @memberof Client + * @param {string|null} file_url Required if file_urls isn't specified. Publicly accessible URL to a file. + * @param {string[]} file_urls Required if file_url isn't specified. List of publicly accessible URLs. + * @param {string[]} document_types Required. Types to classify the document into (preset types or blueprint names). + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.extract_document_from_url = async function ( + file_url = null, + file_urls = null, + document_types, + {...kwargs} = {} +) { + let endpoint_name = "/extract/"; + let request_arguments = { + "file_url": file_url, + "file_urls": file_urls, + "document_types": document_types, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/client/client.js b/lib/client/client.js index caaeb71..5457054 100644 --- a/lib/client/client.js +++ b/lib/client/client.js @@ -4,17 +4,42 @@ require('../anydocs/deleteAnyDocumentTag'); require('../anydocs/getAnyDocument'); require('../anydocs/getAnyDocumentTags'); require('../anydocs/getAnyDocuments'); +require('../anydocs/getBlueprints'); require('../anydocs/processAnyDocument'); +require('../anydocs/processAnyDocumentAsync'); +require('../anydocs/processAnyDocumentAsyncBase64'); +require('../anydocs/processAnyDocumentAsyncStream'); +require('../anydocs/processAnyDocumentAsyncUrl'); require('../anydocs/processAnyDocumentBase64'); require('../anydocs/processAnyDocumentStream'); require('../anydocs/processAnyDocumentUrl'); +require('../anydocs/tags/addAnyDocumentTag'); +require('../anydocs/tags/addAnyDocumentTags'); +require('../anydocs/tags/deleteAnyDocumentTags'); +require('../anydocs/updateAnyDocument'); require('../bankstatements/deleteBankStatement'); require('../bankstatements/getBankStatement'); +require('../bankstatements/getBankStatementSet'); +require('../bankstatements/getBankStatementSets'); require('../bankstatements/getBankStatements'); require('../bankstatements/processBankStatement'); +require('../bankstatements/processBankStatementAsync'); +require('../bankstatements/processBankStatementAsyncBase64'); +require('../bankstatements/processBankStatementAsyncStream'); +require('../bankstatements/processBankStatementAsyncUrl'); require('../bankstatements/processBankStatementBase64'); require('../bankstatements/processBankStatementStream'); require('../bankstatements/processBankStatementUrl'); +require('../bankstatements/splitBankStatements'); +require('../bankstatements/splitBankStatementsBase64'); +require('../bankstatements/splitBankStatementsStream'); +require('../bankstatements/splitBankStatementsUrl'); +require('../bankstatements/tags/addBankStatementTag'); +require('../bankstatements/tags/addBankStatementTags'); +require('../bankstatements/tags/deleteBankStatementTag'); +require('../bankstatements/tags/deleteBankStatementTags'); +require('../bankstatements/tags/getBankStatementTags'); +require('../bankstatements/updateBankStatement'); require('../businesscards/deleteBusinessCard'); require('../businesscards/getBusinessCard'); require('../businesscards/getBusinessCards'); @@ -22,39 +47,147 @@ require('../businesscards/processBusinessCard'); require('../businesscards/processBusinessCardBase64'); require('../businesscards/processBusinessCardStream'); require('../businesscards/processBusinessCardUrl'); +require('../businesscards/tags/addBusinessCardTag'); +require('../businesscards/tags/addBusinessCardTags'); +require('../businesscards/tags/deleteBusinessCardTag'); +require('../businesscards/tags/deleteBusinessCardTags'); +require('../businesscards/tags/getBusinessCardTags'); +require('../businesscards/updateBusinessCard'); require('../checks/deleteCheck'); require('../checks/getCheck'); require('../checks/getChecks'); require('../checks/processCheck'); +require('../checks/processCheckAsync'); +require('../checks/processCheckAsyncBase64'); +require('../checks/processCheckAsyncStream'); +require('../checks/processCheckAsyncUrl'); require('../checks/processCheckBase64'); require('../checks/processCheckStream'); require('../checks/processCheckUrl'); +require('../checks/processCheckWithRemittance'); +require('../checks/processCheckWithRemittanceBase64'); +require('../checks/processCheckWithRemittanceStream'); +require('../checks/processCheckWithRemittanceUrl'); +require('../checks/tags/addCheckTag'); +require('../checks/tags/addCheckTags'); +require('../checks/tags/deleteCheckTag'); +require('../checks/tags/deleteCheckTags'); +require('../checks/tags/getCheckTags'); +require('../checks/updateCheck'); +require('../classify/classifyDocument'); require('../classify/classifyDocumentBase64'); +require('../classify/classifyDocumentStream'); require('../classify/classifyDocumentUrl'); +require('../classify/extractDocument'); +require('../classify/extractDocumentBase64'); +require('../classify/extractDocumentStream'); +require('../classify/extractDocumentUrl'); +require('../contracts/deleteContract'); +require('../contracts/getContract'); +require('../contracts/getContracts'); +require('../contracts/processContract'); +require('../contracts/processContractBase64'); +require('../contracts/processContractStream'); +require('../contracts/processContractUrl'); +require('../contracts/tags/addContractTag'); +require('../contracts/tags/addContractTags'); +require('../contracts/tags/deleteContractTag'); +require('../contracts/tags/deleteContractTags'); +require('../contracts/tags/getContractTags'); +require('../contracts/updateContract'); require('../documents/deleteDocument'); require('../documents/getDocument'); require('../documents/getDocuments'); +require('../documents/lineitems/createLineItem'); +require('../documents/lineitems/deleteDocumentLineItems'); +require('../documents/lineitems/deleteLineItem'); +require('../documents/lineitems/getDocumentLineItems'); +require('../documents/lineitems/getLineItem'); +require('../documents/lineitems/updateLineItem'); require('../documents/processDocument'); require('../documents/processDocumentBase64'); require('../documents/processDocumentStream'); require('../documents/processDocumentUrl'); -require('../documents/updateDocument'); -require('../documents/tags/addTags'); +require('../documents/processDocumentsBulk'); require('../documents/tags/addTag'); +require('../documents/tags/addTags'); require('../documents/tags/deleteTag'); require('../documents/tags/deleteTags'); +require('../documents/tags/getDocumentTags'); require('../documents/tags/replaceTags'); -require('../split/splitDocumentBase64'); -require('../split/splitDocumentUrl'); +require('../documents/taxlines/createTaxLine'); +require('../documents/taxlines/deleteTaxLine'); +require('../documents/taxlines/getTaxLine'); +require('../documents/taxlines/getTaxLines'); +require('../documents/taxlines/updateTaxLine'); +require('../documents/updateDocument'); +require('../fraud/addDevicesToBlocklist'); +require('../fraud/getFraudBlocklist'); +require('../fraud/removeDeviceFromBlocklist'); +require('../parse/deleteMarkdownDocument'); +require('../parse/getMarkdownDocument'); +require('../parse/getMarkdownDocumentSet'); +require('../parse/getMarkdownDocumentSets'); +require('../parse/getMarkdownDocuments'); +require('../parse/processMarkdownDocument'); +require('../parse/processMarkdownDocumentAsync'); +require('../parse/processMarkdownDocumentAsyncBase64'); +require('../parse/processMarkdownDocumentAsyncStream'); +require('../parse/processMarkdownDocumentAsyncUrl'); +require('../parse/processMarkdownDocumentBase64'); +require('../parse/processMarkdownDocumentSet'); +require('../parse/processMarkdownDocumentSetBase64'); +require('../parse/processMarkdownDocumentSetStream'); +require('../parse/processMarkdownDocumentSetUrl'); +require('../parse/processMarkdownDocumentStream'); +require('../parse/processMarkdownDocumentUrl'); +require('../parse/updateMarkdownDocument'); +require('../platform/getOcrCounts'); +require('../platform/getOpenApiSchema'); +require('../platform/getReleaseNotifications'); +require('../settings/addWebhook'); +require('../settings/confirmWebhook'); +require('../settings/createApiKey'); +require('../settings/createClientKeys'); +require('../settings/deleteClientKey'); +require('../settings/deleteTlsCertificate'); +require('../settings/getApiKey'); +require('../settings/getApiKeyPermissions'); +require('../settings/getApiKeys'); +require('../settings/getClientKeys'); +require('../settings/getTlsCertificates'); +require('../settings/getWebhooks'); +require('../settings/processTlsCertificate'); +require('../settings/resetClientKeys'); +require('../settings/revokeApiKey'); +require('../settings/rotateApiKey'); +require('../settings/updateApiKey'); +require('../settings/verifyApiKey'); require('../split/getSplitDocument'); require('../split/getSplitDocuments'); +require('../split/splitDocument'); +require('../split/splitDocumentBase64'); +require('../split/splitDocumentStream'); +require('../split/splitDocumentUrl'); require('../w2s/deleteW2'); require('../w2s/getW2'); +require('../w2s/getW2Set'); +require('../w2s/getW2Sets'); require('../w2s/getW2s'); require('../w2s/processW2'); require('../w2s/processW2Base64'); require('../w2s/processW2Stream'); require('../w2s/processW2Url'); +require('../w2s/splitW2s'); +require('../w2s/splitW2sBase64'); +require('../w2s/splitW2sStream'); +require('../w2s/splitW2sUrl'); +require('../w2s/tags/addW2Tag'); +require('../w2s/tags/addW2Tags'); +require('../w2s/tags/deleteW2Tag'); +require('../w2s/tags/deleteW2Tags'); +require('../w2s/tags/getW2Tags'); +require('../w2s/updateW2'); require('../w8bene/deleteW8BENE'); require('../w8bene/getW8BENE'); require('../w8bene/getW8BENEs'); @@ -62,6 +195,12 @@ require('../w8bene/processW8BENE'); require('../w8bene/processW8BENEBase64'); require('../w8bene/processW8BENEStream'); require('../w8bene/processW8BENEUrl'); +require('../w8bene/tags/addW8beneTag'); +require('../w8bene/tags/addW8beneTags'); +require('../w8bene/tags/deleteW8beneTag'); +require('../w8bene/tags/deleteW8beneTags'); +require('../w8bene/tags/getW8beneTags'); +require('../w8bene/updateW8BENE'); require('../w9s/deleteW9'); require('../w9s/getW9'); require('../w9s/getW9s'); @@ -69,4 +208,10 @@ require('../w9s/processW9'); require('../w9s/processW9Base64'); require('../w9s/processW9Stream'); require('../w9s/processW9Url'); +require('../w9s/tags/addW9Tag'); +require('../w9s/tags/addW9Tags'); +require('../w9s/tags/deleteW9Tag'); +require('../w9s/tags/deleteW9Tags'); +require('../w9s/tags/getW9Tags'); +require('../w9s/updateW9'); module.exports = Client; diff --git a/lib/client/request.js b/lib/client/request.js index fab9cf8..987b376 100644 --- a/lib/client/request.js +++ b/lib/client/request.js @@ -11,11 +11,16 @@ const {promisify} = require("util"); * @param {{}} request_arguments JSON payload to send to Veryfi * @param params {{}} query params. * @param {Boolean} has_files Are there any files to be submitted as binary + * @param {Object} options Optional request options + * @param {string} [options.api_version] Override the default API version (v8) + * @param {boolean} [options.skip_partner] Skip the /partner path segment (used by some v1 routes) * @returns {JSON} A JSON of the response data. */ -Client.prototype._request = async function (http_verb, endpoint_name, request_arguments, params = {}, has_files = false) { +Client.prototype._request = async function (http_verb, endpoint_name, request_arguments, params = {}, has_files = false, options = {}) { let headers = this._get_headers(has_files); - let api_url = `${this._get_url()}/partner${endpoint_name}`; + let api_version = (options && options.api_version) ? options.api_version : this.api_version; + let partner = (options && options.skip_partner) ? "" : "/partner"; + let api_url = `${this.base_url}api/${api_version}${partner}${endpoint_name}`; if (this.client_secret) { let timestamp = Date.now(); diff --git a/lib/contracts/deleteContract.js b/lib/contracts/deleteContract.js new file mode 100644 index 0000000..009d521 --- /dev/null +++ b/lib/contracts/deleteContract.js @@ -0,0 +1,12 @@ +const Client = require('../client/constructor'); +/** + * Delete a contract. https://docs.veryfi.com/api/contracts/delete-a-contract/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @returns {JSON} Delete response + */ +Client.prototype.delete_contract = async function (document_id) { + let endpoint_name = `/contracts/${document_id}/`; + return this._request("DELETE", endpoint_name, {"id": document_id}); +} diff --git a/lib/contracts/getContract.js b/lib/contracts/getContract.js new file mode 100644 index 0000000..5fcdded --- /dev/null +++ b/lib/contracts/getContract.js @@ -0,0 +1,18 @@ +const Client = require('../client/constructor'); +/** + * Get a contract. https://docs.veryfi.com/api/contracts/get-a-contract/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {Object} kwargs Additional request parameters + * @returns {JSON} Document data + */ +Client.prototype.get_contract = async function ( + document_id, + {...kwargs} = {} +) { + let endpoint_name = `/contracts/${document_id}/`; + let query = Object.assign({}, kwargs); + let response = await this._request("GET", endpoint_name, {}, query, false); + return response['data']; +} diff --git a/lib/contracts/getContracts.js b/lib/contracts/getContracts.js new file mode 100644 index 0000000..a718335 --- /dev/null +++ b/lib/contracts/getContracts.js @@ -0,0 +1,23 @@ +const Client = require('../client/constructor'); +/** + * Get contracts. https://docs.veryfi.com/api/contracts/get-contracts/ + * + * @memberof Client + * @param {number} page The page number. The response is capped to a maximum of 50 results per page. + * @param {number} page_size The number of documents per page. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} List of documents + */ +Client.prototype.get_contracts = async function ( + page = 1, + page_size = 50, + {...kwargs} = {} +) { + let endpoint_name = "/contracts/"; + let query = Object.assign({ + "page": page, + "page_size": page_size, + }, kwargs); + let response = await this._request("GET", endpoint_name, {}, query, false); + return response['data']; +} diff --git a/lib/contracts/processContract.js b/lib/contracts/processContract.js new file mode 100644 index 0000000..699fc6c --- /dev/null +++ b/lib/contracts/processContract.js @@ -0,0 +1,25 @@ +const Client = require('../client/constructor'); +const path = require('path'); +const fs = require('fs'); +/** + * Process a contract. https://docs.veryfi.com/api/contracts/process-a-contract/ + * @example + * veryfi_client.process_contract('file/path') + * + * @memberof Client + * @param {String} file_path Path on disk to a file to submit + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_contract = async function ( + file_path, + {...kwargs} = {} +) { + let file = fs.createReadStream(file_path); + let file_name = path.basename(file_path); + return this.process_contract_from_stream( + file, + file_name, + kwargs + ); +} diff --git a/lib/contracts/processContractBase64.js b/lib/contracts/processContractBase64.js new file mode 100644 index 0000000..1fc5fea --- /dev/null +++ b/lib/contracts/processContractBase64.js @@ -0,0 +1,24 @@ +const Client = require('../client/constructor'); +/** + * Process a contract from a base64 string. https://docs.veryfi.com/api/contracts/process-a-contract/ + * + * @memberof Client + * @param {String} file_name The file name including the extension + * @param {String} file_base64_string Base64-encoded file contents (raw or data URI) + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_contract_from_base64 = async function ( + file_name, + file_base64_string, + {...kwargs} = {} +) { + let endpoint_name = "/contracts/"; + let request_arguments = { + "file_name": file_name, + "file_data": file_base64_string, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/contracts/processContractStream.js b/lib/contracts/processContractStream.js new file mode 100644 index 0000000..dff7eb5 --- /dev/null +++ b/lib/contracts/processContractStream.js @@ -0,0 +1,24 @@ +const Client = require('../client/constructor'); +/** + * Process a contract from a file stream. https://docs.veryfi.com/api/contracts/process-a-contract/ + * + * @memberof Client + * @param {stream.Readable} file ReadStream of a file to submit + * @param {String} file_name The file name including the extension + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_contract_from_stream = async function ( + file, + file_name, + {...kwargs} = {} +) { + let endpoint_name = "/contracts/"; + let request_arguments = { + "file": file, + "file_name": file_name, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, true); + return response['data']; +} diff --git a/lib/contracts/processContractUrl.js b/lib/contracts/processContractUrl.js new file mode 100644 index 0000000..bdc138c --- /dev/null +++ b/lib/contracts/processContractUrl.js @@ -0,0 +1,24 @@ +const Client = require('../client/constructor'); +/** + * Process a contract from a URL. https://docs.veryfi.com/api/contracts/process-a-contract/ + * + * @memberof Client + * @param {string|null} file_url Required if file_urls isn't specified. Publicly accessible URL to a file. + * @param {string[]} file_urls Required if file_url isn't specified. List of publicly accessible URLs. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_contract_from_url = async function ( + file_url = null, + file_urls = null, + {...kwargs} = {} +) { + let endpoint_name = "/contracts/"; + let request_arguments = { + "file_url": file_url, + "file_urls": file_urls, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/contracts/tags/addContractTag.js b/lib/contracts/tags/addContractTag.js new file mode 100644 index 0000000..83155fd --- /dev/null +++ b/lib/contracts/tags/addContractTag.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Add a tag to a contract. https://docs.veryfi.com/api/add-a-tag-to-a-contract/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} tag Tag name to add + * @returns {JSON} Tag response + */ +Client.prototype.add_contract_tag = async function (document_id, tag) { + let endpoint_name = `/contracts/${document_id}/tags/`; + let request_arguments = {"name": tag}; + let response = await this._request("PUT", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/contracts/tags/addContractTags.js b/lib/contracts/tags/addContractTags.js new file mode 100644 index 0000000..7f9826b --- /dev/null +++ b/lib/contracts/tags/addContractTags.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Add tags to a contract. https://docs.veryfi.com/api/add-tags-to-a-contract/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string[]} tags Tag names to add + * @returns {JSON} Tags response + */ +Client.prototype.add_contract_tags = async function (document_id, tags) { + let endpoint_name = `/contracts/${document_id}/tags/`; + let request_arguments = {"tags": tags}; + let response = await this._request("POST", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/contracts/tags/deleteContractTag.js b/lib/contracts/tags/deleteContractTag.js new file mode 100644 index 0000000..3bdec1c --- /dev/null +++ b/lib/contracts/tags/deleteContractTag.js @@ -0,0 +1,13 @@ +const Client = require('../../client/constructor'); +/** + * Unlink a tag from a contract. https://docs.veryfi.com/api/unlink-a-tag-from-a-contract/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} tag_id ID of the tag to unlink + * @returns {JSON} Delete response + */ +Client.prototype.delete_contract_tag = async function (document_id, tag_id) { + let endpoint_name = `/contracts/${document_id}/tags/${tag_id}/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/contracts/tags/deleteContractTags.js b/lib/contracts/tags/deleteContractTags.js new file mode 100644 index 0000000..fa8fdfa --- /dev/null +++ b/lib/contracts/tags/deleteContractTags.js @@ -0,0 +1,12 @@ +const Client = require('../../client/constructor'); +/** + * Unlink all tags from a contract. https://docs.veryfi.com/api/unlink-all-tags-from-a-contract/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @returns {JSON} Delete response + */ +Client.prototype.delete_contract_tags = async function (document_id) { + let endpoint_name = `/contracts/${document_id}/tags/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/contracts/tags/getContractTags.js b/lib/contracts/tags/getContractTags.js new file mode 100644 index 0000000..5ea75cc --- /dev/null +++ b/lib/contracts/tags/getContractTags.js @@ -0,0 +1,14 @@ +const Client = require('../../client/constructor'); +/** + * Get tags assigned to a contract. https://docs.veryfi.com/api/get-contract-tags/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {Object} kwargs Additional request parameters + * @returns {JSON} List of tags + */ +Client.prototype.get_contract_tags = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/contracts/${document_id}/tags/`; + let response = await this._request("GET", endpoint_name, {}, kwargs, false); + return response['data']; +} diff --git a/lib/contracts/updateContract.js b/lib/contracts/updateContract.js new file mode 100644 index 0000000..560b438 --- /dev/null +++ b/lib/contracts/updateContract.js @@ -0,0 +1,14 @@ +const Client = require('../client/constructor'); +/** + * Update a contract. https://docs.veryfi.com/api/contracts/update-a-contract/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {Object} kwargs Fields to update + * @returns {JSON} Updated document + */ +Client.prototype.update_contract = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/contracts/${document_id}/`; + let response = await this._request("PUT", endpoint_name, kwargs); + return response['data']; +} diff --git a/lib/documents/getDocument.js b/lib/documents/getDocument.js index 116d965..d3e589e 100644 --- a/lib/documents/getDocument.js +++ b/lib/documents/getDocument.js @@ -8,7 +8,6 @@ const Client = require('../client/constructor'); */ Client.prototype.get_document = async function (document_id, {...kwargs} = {}) { let endpoint_name = `/documents/${document_id}/`; - let request_arguments = {"id": document_id}; - let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); + let document = await this._request("GET", endpoint_name, {}, kwargs, false); return document['data']; } diff --git a/lib/documents/getDocuments.js b/lib/documents/getDocuments.js index e250d2d..139491e 100644 --- a/lib/documents/getDocuments.js +++ b/lib/documents/getDocuments.js @@ -6,7 +6,7 @@ const Client = require('../client/constructor'); * @param {number} page_size The number of Documents per page. * @param {boolean} bounding_boxes A field used to determine whether to return bounding_box and bounding_region for extracted fields in the Document response. * @param {boolean} confidence_details A field used to determine whether to return the score and ocr_score fields in the Document response. - * @param {Object} kwargs Additional request parameters + * @param {Object} kwargs Additional request parameters (q, order_by, external_id, device_id, device_user_uuid, status, tag, owner, created__/updated__/date__ gt/lt/gte/lte, track_total_results, detailed) * @returns {JSON} JSON object of previously processed documents */ Client.prototype.get_documents = async function ( @@ -17,13 +17,13 @@ Client.prototype.get_documents = async function ( {...kwargs} = {} ) { let endpoint_name = "/documents/"; - let request_arguments = { + let query = Object.assign({ "page": page, "page_size": page_size, "bounding_boxes": bounding_boxes, - "confidence_details": confidence_details, - }; - let documents = await this._request("GET", endpoint_name, request_arguments, kwargs, false); + "confidence_details": confidence_details + }, kwargs); + let documents = await this._request("GET", endpoint_name, {}, query, false); if ("data" in documents) { documents = documents["data"]; } diff --git a/lib/documents/lineitems/createLineItem.js b/lib/documents/lineitems/createLineItem.js new file mode 100644 index 0000000..a481026 --- /dev/null +++ b/lib/documents/lineitems/createLineItem.js @@ -0,0 +1,14 @@ +const Client = require('../../client/constructor'); +/** + * Create a line item. https://docs.veryfi.com/api/receipts-invoices/create-a-line-item/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {Object} kwargs Line item fields (description, total, sku, quantity, etc.) + * @returns {JSON} Created line item + */ +Client.prototype.create_line_item = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/documents/${document_id}/line-items/`; + let response = await this._request("POST", endpoint_name, kwargs); + return response['data']; +} diff --git a/lib/documents/lineitems/deleteDocumentLineItems.js b/lib/documents/lineitems/deleteDocumentLineItems.js new file mode 100644 index 0000000..6ee5c55 --- /dev/null +++ b/lib/documents/lineitems/deleteDocumentLineItems.js @@ -0,0 +1,12 @@ +const Client = require('../../client/constructor'); +/** + * Delete all document line items. https://docs.veryfi.com/api/receipts-invoices/delete-all-document-line-items/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @returns {JSON} Delete response + */ +Client.prototype.delete_document_line_items = async function (document_id) { + let endpoint_name = `/documents/${document_id}/line-items/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/documents/lineitems/deleteLineItem.js b/lib/documents/lineitems/deleteLineItem.js new file mode 100644 index 0000000..6a31d4f --- /dev/null +++ b/lib/documents/lineitems/deleteLineItem.js @@ -0,0 +1,13 @@ +const Client = require('../../client/constructor'); +/** + * Delete a line item. https://docs.veryfi.com/api/receipts-invoices/delete-a-line-item/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} line_item_id ID of the line item + * @returns {JSON} Delete response + */ +Client.prototype.delete_line_item = async function (document_id, line_item_id) { + let endpoint_name = `/documents/${document_id}/line-items/${line_item_id}/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/documents/lineitems/getDocumentLineItems.js b/lib/documents/lineitems/getDocumentLineItems.js new file mode 100644 index 0000000..0977a51 --- /dev/null +++ b/lib/documents/lineitems/getDocumentLineItems.js @@ -0,0 +1,14 @@ +const Client = require('../../client/constructor'); +/** + * Get document line items. https://docs.veryfi.com/api/receipts-invoices/get-document-line-items/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {Object} kwargs Additional request parameters + * @returns {JSON} Line items + */ +Client.prototype.get_document_line_items = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/documents/${document_id}/line-items/`; + let response = await this._request("GET", endpoint_name, {}, kwargs, false); + return response['data']; +} diff --git a/lib/documents/lineitems/getLineItem.js b/lib/documents/lineitems/getLineItem.js new file mode 100644 index 0000000..83e8f87 --- /dev/null +++ b/lib/documents/lineitems/getLineItem.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Get a line item. https://docs.veryfi.com/api/receipts-invoices/get-a-line-item/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} line_item_id ID of the line item + * @param {Object} kwargs Additional request parameters + * @returns {JSON} Line item + */ +Client.prototype.get_line_item = async function (document_id, line_item_id, {...kwargs} = {}) { + let endpoint_name = `/documents/${document_id}/line-items/${line_item_id}/`; + let response = await this._request("GET", endpoint_name, {}, kwargs, false); + return response['data']; +} diff --git a/lib/documents/lineitems/updateLineItem.js b/lib/documents/lineitems/updateLineItem.js new file mode 100644 index 0000000..a5aeb5e --- /dev/null +++ b/lib/documents/lineitems/updateLineItem.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Update a line item. https://docs.veryfi.com/api/receipts-invoices/update-a-line-item/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} line_item_id ID of the line item + * @param {Object} kwargs Fields to update + * @returns {JSON} Updated line item + */ +Client.prototype.update_line_item = async function (document_id, line_item_id, {...kwargs} = {}) { + let endpoint_name = `/documents/${document_id}/line-items/${line_item_id}/`; + let response = await this._request("PUT", endpoint_name, kwargs); + return response['data']; +} diff --git a/lib/documents/processDocument.js b/lib/documents/processDocument.js index 3ed2461..09242e0 100644 --- a/lib/documents/processDocument.js +++ b/lib/documents/processDocument.js @@ -26,6 +26,9 @@ Client.prototype.process_document = async function ( let file = fs.createReadStream(file_path); let file_name = path.basename(file_path); + if (categories != null) { + kwargs = Object.assign({categories: categories}, kwargs); + } return this.process_document_from_stream( file, file_name, diff --git a/lib/documents/processDocumentStream.js b/lib/documents/processDocumentStream.js index 996093b..d02219d 100644 --- a/lib/documents/processDocumentStream.js +++ b/lib/documents/processDocumentStream.js @@ -12,7 +12,7 @@ const Client = require('../client/constructor'); * @param {stream.Readable} file ReadStream of a file to submit for data extraction * @param {String} file_name The file name including the extension * @param {Boolean} auto_delete Delete this document from Veryfi after data has been extracted - * @param {Object} kwargs Additional request parameters + * @param {Object} kwargs Additional request parameters (categories, tags, async, parse_address, crop_document, compute, country, document_type, device_data, package_path, bucket, bounding_boxes, confidence_details) * @returns {JSON} Data extracted from the document */ Client.prototype.process_document_from_stream = async function ( diff --git a/lib/documents/processDocumentUrl.js b/lib/documents/processDocumentUrl.js index e861144..a96b5e5 100644 --- a/lib/documents/processDocumentUrl.js +++ b/lib/documents/processDocumentUrl.js @@ -12,7 +12,7 @@ const Client = require('../client/constructor'); * @param {boolean} 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 * @param {string|null} external_id Optional custom document identifier. Use this if you would like to assign your own ID to documents * @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. - * @param {Object} kwargs Additional request parameters + * @param {Object} kwargs Additional request parameters (async, tags, parse_address, crop_document, compute, country, document_type, device_data, package_path, bucket, bounding_boxes, confidence_details, thinking, thinking_llm_version, allowed_async_enrichments, emailed_receipt_id, receipt_id) * @return {JSON} Data extracted from the document. */ Client.prototype.process_document_from_url = async function ( diff --git a/lib/documents/processDocumentsBulk.js b/lib/documents/processDocumentsBulk.js new file mode 100644 index 0000000..2300f29 --- /dev/null +++ b/lib/documents/processDocumentsBulk.js @@ -0,0 +1,15 @@ +const Client = require('../client/constructor'); +/** + * Bulk process multiple documents. https://docs.veryfi.com/api/receipts-invoices/bulk-process-multiple-documents/ + * + * @memberof Client + * @param {string[]} file_urls Required. Array of publicly accessible document URLs (1-100). + * @param {Object} kwargs Additional request parameters + * @returns {JSON} List of document ids being processed + */ +Client.prototype.process_documents_bulk = async function (file_urls, {...kwargs} = {}) { + let endpoint_name = "/documents/bulk/"; + let request_arguments = Object.assign({ "file_urls": file_urls }, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/documents/tags/getDocumentTags.js b/lib/documents/tags/getDocumentTags.js new file mode 100644 index 0000000..8cc74d1 --- /dev/null +++ b/lib/documents/tags/getDocumentTags.js @@ -0,0 +1,14 @@ +const Client = require('../../client/constructor'); +/** + * Get document tags. https://docs.veryfi.com/api/receipts-invoices/get-document-tags/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {Object} kwargs Additional request parameters + * @returns {JSON} List of tags + */ +Client.prototype.get_document_tags = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/documents/${document_id}/tags/`; + let response = await this._request("GET", endpoint_name, {}, kwargs, false); + return response['data']; +} diff --git a/lib/documents/taxlines/createTaxLine.js b/lib/documents/taxlines/createTaxLine.js new file mode 100644 index 0000000..3e4f05f --- /dev/null +++ b/lib/documents/taxlines/createTaxLine.js @@ -0,0 +1,14 @@ +const Client = require('../../client/constructor'); +/** + * Create a tax line. https://docs.veryfi.com/api/create-a-tax-line/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {Object} kwargs Tax line fields + * @returns {JSON} Created tax line + */ +Client.prototype.create_tax_line = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/documents/${document_id}/tax-lines/`; + let response = await this._request("POST", endpoint_name, kwargs); + return response['data']; +} diff --git a/lib/documents/taxlines/deleteTaxLine.js b/lib/documents/taxlines/deleteTaxLine.js new file mode 100644 index 0000000..161ee67 --- /dev/null +++ b/lib/documents/taxlines/deleteTaxLine.js @@ -0,0 +1,13 @@ +const Client = require('../../client/constructor'); +/** + * Delete a tax line. https://docs.veryfi.com/api/delete-a-tax-line/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} tax_line_id ID of the tax line + * @returns {JSON} Delete response + */ +Client.prototype.delete_tax_line = async function (document_id, tax_line_id) { + let endpoint_name = `/documents/${document_id}/tax-lines/${tax_line_id}/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/documents/taxlines/getTaxLine.js b/lib/documents/taxlines/getTaxLine.js new file mode 100644 index 0000000..6c0a0ce --- /dev/null +++ b/lib/documents/taxlines/getTaxLine.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Get a document tax line. https://docs.veryfi.com/api/returns-document-tax-line/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} tax_line_id ID of the tax line + * @param {Object} kwargs Additional request parameters + * @returns {JSON} Tax line + */ +Client.prototype.get_tax_line = async function (document_id, tax_line_id, {...kwargs} = {}) { + let endpoint_name = `/documents/${document_id}/tax-lines/${tax_line_id}/`; + let response = await this._request("GET", endpoint_name, {}, kwargs, false); + return response['data']; +} diff --git a/lib/documents/taxlines/getTaxLines.js b/lib/documents/taxlines/getTaxLines.js new file mode 100644 index 0000000..9b739cc --- /dev/null +++ b/lib/documents/taxlines/getTaxLines.js @@ -0,0 +1,14 @@ +const Client = require('../../client/constructor'); +/** + * Get document tax lines. https://docs.veryfi.com/api/returns-a-list-of-document-tax-lines/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {Object} kwargs Additional request parameters + * @returns {JSON} Tax lines + */ +Client.prototype.get_tax_lines = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/documents/${document_id}/tax-lines/`; + let response = await this._request("GET", endpoint_name, {}, kwargs, false); + return response['data']; +} diff --git a/lib/documents/taxlines/updateTaxLine.js b/lib/documents/taxlines/updateTaxLine.js new file mode 100644 index 0000000..461a16b --- /dev/null +++ b/lib/documents/taxlines/updateTaxLine.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Update a tax line. https://docs.veryfi.com/api/update-a-tax-line/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} tax_line_id ID of the tax line + * @param {Object} kwargs Fields to update + * @returns {JSON} Updated tax line + */ +Client.prototype.update_tax_line = async function (document_id, tax_line_id, {...kwargs} = {}) { + let endpoint_name = `/documents/${document_id}/tax-lines/${tax_line_id}/`; + let response = await this._request("PUT", endpoint_name, kwargs); + return response['data']; +} diff --git a/lib/fraud/addDevicesToBlocklist.js b/lib/fraud/addDevicesToBlocklist.js new file mode 100644 index 0000000..b5e9d34 --- /dev/null +++ b/lib/fraud/addDevicesToBlocklist.js @@ -0,0 +1,20 @@ +const Client = require('../client/constructor'); +/** + * Add devices to blocklist. https://docs.veryfi.com/api/add-devices-to-blocklist/ + * + * @memberof Client + * @param {string[]} device_ids Device IDs to block + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.add_devices_to_blocklist = async function ( + device_ids, + {...kwargs} = {} +) { + let endpoint_name = "/fraud/blocklist/"; + let request_arguments = Object.assign({ + "device_ids": device_ids, + }, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/fraud/getFraudBlocklist.js b/lib/fraud/getFraudBlocklist.js new file mode 100644 index 0000000..9b0c2eb --- /dev/null +++ b/lib/fraud/getFraudBlocklist.js @@ -0,0 +1,17 @@ +const Client = require('../client/constructor'); +/** + * Get devices from blocklist. https://docs.veryfi.com/api/get-devices-from-blocklist/ + * + * @memberof Client + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.get_fraud_blocklist = async function ( + {...kwargs} = {} +) { + let endpoint_name = "/fraud/blocklist/"; + let query = Object.assign({ + }, kwargs); + let response = await this._request("GET", endpoint_name, {}, query, false); + return response['data']; +} diff --git a/lib/fraud/removeDeviceFromBlocklist.js b/lib/fraud/removeDeviceFromBlocklist.js new file mode 100644 index 0000000..5568ab7 --- /dev/null +++ b/lib/fraud/removeDeviceFromBlocklist.js @@ -0,0 +1,12 @@ +const Client = require('../client/constructor'); +/** + * Remove a device from blocklist. https://docs.veryfi.com/api/remove-a-device-from-blocklist/ + * + * @memberof Client + * @param {string} device_id ID of the resource + * @returns {JSON} Delete response + */ +Client.prototype.remove_device_from_blocklist = async function (device_id) { + let endpoint_name = `/fraud/blocklist/${device_id}/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/parse/deleteMarkdownDocument.js b/lib/parse/deleteMarkdownDocument.js new file mode 100644 index 0000000..ebedcaf --- /dev/null +++ b/lib/parse/deleteMarkdownDocument.js @@ -0,0 +1,12 @@ +const Client = require('../client/constructor'); +/** + * Delete a Markdown Document. https://docs.veryfi.com/api/parse/delete-a-markdown-document/ + * + * @memberof Client + * @param {string} document_id ID of the resource + * @returns {JSON} Delete response + */ +Client.prototype.delete_markdown_document = async function (document_id) { + let endpoint_name = `/parse/${document_id}/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/parse/getMarkdownDocument.js b/lib/parse/getMarkdownDocument.js new file mode 100644 index 0000000..670455a --- /dev/null +++ b/lib/parse/getMarkdownDocument.js @@ -0,0 +1,14 @@ +const Client = require('../client/constructor'); +/** + * Get a Markdown Document. https://docs.veryfi.com/api/parse/get-a-markdown-document/ + * + * @memberof Client + * @param {string} document_id ID of the resource + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.get_markdown_document = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/parse/${document_id}/`; + let response = await this._request("GET", endpoint_name, {}, kwargs, false); + return response['data']; +} diff --git a/lib/parse/getMarkdownDocumentSet.js b/lib/parse/getMarkdownDocumentSet.js new file mode 100644 index 0000000..de94b79 --- /dev/null +++ b/lib/parse/getMarkdownDocumentSet.js @@ -0,0 +1,14 @@ +const Client = require('../client/constructor'); +/** + * Get a Markdown Document Set. https://docs.veryfi.com/api/parse/get-a-markdown-document-set/ + * + * @memberof Client + * @param {string} document_id ID of the resource + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.get_markdown_document_set = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/parse-set/${document_id}/`; + let response = await this._request("GET", endpoint_name, {}, kwargs, false); + return response['data']; +} diff --git a/lib/parse/getMarkdownDocumentSets.js b/lib/parse/getMarkdownDocumentSets.js new file mode 100644 index 0000000..b786e91 --- /dev/null +++ b/lib/parse/getMarkdownDocumentSets.js @@ -0,0 +1,23 @@ +const Client = require('../client/constructor'); +/** + * Get Markdown Document Sets. https://docs.veryfi.com/api/parse/get-markdown-document-sets/ + * + * @memberof Client + * @param {number} page Page number + * @param {number} page_size Results per page + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.get_markdown_document_sets = async function ( + page = 1, + page_size = 50, + {...kwargs} = {} +) { + let endpoint_name = "/parse-set/"; + let query = Object.assign({ + "page": page, + "page_size": page_size, + }, kwargs); + let response = await this._request("GET", endpoint_name, {}, query, false); + return response['data']; +} diff --git a/lib/parse/getMarkdownDocuments.js b/lib/parse/getMarkdownDocuments.js new file mode 100644 index 0000000..d9f6ecd --- /dev/null +++ b/lib/parse/getMarkdownDocuments.js @@ -0,0 +1,23 @@ +const Client = require('../client/constructor'); +/** + * Get Markdown Documents. https://docs.veryfi.com/api/parse/get-markdown-documents/ + * + * @memberof Client + * @param {number} page Page number + * @param {number} page_size Results per page + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.get_markdown_documents = async function ( + page = 1, + page_size = 50, + {...kwargs} = {} +) { + let endpoint_name = "/parse/"; + let query = Object.assign({ + "page": page, + "page_size": page_size, + }, kwargs); + let response = await this._request("GET", endpoint_name, {}, query, false); + return response['data']; +} diff --git a/lib/parse/processMarkdownDocument.js b/lib/parse/processMarkdownDocument.js new file mode 100644 index 0000000..0390f97 --- /dev/null +++ b/lib/parse/processMarkdownDocument.js @@ -0,0 +1,25 @@ +const Client = require('../client/constructor'); +const path = require('path'); +const fs = require('fs'); +/** + * Convert a document to markdown. https://docs.veryfi.com/api/parse/convert-a-document-to-markdown/ + * @example + * veryfi_client.process_markdown_document('file/path') + * + * @memberof Client + * @param {String} file_path Path on disk to a file to submit + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_markdown_document = async function ( + file_path, + {...kwargs} = {} +) { + let file = fs.createReadStream(file_path); + let file_name = path.basename(file_path); + return this.process_markdown_document_from_stream( + file, + file_name, + kwargs + ); +} diff --git a/lib/parse/processMarkdownDocumentAsync.js b/lib/parse/processMarkdownDocumentAsync.js new file mode 100644 index 0000000..6178a93 --- /dev/null +++ b/lib/parse/processMarkdownDocumentAsync.js @@ -0,0 +1,25 @@ +const Client = require('../client/constructor'); +const path = require('path'); +const fs = require('fs'); +/** + * Process a markdown document asynchronously. https://docs.veryfi.com/api/parse/process-a-markdown-document-asynchronously/ + * @example + * veryfi_client.process_markdown_document_async('file/path') + * + * @memberof Client + * @param {String} file_path Path on disk to a file to submit + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_markdown_document_async = async function ( + file_path, + {...kwargs} = {} +) { + let file = fs.createReadStream(file_path); + let file_name = path.basename(file_path); + return this.process_markdown_document_async_from_stream( + file, + file_name, + kwargs + ); +} diff --git a/lib/parse/processMarkdownDocumentAsyncBase64.js b/lib/parse/processMarkdownDocumentAsyncBase64.js new file mode 100644 index 0000000..dd1b385 --- /dev/null +++ b/lib/parse/processMarkdownDocumentAsyncBase64.js @@ -0,0 +1,24 @@ +const Client = require('../client/constructor'); +/** + * Process a markdown document asynchronously from a base64 string. https://docs.veryfi.com/api/parse/process-a-markdown-document-asynchronously/ + * + * @memberof Client + * @param {String} file_name The file name including the extension + * @param {String} file_base64_string Base64-encoded file contents (raw or data URI) + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_markdown_document_async_from_base64 = async function ( + file_name, + file_base64_string, + {...kwargs} = {} +) { + let endpoint_name = "/parse/async/"; + let request_arguments = { + "file_name": file_name, + "file_data": file_base64_string, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/parse/processMarkdownDocumentAsyncStream.js b/lib/parse/processMarkdownDocumentAsyncStream.js new file mode 100644 index 0000000..a7a8238 --- /dev/null +++ b/lib/parse/processMarkdownDocumentAsyncStream.js @@ -0,0 +1,24 @@ +const Client = require('../client/constructor'); +/** + * Process a markdown document asynchronously from a file stream. https://docs.veryfi.com/api/parse/process-a-markdown-document-asynchronously/ + * + * @memberof Client + * @param {stream.Readable} file ReadStream of a file to submit + * @param {String} file_name The file name including the extension + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_markdown_document_async_from_stream = async function ( + file, + file_name, + {...kwargs} = {} +) { + let endpoint_name = "/parse/async/"; + let request_arguments = { + "file": file, + "file_name": file_name, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, true); + return response['data']; +} diff --git a/lib/parse/processMarkdownDocumentAsyncUrl.js b/lib/parse/processMarkdownDocumentAsyncUrl.js new file mode 100644 index 0000000..18545e3 --- /dev/null +++ b/lib/parse/processMarkdownDocumentAsyncUrl.js @@ -0,0 +1,24 @@ +const Client = require('../client/constructor'); +/** + * Process a markdown document asynchronously from a URL. https://docs.veryfi.com/api/parse/process-a-markdown-document-asynchronously/ + * + * @memberof Client + * @param {string|null} file_url Required if file_urls isn't specified. Publicly accessible URL to a file. + * @param {string[]} file_urls Required if file_url isn't specified. List of publicly accessible URLs. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_markdown_document_async_from_url = async function ( + file_url = null, + file_urls = null, + {...kwargs} = {} +) { + let endpoint_name = "/parse/async/"; + let request_arguments = { + "file_url": file_url, + "file_urls": file_urls, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/parse/processMarkdownDocumentBase64.js b/lib/parse/processMarkdownDocumentBase64.js new file mode 100644 index 0000000..d2cdb2b --- /dev/null +++ b/lib/parse/processMarkdownDocumentBase64.js @@ -0,0 +1,24 @@ +const Client = require('../client/constructor'); +/** + * Convert a document to markdown from a base64 string. https://docs.veryfi.com/api/parse/convert-a-document-to-markdown/ + * + * @memberof Client + * @param {String} file_name The file name including the extension + * @param {String} file_base64_string Base64-encoded file contents (raw or data URI) + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_markdown_document_from_base64 = async function ( + file_name, + file_base64_string, + {...kwargs} = {} +) { + let endpoint_name = "/parse/"; + let request_arguments = { + "file_name": file_name, + "file_data": file_base64_string, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/parse/processMarkdownDocumentSet.js b/lib/parse/processMarkdownDocumentSet.js new file mode 100644 index 0000000..5e03b29 --- /dev/null +++ b/lib/parse/processMarkdownDocumentSet.js @@ -0,0 +1,25 @@ +const Client = require('../client/constructor'); +const path = require('path'); +const fs = require('fs'); +/** + * Process a markdown document set. https://docs.veryfi.com/api/parse/process-a-markdown-document-set/ + * @example + * veryfi_client.process_markdown_document_set('file/path') + * + * @memberof Client + * @param {String} file_path Path on disk to a file to submit + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_markdown_document_set = async function ( + file_path, + {...kwargs} = {} +) { + let file = fs.createReadStream(file_path); + let file_name = path.basename(file_path); + return this.process_markdown_document_set_from_stream( + file, + file_name, + kwargs + ); +} diff --git a/lib/parse/processMarkdownDocumentSetBase64.js b/lib/parse/processMarkdownDocumentSetBase64.js new file mode 100644 index 0000000..9cc5dc2 --- /dev/null +++ b/lib/parse/processMarkdownDocumentSetBase64.js @@ -0,0 +1,24 @@ +const Client = require('../client/constructor'); +/** + * Process a markdown document set from a base64 string. https://docs.veryfi.com/api/parse/process-a-markdown-document-set/ + * + * @memberof Client + * @param {String} file_name The file name including the extension + * @param {String} file_base64_string Base64-encoded file contents (raw or data URI) + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_markdown_document_set_from_base64 = async function ( + file_name, + file_base64_string, + {...kwargs} = {} +) { + let endpoint_name = "/parse-set/"; + let request_arguments = { + "file_name": file_name, + "file_data": file_base64_string, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/parse/processMarkdownDocumentSetStream.js b/lib/parse/processMarkdownDocumentSetStream.js new file mode 100644 index 0000000..c48476d --- /dev/null +++ b/lib/parse/processMarkdownDocumentSetStream.js @@ -0,0 +1,24 @@ +const Client = require('../client/constructor'); +/** + * Process a markdown document set from a file stream. https://docs.veryfi.com/api/parse/process-a-markdown-document-set/ + * + * @memberof Client + * @param {stream.Readable} file ReadStream of a file to submit + * @param {String} file_name The file name including the extension + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_markdown_document_set_from_stream = async function ( + file, + file_name, + {...kwargs} = {} +) { + let endpoint_name = "/parse-set/"; + let request_arguments = { + "file": file, + "file_name": file_name, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, true); + return response['data']; +} diff --git a/lib/parse/processMarkdownDocumentSetUrl.js b/lib/parse/processMarkdownDocumentSetUrl.js new file mode 100644 index 0000000..c53236d --- /dev/null +++ b/lib/parse/processMarkdownDocumentSetUrl.js @@ -0,0 +1,24 @@ +const Client = require('../client/constructor'); +/** + * Process a markdown document set from a URL. https://docs.veryfi.com/api/parse/process-a-markdown-document-set/ + * + * @memberof Client + * @param {string|null} file_url Required if file_urls isn't specified. Publicly accessible URL to a file. + * @param {string[]} file_urls Required if file_url isn't specified. List of publicly accessible URLs. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_markdown_document_set_from_url = async function ( + file_url = null, + file_urls = null, + {...kwargs} = {} +) { + let endpoint_name = "/parse-set/"; + let request_arguments = { + "file_url": file_url, + "file_urls": file_urls, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/parse/processMarkdownDocumentStream.js b/lib/parse/processMarkdownDocumentStream.js new file mode 100644 index 0000000..ce1335a --- /dev/null +++ b/lib/parse/processMarkdownDocumentStream.js @@ -0,0 +1,24 @@ +const Client = require('../client/constructor'); +/** + * Convert a document to markdown from a file stream. https://docs.veryfi.com/api/parse/convert-a-document-to-markdown/ + * + * @memberof Client + * @param {stream.Readable} file ReadStream of a file to submit + * @param {String} file_name The file name including the extension + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_markdown_document_from_stream = async function ( + file, + file_name, + {...kwargs} = {} +) { + let endpoint_name = "/parse/"; + let request_arguments = { + "file": file, + "file_name": file_name, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, true); + return response['data']; +} diff --git a/lib/parse/processMarkdownDocumentUrl.js b/lib/parse/processMarkdownDocumentUrl.js new file mode 100644 index 0000000..add70a4 --- /dev/null +++ b/lib/parse/processMarkdownDocumentUrl.js @@ -0,0 +1,24 @@ +const Client = require('../client/constructor'); +/** + * Convert a document to markdown from a URL. https://docs.veryfi.com/api/parse/convert-a-document-to-markdown/ + * + * @memberof Client + * @param {string|null} file_url Required if file_urls isn't specified. Publicly accessible URL to a file. + * @param {string[]} file_urls Required if file_url isn't specified. List of publicly accessible URLs. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_markdown_document_from_url = async function ( + file_url = null, + file_urls = null, + {...kwargs} = {} +) { + let endpoint_name = "/parse/"; + let request_arguments = { + "file_url": file_url, + "file_urls": file_urls, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/parse/updateMarkdownDocument.js b/lib/parse/updateMarkdownDocument.js new file mode 100644 index 0000000..96f6d55 --- /dev/null +++ b/lib/parse/updateMarkdownDocument.js @@ -0,0 +1,14 @@ +const Client = require('../client/constructor'); +/** + * Update a Markdown Document. https://docs.veryfi.com/api/parse/update-a-markdown-document/ + * + * @memberof Client + * @param {string} document_id ID of the resource + * @param {Object} kwargs Fields to update + * @returns {JSON} Updated resource + */ +Client.prototype.update_markdown_document = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/parse/${document_id}/`; + let response = await this._request("PUT", endpoint_name, kwargs); + return response['data']; +} diff --git a/lib/platform/getOcrCounts.js b/lib/platform/getOcrCounts.js new file mode 100644 index 0000000..ddb30a0 --- /dev/null +++ b/lib/platform/getOcrCounts.js @@ -0,0 +1,20 @@ +const Client = require('../client/constructor'); +/** + * Get ocr-counts. https://docs.veryfi.com/api/get-ocr-counts/ + * + * @memberof Client + * @param {string} ocr_type OCR type (pepsico_codes or pepsico_caps) + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.get_ocr_counts = async function ( + ocr_type = null, + {...kwargs} = {} +) { + let endpoint_name = "/ocr-counts/"; + let query = Object.assign({ + "ocr_type": ocr_type, + }, kwargs); + let response = await this._request("GET", endpoint_name, {}, query, false); + return response['data']; +} diff --git a/lib/platform/getOpenApiSchema.js b/lib/platform/getOpenApiSchema.js new file mode 100644 index 0000000..eecdc4e --- /dev/null +++ b/lib/platform/getOpenApiSchema.js @@ -0,0 +1,17 @@ +const Client = require('../client/constructor'); +/** + * Get OpenAPI schema. https://docs.veryfi.com/api/get-open-api-schema/ + * + * @memberof Client + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.get_open_api_schema = async function ( + {...kwargs} = {} +) { + let endpoint_name = "/documents/schema/"; + let query = Object.assign({ + }, kwargs); + let response = await this._request("GET", endpoint_name, {}, query, false); + return response['data']; +} diff --git a/lib/platform/getReleaseNotifications.js b/lib/platform/getReleaseNotifications.js new file mode 100644 index 0000000..c3ca7e1 --- /dev/null +++ b/lib/platform/getReleaseNotifications.js @@ -0,0 +1,13 @@ +const Client = require('../client/constructor'); +/** + * Get release notifications. https://docs.veryfi.com/api/get-release-notifications/ + * + * @memberof Client + * @param {Object} kwargs Additional request parameters + * @returns {JSON} Release notifications + */ +Client.prototype.get_release_notifications = async function ({...kwargs} = {}) { + let endpoint_name = "/release-notifications/"; + let response = await this._request("GET", endpoint_name, {}, kwargs, false, { api_version: "v1", skip_partner: true }); + return response['data']; +} diff --git a/lib/settings/addWebhook.js b/lib/settings/addWebhook.js new file mode 100644 index 0000000..5ccc8d4 --- /dev/null +++ b/lib/settings/addWebhook.js @@ -0,0 +1,20 @@ +const Client = require('../client/constructor'); +/** + * Add a webhook. https://docs.veryfi.com/api/settings/add-a-webhook/ + * + * @memberof Client + * @param {*} url Request field + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.add_webhook = async function ( + url, + {...kwargs} = {} +) { + let endpoint_name = "/settings/webhooks/"; + let request_arguments = Object.assign({ + "url": url, + }, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/settings/confirmWebhook.js b/lib/settings/confirmWebhook.js new file mode 100644 index 0000000..cf2ed15 --- /dev/null +++ b/lib/settings/confirmWebhook.js @@ -0,0 +1,23 @@ +const Client = require('../client/constructor'); +/** + * Confirm a webhook. https://docs.veryfi.com/api/settings/confirm-a-webhook/ + * + * @memberof Client + * @param {*} url Request field + * @param {*} secret Request field + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.confirm_webhook = async function ( + url, + secret, + {...kwargs} = {} +) { + let endpoint_name = "/settings/webhooks/confirm/"; + let request_arguments = Object.assign({ + "url": url, + "secret": secret, + }, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/settings/createApiKey.js b/lib/settings/createApiKey.js new file mode 100644 index 0000000..a59d8d9 --- /dev/null +++ b/lib/settings/createApiKey.js @@ -0,0 +1,20 @@ +const Client = require('../client/constructor'); +/** + * Create api-key. https://docs.veryfi.com/api/settings/create-api-key/ + * + * @memberof Client + * @param {*} name Request field + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.create_api_key = async function ( + name, + {...kwargs} = {} +) { + let endpoint_name = "/settings/api-keys/"; + let request_arguments = Object.assign({ + "name": name, + }, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false, { api_version: "v1" }); + return response['data']; +} diff --git a/lib/settings/createClientKeys.js b/lib/settings/createClientKeys.js new file mode 100644 index 0000000..415db17 --- /dev/null +++ b/lib/settings/createClientKeys.js @@ -0,0 +1,17 @@ +const Client = require('../client/constructor'); +/** + * Create client-keys. https://docs.veryfi.com/api/settings/create-client-keys/ + * + * @memberof Client + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.create_client_keys = async function ( + {...kwargs} = {} +) { + let endpoint_name = "/client-keys/"; + let request_arguments = Object.assign({ + }, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/settings/deleteClientKey.js b/lib/settings/deleteClientKey.js new file mode 100644 index 0000000..b1f9ee1 --- /dev/null +++ b/lib/settings/deleteClientKey.js @@ -0,0 +1,12 @@ +const Client = require('../client/constructor'); +/** + * Remove a client-key. https://docs.veryfi.com/api/settings/remove-a-client-key/ + * + * @memberof Client + * @param {string} id Resource id + * @returns {JSON} Delete response + */ +Client.prototype.delete_client_key = async function (id) { + let endpoint_name = `/client-keys/${id}/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/settings/deleteTlsCertificate.js b/lib/settings/deleteTlsCertificate.js new file mode 100644 index 0000000..bac5447 --- /dev/null +++ b/lib/settings/deleteTlsCertificate.js @@ -0,0 +1,12 @@ +const Client = require('../client/constructor'); +/** + * Delete a Tls Certificate. https://docs.veryfi.com/api/delete-a-tls-certificate/ + * + * @memberof Client + * @param {string} certificate_id Resource id + * @returns {JSON} Delete response + */ +Client.prototype.delete_tls_certificate = async function (certificate_id) { + let endpoint_name = `/settings/tls-certificate/${certificate_id}/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/settings/getApiKey.js b/lib/settings/getApiKey.js new file mode 100644 index 0000000..8bb8266 --- /dev/null +++ b/lib/settings/getApiKey.js @@ -0,0 +1,17 @@ +const Client = require('../client/constructor'); +/** + * Retrieve api-key. https://docs.veryfi.com/api/settings/retrieve-api-key/ + * + * @memberof Client + * @param {string} id Resource id + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.get_api_key = async function ( + id, + {...kwargs} = {} +) { + let endpoint_name = `/settings/api-keys/${id}/`; + let response = await this._request("GET", endpoint_name, {}, kwargs, false, { api_version: "v1" }); + return response['data']; +} diff --git a/lib/settings/getApiKeyPermissions.js b/lib/settings/getApiKeyPermissions.js new file mode 100644 index 0000000..c491bdf --- /dev/null +++ b/lib/settings/getApiKeyPermissions.js @@ -0,0 +1,15 @@ +const Client = require('../client/constructor'); +/** + * Available permissions. https://docs.veryfi.com/api/settings/available-permissions/ + * + * @memberof Client + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.get_api_key_permissions = async function ( + {...kwargs} = {} +) { + let endpoint_name = "/settings/api-keys/available-permissions/"; + let response = await this._request("GET", endpoint_name, {}, kwargs, false, { api_version: "v1" }); + return response['data']; +} diff --git a/lib/settings/getApiKeys.js b/lib/settings/getApiKeys.js new file mode 100644 index 0000000..4ec46d5 --- /dev/null +++ b/lib/settings/getApiKeys.js @@ -0,0 +1,15 @@ +const Client = require('../client/constructor'); +/** + * Retrieve api-keys list. https://docs.veryfi.com/api/settings/retrieve-api-keys-list/ + * + * @memberof Client + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.get_api_keys = async function ( + {...kwargs} = {} +) { + let endpoint_name = "/settings/api-keys/"; + let response = await this._request("GET", endpoint_name, {}, kwargs, false, { api_version: "v1" }); + return response['data']; +} diff --git a/lib/settings/getClientKeys.js b/lib/settings/getClientKeys.js new file mode 100644 index 0000000..b54f879 --- /dev/null +++ b/lib/settings/getClientKeys.js @@ -0,0 +1,15 @@ +const Client = require('../client/constructor'); +/** + * Retrieve client-keys list. https://docs.veryfi.com/api/settings/retrieve-client-keys-list/ + * + * @memberof Client + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.get_client_keys = async function ( + {...kwargs} = {} +) { + let endpoint_name = "/client-keys/"; + let response = await this._request("GET", endpoint_name, {}, kwargs, false); + return response['data']; +} diff --git a/lib/settings/getTlsCertificates.js b/lib/settings/getTlsCertificates.js new file mode 100644 index 0000000..0bfb77d --- /dev/null +++ b/lib/settings/getTlsCertificates.js @@ -0,0 +1,15 @@ +const Client = require('../client/constructor'); +/** + * Get Tls Certificates. https://docs.veryfi.com/api/get-tls-certificates/ + * + * @memberof Client + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.get_tls_certificates = async function ( + {...kwargs} = {} +) { + let endpoint_name = "/settings/tls-certificate/"; + let response = await this._request("GET", endpoint_name, {}, kwargs, false); + return response['data']; +} diff --git a/lib/settings/getWebhooks.js b/lib/settings/getWebhooks.js new file mode 100644 index 0000000..0701957 --- /dev/null +++ b/lib/settings/getWebhooks.js @@ -0,0 +1,15 @@ +const Client = require('../client/constructor'); +/** + * Get webhooks. https://docs.veryfi.com/api/settings/get-webhooks/ + * + * @memberof Client + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.get_webhooks = async function ( + {...kwargs} = {} +) { + let endpoint_name = "/settings/webhooks/"; + let response = await this._request("GET", endpoint_name, {}, kwargs, false); + return response['data']; +} diff --git a/lib/settings/processTlsCertificate.js b/lib/settings/processTlsCertificate.js new file mode 100644 index 0000000..04850bd --- /dev/null +++ b/lib/settings/processTlsCertificate.js @@ -0,0 +1,17 @@ +const Client = require('../client/constructor'); +/** + * Process a Tls Certificate. https://docs.veryfi.com/api/process-a-tls-certificate/ + * + * @memberof Client + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.process_tls_certificate = async function ( + {...kwargs} = {} +) { + let endpoint_name = "/settings/tls-certificate/"; + let request_arguments = Object.assign({ + }, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/settings/resetClientKeys.js b/lib/settings/resetClientKeys.js new file mode 100644 index 0000000..a5e97cc --- /dev/null +++ b/lib/settings/resetClientKeys.js @@ -0,0 +1,17 @@ +const Client = require('../client/constructor'); +/** + * Reset client-keys. https://docs.veryfi.com/api/settings/reset-client-keys/ + * + * @memberof Client + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.reset_client_keys = async function ( + {...kwargs} = {} +) { + let endpoint_name = "/client-keys/reset/"; + let request_arguments = Object.assign({ + }, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/settings/revokeApiKey.js b/lib/settings/revokeApiKey.js new file mode 100644 index 0000000..90bd699 --- /dev/null +++ b/lib/settings/revokeApiKey.js @@ -0,0 +1,12 @@ +const Client = require('../client/constructor'); +/** + * Revoke api-key. https://docs.veryfi.com/api/settings/revoke-api-key/ + * + * @memberof Client + * @param {string} id Resource id + * @returns {JSON} Delete response + */ +Client.prototype.revoke_api_key = async function (id) { + let endpoint_name = `/settings/api-keys/${id}/`; + return this._request("DELETE", endpoint_name, {}, {}, false, { api_version: "v1" }); +} diff --git a/lib/settings/rotateApiKey.js b/lib/settings/rotateApiKey.js new file mode 100644 index 0000000..8fe542d --- /dev/null +++ b/lib/settings/rotateApiKey.js @@ -0,0 +1,14 @@ +const Client = require('../client/constructor'); +/** + * Rotate api-key. https://docs.veryfi.com/api/settings/rotate-api-key/ + * + * @memberof Client + * @param {string} id API key id + * @param {Object} kwargs Additional request parameters + * @returns {JSON} Rotated API key + */ +Client.prototype.rotate_api_key = async function (id, {...kwargs} = {}) { + let endpoint_name = `/settings/api-keys/${id}/rotate/`; + let response = await this._request("POST", endpoint_name, kwargs, null, false, { api_version: "v1" }); + return response['data']; +} diff --git a/lib/settings/updateApiKey.js b/lib/settings/updateApiKey.js new file mode 100644 index 0000000..62b1b8e --- /dev/null +++ b/lib/settings/updateApiKey.js @@ -0,0 +1,19 @@ +const Client = require('../client/constructor'); +/** + * Update api-key. https://docs.veryfi.com/api/settings/update-api-key/ + * + * @memberof Client + * @param {string} id Resource id + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.update_api_key = async function ( + id, + {...kwargs} = {} +) { + let endpoint_name = `/settings/api-keys/${id}/`; + let request_arguments = Object.assign({ + }, kwargs); + let response = await this._request("PUT", endpoint_name, request_arguments, null, false, { api_version: "v1" }); + return response['data']; +} diff --git a/lib/settings/verifyApiKey.js b/lib/settings/verifyApiKey.js new file mode 100644 index 0000000..6a3a3d1 --- /dev/null +++ b/lib/settings/verifyApiKey.js @@ -0,0 +1,15 @@ +const Client = require('../client/constructor'); +/** + * Verify the calling key. https://docs.veryfi.com/api/settings/verify-the-calling-key/ + * + * @memberof Client + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.verify_api_key = async function ( + {...kwargs} = {} +) { + let endpoint_name = "/settings/api-keys/verify/"; + let response = await this._request("GET", endpoint_name, {}, kwargs, false, { api_version: "v1" }); + return response['data']; +} diff --git a/lib/split/getSplitDocument.js b/lib/split/getSplitDocument.js index 99c4bba..b373f1a 100644 --- a/lib/split/getSplitDocument.js +++ b/lib/split/getSplitDocument.js @@ -7,8 +7,7 @@ const Client = require('../client/constructor'); * @returns {JSON} Data extracted from the Document */ Client.prototype.get_split_document = async function (document_id, {...kwargs} = {}) { - let endpoint_name = `/documents-set//${document_id}/`; - let request_arguments = {"id": document_id}; - let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); + let endpoint_name = `/documents-set/${document_id}/`; + let document = await this._request("GET", endpoint_name, {}, kwargs, false); return document['data']; } diff --git a/lib/split/getSplitDocuments.js b/lib/split/getSplitDocuments.js index fa02073..2c073c3 100644 --- a/lib/split/getSplitDocuments.js +++ b/lib/split/getSplitDocuments.js @@ -13,11 +13,11 @@ Client.prototype.get_split_documents = async function ( {...kwargs} = {} ) { let endpoint_name = "/documents-set/"; - let request_arguments = { + let query = Object.assign({ "page": page, "page_size": page_size - }; - let documents = await this._request("GET", endpoint_name, request_arguments, kwargs, false); + }, kwargs); + let documents = await this._request("GET", endpoint_name, {}, query, false); if ("data" in documents) { documents = documents["data"]; } diff --git a/lib/split/splitDocument.js b/lib/split/splitDocument.js new file mode 100644 index 0000000..bb6517b --- /dev/null +++ b/lib/split/splitDocument.js @@ -0,0 +1,16 @@ +const Client = require('../client/constructor'); +const path = require('path'); +const fs = require('fs'); +/** + * Split and process a PDF. https://docs.veryfi.com/api/receipts-invoices/split-and-process-a-pdf/ + * + * @memberof Client + * @param {String} file_path Path on disk to a PDF or zip to split + * @param {Object} kwargs Additional request parameters (categories, tags, max_pages_to_process, external_id, package_path, bucket) + * @returns {JSON} Split set response + */ +Client.prototype.split_document = async function (file_path, {...kwargs} = {}) { + let file = fs.createReadStream(file_path); + let file_name = path.basename(file_path); + return this.split_document_from_stream(file, file_name, kwargs); +} diff --git a/lib/split/splitDocumentStream.js b/lib/split/splitDocumentStream.js new file mode 100644 index 0000000..1a3386b --- /dev/null +++ b/lib/split/splitDocumentStream.js @@ -0,0 +1,19 @@ +const Client = require('../client/constructor'); +/** + * Split and process a PDF from a file stream. https://docs.veryfi.com/api/receipts-invoices/split-and-process-a-pdf/ + * + * @memberof Client + * @param {stream.Readable} file ReadStream of a PDF or zip to split + * @param {String} file_name The file name including the extension + * @param {Object} kwargs Additional request parameters (categories, tags, max_pages_to_process, external_id, package_path, bucket) + * @returns {JSON} Split set response + */ +Client.prototype.split_document_from_stream = async function (file, file_name, {...kwargs} = {}) { + let endpoint_name = "/documents-set/"; + let request_arguments = Object.assign({ + "file": file, + "file_name": file_name + }, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, true); + return response['data']; +} diff --git a/lib/split/splitDocumentUrl.js b/lib/split/splitDocumentUrl.js index 1e754f3..80c55da 100644 --- a/lib/split/splitDocumentUrl.js +++ b/lib/split/splitDocumentUrl.js @@ -7,7 +7,7 @@ const Client = require('../client/constructor'); * @memberof Client * @param {string|null} file_url Required if file_urls isn't specified. Publicly accessible URL to a file, e.g. "https://cdn.example.com/receipt.jpg". * @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"] - * @param {Object} kwargs Additional request parameters + * @param {Object} kwargs Additional request parameters (categories, tags, max_pages_to_process, external_id, package_path, bucket) * @return {JSON} Data extracted from the document. */ Client.prototype.split_document_from_url = async function ( diff --git a/lib/types/Client.ts b/lib/types/Client.ts index c5c662e..53ad36a 100644 --- a/lib/types/Client.ts +++ b/lib/types/Client.ts @@ -41,9 +41,12 @@ export declare class Client { * @param {{}} request_arguments JSON payload to send to Veryfi * @param params {{}} query params. * @param {Boolean} has_files Are there any files to be submitted as binary + * @param {Object} [options] Optional request options + * @param {string} [options.api_version] Override the default API version (v8) + * @param {boolean} [options.skip_partner] Skip the /partner path segment (used by some v1 routes) * @returns {JSON} A JSON of the response data. */ - public _request(http_verb: String, endpoint_name: String, request_arguments: Object, params: Object, has_files: boolean): Promise; + public _request(http_verb: String, endpoint_name: String, request_arguments: Object, params?: Object, has_files?: boolean, options?: { api_version?: string; skip_partner?: boolean }): Promise; /** * Classify a document. https://docs.veryfi.com/api/classify/classify-a-document/ @@ -1152,6 +1155,519 @@ export declare class Client { */ public replace_tags(document_id: string, tags: string[]): Promise; +/** + * Classify a document. https://docs.veryfi.com/api/classify/classify-a-document/ + */ + public classify_document(file_path: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Classify a document from a file stream. https://docs.veryfi.com/api/classify/classify-a-document/ + */ + public classify_document_from_stream(file: stream.Readable, file_name: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** Get document line items. https://docs.veryfi.com/api/receipts-invoices/get-document-line-items/ */ + public get_document_line_items(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** Create a line item. https://docs.veryfi.com/api/receipts-invoices/create-a-line-item/ */ + public create_line_item(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** Delete all document line items. https://docs.veryfi.com/api/receipts-invoices/delete-all-document-line-items/ */ + public delete_document_line_items(document_id: string): Promise; +/** Get a line item. https://docs.veryfi.com/api/receipts-invoices/get-a-line-item/ */ + public get_line_item(document_id: string, line_item_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** Update a line item. https://docs.veryfi.com/api/receipts-invoices/update-a-line-item/ */ + public update_line_item(document_id: string, line_item_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** Delete a line item. https://docs.veryfi.com/api/receipts-invoices/delete-a-line-item/ */ + public delete_line_item(document_id: string, line_item_id: string): Promise; +/** Get document tags. https://docs.veryfi.com/api/receipts-invoices/get-document-tags/ */ + public get_document_tags(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise<{tags: Tag[]}>; +/** Get document tax lines. https://docs.veryfi.com/api/returns-a-list-of-document-tax-lines/ */ + public get_tax_lines(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** Create a tax line. https://docs.veryfi.com/api/create-a-tax-line/ */ + public create_tax_line(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** Get a document tax line. https://docs.veryfi.com/api/returns-document-tax-line/ */ + public get_tax_line(document_id: string, tax_line_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** Update a tax line. https://docs.veryfi.com/api/update-a-tax-line/ */ + public update_tax_line(document_id: string, tax_line_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** Delete a tax line. https://docs.veryfi.com/api/delete-a-tax-line/ */ + public delete_tax_line(document_id: string, tax_line_id: string): Promise; +/** Bulk process multiple documents. https://docs.veryfi.com/api/receipts-invoices/bulk-process-multiple-documents/ */ + public process_documents_bulk(file_urls: string[], {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Add a tag to a any document. https://docs.veryfi.com/api/anydocs/add-a-tag-to-a-A-doc/ + */ + public add_any_document_tag(document_id: string, tag: string): Promise; +/** + * Add tags to a any document. https://docs.veryfi.com/api/anydocs/add-tags-to-a-A-doc/ + */ + public add_any_document_tags(document_id: string, tags: string[]): Promise; +/** + * Unlink all tags from a any document. https://docs.veryfi.com/api/anydocs/unlink-all-tags-from-a-A-doc/ + */ + public delete_any_document_tags(document_id: string): Promise; +/** + * Update a any document. https://docs.veryfi.com/api/anydocs/update-a-A-doc/ + */ + public update_any_document(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Get Blueprints. https://docs.veryfi.com/api/get-blueprints/ + */ + public get_blueprints({...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Process a any document asynchronously. https://docs.veryfi.com/api/anydocs/process-a-A-doc-asynchronously/ + */ + public process_any_document_async(file_path: string, blueprint_name?: string, max_pages_to_process?: number, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a any document asynchronously from a file stream. https://docs.veryfi.com/api/anydocs/process-a-A-doc-asynchronously/ + */ + public process_any_document_async_from_stream(file: stream.Readable, file_name: string, blueprint_name?: string, max_pages_to_process?: number, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a any document asynchronously from a base64 string. https://docs.veryfi.com/api/anydocs/process-a-A-doc-asynchronously/ + */ + public process_any_document_async_from_base64(file_name: string, file_base64_string: string, blueprint_name?: string, max_pages_to_process?: number, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a any document asynchronously from a URL. https://docs.veryfi.com/api/anydocs/process-a-A-doc-asynchronously/ + */ + public process_any_document_async_from_url(file_url?: string, file_urls?: string[], blueprint_name?: string, max_pages_to_process?: number, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Add a tag to a bank statement. https://docs.veryfi.com/api/bank-statements/add-a-tag-to-a-bank-statement/ + */ + public add_bank_statement_tag(document_id: string, tag: string): Promise; +/** + * Add tags to a bank statement. https://docs.veryfi.com/api/bank-statements/add-tags-to-a-bank-statement/ + */ + public add_bank_statement_tags(document_id: string, tags: string[]): Promise; +/** + * Get tags assigned to a bank statement. https://docs.veryfi.com/api/bank-statements/get-bank-statement-tags/ + */ + public get_bank_statement_tags(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise<{tags: Tag[]}>; +/** + * Unlink a tag from a bank statement. https://docs.veryfi.com/api/bank-statements/unlink-a-tag-from-a-bank-statement/ + */ + public delete_bank_statement_tag(document_id: string, tag_id: string): Promise; +/** + * Unlink all tags from a bank statement. https://docs.veryfi.com/api/bank-statements/unlink-all-tags-from-a-bank-statement/ + */ + public delete_bank_statement_tags(document_id: string): Promise; +/** + * Update a bank statement. https://docs.veryfi.com/api/bank-statements/update-a-bank-statement/ + */ + public update_bank_statement(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Process a bank statement asynchronously. https://docs.veryfi.com/api/bank-statements/process-a-bank-statement-asynchronously/ + */ + public process_bank_statement_async(file_path: string, bounding_boxes?: boolean, confidence_details?: boolean, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a bank statement asynchronously from a file stream. https://docs.veryfi.com/api/bank-statements/process-a-bank-statement-asynchronously/ + */ + public process_bank_statement_async_from_stream(file: stream.Readable, file_name: string, bounding_boxes?: boolean, confidence_details?: boolean, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a bank statement asynchronously from a base64 string. https://docs.veryfi.com/api/bank-statements/process-a-bank-statement-asynchronously/ + */ + public process_bank_statement_async_from_base64(file_name: string, file_base64_string: string, bounding_boxes?: boolean, confidence_details?: boolean, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a bank statement asynchronously from a URL. https://docs.veryfi.com/api/bank-statements/process-a-bank-statement-asynchronously/ + */ + public process_bank_statement_async_from_url(file_url?: string, file_urls?: string[], bounding_boxes?: boolean, confidence_details?: boolean, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Split and process multiple bank statements. https://docs.veryfi.com/api/split-and-process-multiple-bank-statements/ + */ + public split_bank_statements(file_path: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Split and process multiple bank statements from a file stream. https://docs.veryfi.com/api/split-and-process-multiple-bank-statements/ + */ + public split_bank_statements_from_stream(file: stream.Readable, file_name: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Split and process multiple bank statements from a base64 string. https://docs.veryfi.com/api/split-and-process-multiple-bank-statements/ + */ + public split_bank_statements_from_base64(file_name: string, file_base64_string: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Split and process multiple bank statements from a URL. https://docs.veryfi.com/api/split-and-process-multiple-bank-statements/ + */ + public split_bank_statements_from_url(file_url?: string, file_urls?: string[], {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Get Bank Statement sets. https://docs.veryfi.com/api/get-bank-statement-sets/ + */ + public get_bank_statement_sets(page?: number, page_size?: number, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Get a Bank Statement set. https://docs.veryfi.com/api/get-a-bank-statement-set/ + */ + public get_bank_statement_set(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Add a tag to a business card. https://docs.veryfi.com/api/add-a-tag-to-a-business-card/ + */ + public add_business_card_tag(document_id: string, tag: string): Promise; +/** + * Add tags to a business card. https://docs.veryfi.com/api/add-tags-to-a-business-card/ + */ + public add_business_card_tags(document_id: string, tags: string[]): Promise; +/** + * Get tags assigned to a business card. https://docs.veryfi.com/api/get-business-card-tags/ + */ + public get_business_card_tags(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise<{tags: Tag[]}>; +/** + * Unlink a tag from a business card. https://docs.veryfi.com/api/unlink-a-tag-from-a-business-card/ + */ + public delete_business_card_tag(document_id: string, tag_id: string): Promise; +/** + * Unlink all tags from a business card. https://docs.veryfi.com/api/unlink-all-tags-from-a-business-card/ + */ + public delete_business_card_tags(document_id: string): Promise; +/** + * Update a business card. https://docs.veryfi.com/api/business-cards/update-a-business-card/ + */ + public update_business_card(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Add a tag to a check. https://docs.veryfi.com/api/checks/add-a-tag-to-a-check/ + */ + public add_check_tag(document_id: string, tag: string): Promise; +/** + * Add tags to a check. https://docs.veryfi.com/api/checks/add-tags-to-a-check/ + */ + public add_check_tags(document_id: string, tags: string[]): Promise; +/** + * Get tags assigned to a check. https://docs.veryfi.com/api/checks/get-check-tags/ + */ + public get_check_tags(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise<{tags: Tag[]}>; +/** + * Unlink a tag from a check. https://docs.veryfi.com/api/checks/unlink-a-tag-from-a-check/ + */ + public delete_check_tag(document_id: string, tag_id: string): Promise; +/** + * Unlink all tags from a check. https://docs.veryfi.com/api/checks/unlink-all-tags-from-a-check/ + */ + public delete_check_tags(document_id: string): Promise; +/** + * Update a check. https://docs.veryfi.com/api/checks/update-a-check/ + */ + public update_check(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Process a check asynchronously. https://docs.veryfi.com/api/checks/process-a-check-asynchronously/ + */ + public process_check_async(file_path: string, bounding_boxes?: boolean, confidence_details?: boolean, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a check asynchronously from a file stream. https://docs.veryfi.com/api/checks/process-a-check-asynchronously/ + */ + public process_check_async_from_stream(file: stream.Readable, file_name: string, bounding_boxes?: boolean, confidence_details?: boolean, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a check asynchronously from a base64 string. https://docs.veryfi.com/api/checks/process-a-check-asynchronously/ + */ + public process_check_async_from_base64(file_name: string, file_base64_string: string, bounding_boxes?: boolean, confidence_details?: boolean, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a check asynchronously from a URL. https://docs.veryfi.com/api/checks/process-a-check-asynchronously/ + */ + public process_check_async_from_url(file_url?: string, file_urls?: string[], bounding_boxes?: boolean, confidence_details?: boolean, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Process a check with remittance. https://docs.veryfi.com/api/checks/process-a-check-with-remittance/ + */ + public process_check_with_remittance(file_path: string, bounding_boxes?: boolean, confidence_details?: boolean, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a check with remittance from a file stream. https://docs.veryfi.com/api/checks/process-a-check-with-remittance/ + */ + public process_check_with_remittance_from_stream(file: stream.Readable, file_name: string, bounding_boxes?: boolean, confidence_details?: boolean, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a check with remittance from a base64 string. https://docs.veryfi.com/api/checks/process-a-check-with-remittance/ + */ + public process_check_with_remittance_from_base64(file_name: string, file_base64_string: string, bounding_boxes?: boolean, confidence_details?: boolean, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a check with remittance from a URL. https://docs.veryfi.com/api/checks/process-a-check-with-remittance/ + */ + public process_check_with_remittance_from_url(file_url?: string, file_urls?: string[], bounding_boxes?: boolean, confidence_details?: boolean, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Add a tag to a W-2. https://docs.veryfi.com/api/add-a-tag-to-a-w-2/ + */ + public add_w2_tag(document_id: string, tag: string): Promise; +/** + * Add tags to a W-2. https://docs.veryfi.com/api/add-tags-to-a-w-2/ + */ + public add_w2_tags(document_id: string, tags: string[]): Promise; +/** + * Get tags assigned to a W-2. https://docs.veryfi.com/api/get-w-2-tags/ + */ + public get_w2_tags(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise<{tags: Tag[]}>; +/** + * Unlink a tag from a W-2. https://docs.veryfi.com/api/unlink-a-tag-from-a-w-2/ + */ + public delete_w2_tag(document_id: string, tag_id: string): Promise; +/** + * Unlink all tags from a W-2. https://docs.veryfi.com/api/unlink-all-tags-from-a-w-2/ + */ + public delete_w2_tags(document_id: string): Promise; +/** + * Update a W-2. https://docs.veryfi.com/api/w2s/update-a-w-2/ + */ + public update_w2(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Split and process a PDF with multiple W-2s. https://docs.veryfi.com/api/split-and-process-a-pdf-with-multiple-w-2-s/ + */ + public split_w2s(file_path: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Split and process a PDF with multiple W-2s from a file stream. https://docs.veryfi.com/api/split-and-process-a-pdf-with-multiple-w-2-s/ + */ + public split_w2s_from_stream(file: stream.Readable, file_name: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Split and process a PDF with multiple W-2s from a base64 string. https://docs.veryfi.com/api/split-and-process-a-pdf-with-multiple-w-2-s/ + */ + public split_w2s_from_base64(file_name: string, file_base64_string: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Split and process a PDF with multiple W-2s from a URL. https://docs.veryfi.com/api/split-and-process-a-pdf-with-multiple-w-2-s/ + */ + public split_w2s_from_url(file_url?: string, file_urls?: string[], {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Get W-2 sets. https://docs.veryfi.com/api/get-w-2-sets/ + */ + public get_w2_sets(page?: number, page_size?: number, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Get a W-2 set. https://docs.veryfi.com/api/get-a-w-2-set/ + */ + public get_w2_set(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Add a tag to a W-8BEN-E. https://docs.veryfi.com/api/add-a-tag-to-a-w-8-ben-e/ + */ + public add_w8bene_tag(document_id: string, tag: string): Promise; +/** + * Add tags to a W-8BEN-E. https://docs.veryfi.com/api/add-tags-to-a-w-8-ben-e/ + */ + public add_w8bene_tags(document_id: string, tags: string[]): Promise; +/** + * Get tags assigned to a W-8BEN-E. https://docs.veryfi.com/api/get-w-8-ben-e-tags/ + */ + public get_w8bene_tags(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise<{tags: Tag[]}>; +/** + * Unlink a tag from a W-8BEN-E. https://docs.veryfi.com/api/unlink-a-tag-from-a-w-8-ben-e/ + */ + public delete_w8bene_tag(document_id: string, tag_id: string): Promise; +/** + * Unlink all tags from a W-8BEN-E. https://docs.veryfi.com/api/unlink-all-tags-from-a-w-8-ben-e/ + */ + public delete_w8bene_tags(document_id: string): Promise; +/** + * Update a W-8BEN-E. https://docs.veryfi.com/api/w-8ben-e/update-a-w-8-ben-e/ + */ + public update_w8bene(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Add a tag to a W-9. https://docs.veryfi.com/api/add-a-tag-to-a-w-9/ + */ + public add_w9_tag(document_id: string, tag: string): Promise; +/** + * Add tags to a W-9. https://docs.veryfi.com/api/add-tags-to-a-w-9/ + */ + public add_w9_tags(document_id: string, tags: string[]): Promise; +/** + * Get tags assigned to a W-9. https://docs.veryfi.com/api/get-w-9-tags/ + */ + public get_w9_tags(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise<{tags: Tag[]}>; +/** + * Unlink a tag from a W-9. https://docs.veryfi.com/api/unlink-a-tag-from-a-w-9/ + */ + public delete_w9_tag(document_id: string, tag_id: string): Promise; +/** + * Unlink all tags from a W-9. https://docs.veryfi.com/api/unlink-all-tags-from-a-w-9/ + */ + public delete_w9_tags(document_id: string): Promise; +/** + * Update a W-9. https://docs.veryfi.com/api/w9s/update-a-w-9/ + */ + public update_w9(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Process a contract. https://docs.veryfi.com/api/contracts/process-a-contract/ + */ + public process_contract(file_path: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a contract from a file stream. https://docs.veryfi.com/api/contracts/process-a-contract/ + */ + public process_contract_from_stream(file: stream.Readable, file_name: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a contract from a base64 string. https://docs.veryfi.com/api/contracts/process-a-contract/ + */ + public process_contract_from_base64(file_name: string, file_base64_string: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a contract from a URL. https://docs.veryfi.com/api/contracts/process-a-contract/ + */ + public process_contract_from_url(file_url?: string, file_urls?: string[], {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Get a contract. https://docs.veryfi.com/api/contracts/get-a-contract/ + */ + public get_contract(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Get contracts. https://docs.veryfi.com/api/contracts/get-contracts/ + */ + public get_contracts(page?: number, page_size?: number, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Update a contract. https://docs.veryfi.com/api/contracts/update-a-contract/ + */ + public update_contract(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Delete a contract. https://docs.veryfi.com/api/contracts/delete-a-contract/ + */ + public delete_contract(document_id: string): Promise; +/** + * Add a tag to a contract. https://docs.veryfi.com/api/add-a-tag-to-a-contract/ + */ + public add_contract_tag(document_id: string, tag: string): Promise; +/** + * Add tags to a contract. https://docs.veryfi.com/api/add-tags-to-a-contract/ + */ + public add_contract_tags(document_id: string, tags: string[]): Promise; +/** + * Get tags assigned to a contract. https://docs.veryfi.com/api/get-contract-tags/ + */ + public get_contract_tags(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise<{tags: Tag[]}>; +/** + * Unlink a tag from a contract. https://docs.veryfi.com/api/unlink-a-tag-from-a-contract/ + */ + public delete_contract_tag(document_id: string, tag_id: string): Promise; +/** + * Unlink all tags from a contract. https://docs.veryfi.com/api/unlink-all-tags-from-a-contract/ + */ + public delete_contract_tags(document_id: string): Promise; +/** + * Convert a document to markdown. https://docs.veryfi.com/api/parse/convert-a-document-to-markdown/ + */ + public process_markdown_document(file_path: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Convert a document to markdown from a file stream. https://docs.veryfi.com/api/parse/convert-a-document-to-markdown/ + */ + public process_markdown_document_from_stream(file: stream.Readable, file_name: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Convert a document to markdown from a base64 string. https://docs.veryfi.com/api/parse/convert-a-document-to-markdown/ + */ + public process_markdown_document_from_base64(file_name: string, file_base64_string: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Convert a document to markdown from a URL. https://docs.veryfi.com/api/parse/convert-a-document-to-markdown/ + */ + public process_markdown_document_from_url(file_url?: string, file_urls?: string[], {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Process a markdown document asynchronously. https://docs.veryfi.com/api/parse/process-a-markdown-document-asynchronously/ + */ + public process_markdown_document_async(file_path: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a markdown document asynchronously from a file stream. https://docs.veryfi.com/api/parse/process-a-markdown-document-asynchronously/ + */ + public process_markdown_document_async_from_stream(file: stream.Readable, file_name: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a markdown document asynchronously from a base64 string. https://docs.veryfi.com/api/parse/process-a-markdown-document-asynchronously/ + */ + public process_markdown_document_async_from_base64(file_name: string, file_base64_string: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a markdown document asynchronously from a URL. https://docs.veryfi.com/api/parse/process-a-markdown-document-asynchronously/ + */ + public process_markdown_document_async_from_url(file_url?: string, file_urls?: string[], {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Process a markdown document set. https://docs.veryfi.com/api/parse/process-a-markdown-document-set/ + */ + public process_markdown_document_set(file_path: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a markdown document set from a file stream. https://docs.veryfi.com/api/parse/process-a-markdown-document-set/ + */ + public process_markdown_document_set_from_stream(file: stream.Readable, file_name: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a markdown document set from a base64 string. https://docs.veryfi.com/api/parse/process-a-markdown-document-set/ + */ + public process_markdown_document_set_from_base64(file_name: string, file_base64_string: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Process a markdown document set from a URL. https://docs.veryfi.com/api/parse/process-a-markdown-document-set/ + */ + public process_markdown_document_set_from_url(file_url?: string, file_urls?: string[], {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Get Markdown Documents. https://docs.veryfi.com/api/parse/get-markdown-documents/ + */ + public get_markdown_documents(page?: number, page_size?: number, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Get a Markdown Document. https://docs.veryfi.com/api/parse/get-a-markdown-document/ + */ + public get_markdown_document(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Update a Markdown Document. https://docs.veryfi.com/api/parse/update-a-markdown-document/ + */ + public update_markdown_document(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Delete a Markdown Document. https://docs.veryfi.com/api/parse/delete-a-markdown-document/ + */ + public delete_markdown_document(document_id: string): Promise; +/** + * Get Markdown Document Sets. https://docs.veryfi.com/api/parse/get-markdown-document-sets/ + */ + public get_markdown_document_sets(page?: number, page_size?: number, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Get a Markdown Document Set. https://docs.veryfi.com/api/parse/get-a-markdown-document-set/ + */ + public get_markdown_document_set(document_id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Classify and possibly extract data from a document. https://docs.veryfi.com/api/classify-and-possibly-extract-data-from-a-document/ + */ + public extract_document(file_path: string, document_types: string[], {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Classify and possibly extract data from a document from a file stream. https://docs.veryfi.com/api/classify-and-possibly-extract-data-from-a-document/ + */ + public extract_document_from_stream(file: stream.Readable, file_name: string, document_types: string[], {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Classify and possibly extract data from a document from a base64 string. https://docs.veryfi.com/api/classify-and-possibly-extract-data-from-a-document/ + */ + public extract_document_from_base64(file_name: string, file_base64_string: string, document_types: string[], {...kwargs}?: VeryfiExtraArgs): Promise; + /** + * Classify and possibly extract data from a document from a URL. https://docs.veryfi.com/api/classify-and-possibly-extract-data-from-a-document/ + */ + public extract_document_from_url(file_url?: string, file_urls?: string[], document_types: string[], {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Get devices from blocklist. https://docs.veryfi.com/api/get-devices-from-blocklist/ + */ + public get_fraud_blocklist({...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Add devices to blocklist. https://docs.veryfi.com/api/add-devices-to-blocklist/ + */ + public add_devices_to_blocklist(device_ids: string[], {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Remove a device from blocklist. https://docs.veryfi.com/api/remove-a-device-from-blocklist/ + */ + public remove_device_from_blocklist(device_id: string): Promise; +/** + * Get ocr-counts. https://docs.veryfi.com/api/get-ocr-counts/ + */ + public get_ocr_counts(ocr_type?: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** + * Get OpenAPI schema. https://docs.veryfi.com/api/get-open-api-schema/ + */ + public get_open_api_schema({...kwargs}?: VeryfiExtraArgs): Promise; +/** Get release notifications. https://docs.veryfi.com/api/get-release-notifications/ */ + public get_release_notifications({...kwargs}?: VeryfiExtraArgs): Promise; +/** Retrieve api-keys list. https://docs.veryfi.com/api/settings/retrieve-api-keys-list/ */ + public get_api_keys({...kwargs}?: VeryfiExtraArgs): Promise; +/** Create api-key. https://docs.veryfi.com/api/settings/create-api-key/ */ + public create_api_key(name: any, {...kwargs}?: VeryfiExtraArgs): Promise; +/** Retrieve api-key. https://docs.veryfi.com/api/settings/retrieve-api-key/ */ + public get_api_key(id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** Update api-key. https://docs.veryfi.com/api/settings/update-api-key/ */ + public update_api_key(id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** Revoke api-key. https://docs.veryfi.com/api/settings/revoke-api-key/ */ + public revoke_api_key(id: string): Promise; +/** Rotate api-key. https://docs.veryfi.com/api/settings/rotate-api-key/ */ + public rotate_api_key(id: string, {...kwargs}?: VeryfiExtraArgs): Promise; +/** Available permissions. https://docs.veryfi.com/api/settings/available-permissions/ */ + public get_api_key_permissions({...kwargs}?: VeryfiExtraArgs): Promise; +/** Verify the calling key. https://docs.veryfi.com/api/settings/verify-the-calling-key/ */ + public verify_api_key({...kwargs}?: VeryfiExtraArgs): Promise; +/** Retrieve client-keys list. https://docs.veryfi.com/api/settings/retrieve-client-keys-list/ */ + public get_client_keys({...kwargs}?: VeryfiExtraArgs): Promise; +/** Create client-keys. https://docs.veryfi.com/api/settings/create-client-keys/ */ + public create_client_keys({...kwargs}?: VeryfiExtraArgs): Promise; +/** Remove a client-key. https://docs.veryfi.com/api/settings/remove-a-client-key/ */ + public delete_client_key(id: string): Promise; +/** Reset client-keys. https://docs.veryfi.com/api/settings/reset-client-keys/ */ + public reset_client_keys({...kwargs}?: VeryfiExtraArgs): Promise; +/** Get Tls Certificates. https://docs.veryfi.com/api/get-tls-certificates/ */ + public get_tls_certificates({...kwargs}?: VeryfiExtraArgs): Promise; +/** Process a Tls Certificate. https://docs.veryfi.com/api/process-a-tls-certificate/ */ + public process_tls_certificate({...kwargs}?: VeryfiExtraArgs): Promise; +/** Delete a Tls Certificate. https://docs.veryfi.com/api/delete-a-tls-certificate/ */ + public delete_tls_certificate(certificate_id: string): Promise; +/** Get webhooks. https://docs.veryfi.com/api/settings/get-webhooks/ */ + public get_webhooks({...kwargs}?: VeryfiExtraArgs): Promise; +/** Add a webhook. https://docs.veryfi.com/api/settings/add-a-webhook/ */ + public add_webhook(url: any, {...kwargs}?: VeryfiExtraArgs): Promise; +/** Confirm a webhook. https://docs.veryfi.com/api/settings/confirm-a-webhook/ */ + public confirm_webhook(url: any, secret: any, {...kwargs}?: VeryfiExtraArgs): Promise; +/** Split and process a PDF. https://docs.veryfi.com/api/receipts-invoices/split-and-process-a-pdf/ */ + public split_document(file_path: string, {...kwargs}?: VeryfiExtraArgs): Promise; + /** Split and process a PDF from a file stream. */ + public split_document_from_stream(file: stream.Readable, file_name: string, {...kwargs}?: VeryfiExtraArgs): Promise; + } /** diff --git a/lib/types/VeryfiExtraArgs.ts b/lib/types/VeryfiExtraArgs.ts index 4be61d1..6f5be71 100644 --- a/lib/types/VeryfiExtraArgs.ts +++ b/lib/types/VeryfiExtraArgs.ts @@ -1,9 +1,8 @@ /** - * Additional request parameters type + * Additional request parameters type. + * Nested objects, arrays, and nulls are allowed because several Veryfi + * body fields (device_data, vendor, line_items, document_types, tags) are not scalars. */ -export declare type VeryfiExtraArgs = Record< - string | number | symbol, - string | number | boolean ->; +export declare type VeryfiExtraArgs = Record; export type JsonObject = Record; diff --git a/lib/w2s/getW2.js b/lib/w2s/getW2.js index 7ffbc9a..634c3bd 100644 --- a/lib/w2s/getW2.js +++ b/lib/w2s/getW2.js @@ -11,7 +11,6 @@ Client.prototype.get_w2 = async function ( {...kwargs} = {} ) { let endpoint_name = `/w2s/${document_id}/`; - let request_arguments = {"id": document_id}; - let response = await this._request("GET", endpoint_name, request_arguments, kwargs, false); + let response = await this._request("GET", endpoint_name, {}, kwargs, false); return response['data']; } diff --git a/lib/w2s/getW2Set.js b/lib/w2s/getW2Set.js new file mode 100644 index 0000000..f65e152 --- /dev/null +++ b/lib/w2s/getW2Set.js @@ -0,0 +1,14 @@ +const Client = require('../client/constructor'); +/** + * Get a W-2 set. https://docs.veryfi.com/api/get-a-w-2-set/ + * + * @memberof Client + * @param {string} document_id ID of the resource + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.get_w2_set = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/w2s-set/${document_id}/`; + let response = await this._request("GET", endpoint_name, {}, kwargs, false); + return response['data']; +} diff --git a/lib/w2s/getW2Sets.js b/lib/w2s/getW2Sets.js new file mode 100644 index 0000000..c9c63fb --- /dev/null +++ b/lib/w2s/getW2Sets.js @@ -0,0 +1,23 @@ +const Client = require('../client/constructor'); +/** + * Get W-2 sets. https://docs.veryfi.com/api/get-w-2-sets/ + * + * @memberof Client + * @param {number} page Page number + * @param {number} page_size Results per page + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.get_w2_sets = async function ( + page = 1, + page_size = 50, + {...kwargs} = {} +) { + let endpoint_name = "/w2s-set/"; + let query = Object.assign({ + "page": page, + "page_size": page_size, + }, kwargs); + let response = await this._request("GET", endpoint_name, {}, query, false); + return response['data']; +} diff --git a/lib/w2s/splitW2s.js b/lib/w2s/splitW2s.js new file mode 100644 index 0000000..5a881ed --- /dev/null +++ b/lib/w2s/splitW2s.js @@ -0,0 +1,25 @@ +const Client = require('../client/constructor'); +const path = require('path'); +const fs = require('fs'); +/** + * Split and process a PDF with multiple W-2s. https://docs.veryfi.com/api/split-and-process-a-pdf-with-multiple-w-2-s/ + * @example + * veryfi_client.split_w2s('file/path') + * + * @memberof Client + * @param {String} file_path Path on disk to a file to submit + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.split_w2s = async function ( + file_path, + {...kwargs} = {} +) { + let file = fs.createReadStream(file_path); + let file_name = path.basename(file_path); + return this.split_w2s_from_stream( + file, + file_name, + kwargs + ); +} diff --git a/lib/w2s/splitW2sBase64.js b/lib/w2s/splitW2sBase64.js new file mode 100644 index 0000000..8be6033 --- /dev/null +++ b/lib/w2s/splitW2sBase64.js @@ -0,0 +1,24 @@ +const Client = require('../client/constructor'); +/** + * Split and process a PDF with multiple W-2s from a base64 string. https://docs.veryfi.com/api/split-and-process-a-pdf-with-multiple-w-2-s/ + * + * @memberof Client + * @param {String} file_name The file name including the extension + * @param {String} file_base64_string Base64-encoded file contents (raw or data URI) + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.split_w2s_from_base64 = async function ( + file_name, + file_base64_string, + {...kwargs} = {} +) { + let endpoint_name = "/w2s-set/"; + let request_arguments = { + "file_name": file_name, + "file_data": file_base64_string, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/w2s/splitW2sStream.js b/lib/w2s/splitW2sStream.js new file mode 100644 index 0000000..8816cb9 --- /dev/null +++ b/lib/w2s/splitW2sStream.js @@ -0,0 +1,24 @@ +const Client = require('../client/constructor'); +/** + * Split and process a PDF with multiple W-2s from a file stream. https://docs.veryfi.com/api/split-and-process-a-pdf-with-multiple-w-2-s/ + * + * @memberof Client + * @param {stream.Readable} file ReadStream of a file to submit + * @param {String} file_name The file name including the extension + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.split_w2s_from_stream = async function ( + file, + file_name, + {...kwargs} = {} +) { + let endpoint_name = "/w2s-set/"; + let request_arguments = { + "file": file, + "file_name": file_name, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, true); + return response['data']; +} diff --git a/lib/w2s/splitW2sUrl.js b/lib/w2s/splitW2sUrl.js new file mode 100644 index 0000000..9cc11e8 --- /dev/null +++ b/lib/w2s/splitW2sUrl.js @@ -0,0 +1,24 @@ +const Client = require('../client/constructor'); +/** + * Split and process a PDF with multiple W-2s from a URL. https://docs.veryfi.com/api/split-and-process-a-pdf-with-multiple-w-2-s/ + * + * @memberof Client + * @param {string|null} file_url Required if file_urls isn't specified. Publicly accessible URL to a file. + * @param {string[]} file_urls Required if file_url isn't specified. List of publicly accessible URLs. + * @param {Object} kwargs Additional request parameters + * @returns {JSON} API response data + */ +Client.prototype.split_w2s_from_url = async function ( + file_url = null, + file_urls = null, + {...kwargs} = {} +) { + let endpoint_name = "/w2s-set/"; + let request_arguments = { + "file_url": file_url, + "file_urls": file_urls, + }; + request_arguments = Object.assign(request_arguments, kwargs); + let response = await this._request("POST", endpoint_name, request_arguments, null, false); + return response['data']; +} diff --git a/lib/w2s/tags/addW2Tag.js b/lib/w2s/tags/addW2Tag.js new file mode 100644 index 0000000..a8ba2a0 --- /dev/null +++ b/lib/w2s/tags/addW2Tag.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Add a tag to a W-2. https://docs.veryfi.com/api/add-a-tag-to-a-w-2/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} tag Tag name to add + * @returns {JSON} Tag response + */ +Client.prototype.add_w2_tag = async function (document_id, tag) { + let endpoint_name = `/w2s/${document_id}/tags/`; + let request_arguments = {"name": tag}; + let response = await this._request("PUT", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/w2s/tags/addW2Tags.js b/lib/w2s/tags/addW2Tags.js new file mode 100644 index 0000000..a2fd41e --- /dev/null +++ b/lib/w2s/tags/addW2Tags.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Add tags to a W-2. https://docs.veryfi.com/api/add-tags-to-a-w-2/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string[]} tags Tag names to add + * @returns {JSON} Tags response + */ +Client.prototype.add_w2_tags = async function (document_id, tags) { + let endpoint_name = `/w2s/${document_id}/tags/`; + let request_arguments = {"tags": tags}; + let response = await this._request("POST", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/w2s/tags/deleteW2Tag.js b/lib/w2s/tags/deleteW2Tag.js new file mode 100644 index 0000000..05abe83 --- /dev/null +++ b/lib/w2s/tags/deleteW2Tag.js @@ -0,0 +1,13 @@ +const Client = require('../../client/constructor'); +/** + * Unlink a tag from a W-2. https://docs.veryfi.com/api/unlink-a-tag-from-a-w-2/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} tag_id ID of the tag to unlink + * @returns {JSON} Delete response + */ +Client.prototype.delete_w2_tag = async function (document_id, tag_id) { + let endpoint_name = `/w2s/${document_id}/tags/${tag_id}/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/w2s/tags/deleteW2Tags.js b/lib/w2s/tags/deleteW2Tags.js new file mode 100644 index 0000000..9d098b2 --- /dev/null +++ b/lib/w2s/tags/deleteW2Tags.js @@ -0,0 +1,12 @@ +const Client = require('../../client/constructor'); +/** + * Unlink all tags from a W-2. https://docs.veryfi.com/api/unlink-all-tags-from-a-w-2/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @returns {JSON} Delete response + */ +Client.prototype.delete_w2_tags = async function (document_id) { + let endpoint_name = `/w2s/${document_id}/tags/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/w2s/tags/getW2Tags.js b/lib/w2s/tags/getW2Tags.js new file mode 100644 index 0000000..63fe27e --- /dev/null +++ b/lib/w2s/tags/getW2Tags.js @@ -0,0 +1,14 @@ +const Client = require('../../client/constructor'); +/** + * Get tags assigned to a W-2. https://docs.veryfi.com/api/get-w-2-tags/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {Object} kwargs Additional request parameters + * @returns {JSON} List of tags + */ +Client.prototype.get_w2_tags = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/w2s/${document_id}/tags/`; + let response = await this._request("GET", endpoint_name, {}, kwargs, false); + return response['data']; +} diff --git a/lib/w2s/updateW2.js b/lib/w2s/updateW2.js new file mode 100644 index 0000000..012ab74 --- /dev/null +++ b/lib/w2s/updateW2.js @@ -0,0 +1,14 @@ +const Client = require('../client/constructor'); +/** + * Update a W-2. https://docs.veryfi.com/api/w2s/update-a-w-2/ + * + * @memberof Client + * @param {string} document_id ID of the resource + * @param {Object} kwargs Fields to update + * @returns {JSON} Updated resource + */ +Client.prototype.update_w2 = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/w2s/${document_id}/`; + let response = await this._request("PUT", endpoint_name, kwargs); + return response['data']; +} diff --git a/lib/w8bene/getW8BENE.js b/lib/w8bene/getW8BENE.js index 8215fcc..c7bf9a5 100644 --- a/lib/w8bene/getW8BENE.js +++ b/lib/w8bene/getW8BENE.js @@ -15,10 +15,10 @@ Client.prototype.get_w8bene = async function ( {...kwargs} = {} ) { let endpoint_name = `/w-8ben-e/${document_id}/`; - let request_arguments = { + let query = Object.assign({ "bounding_boxes": bounding_boxes, "confidence_details": confidence_details - }; - let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); + }, kwargs); + let document = await this._request("GET", endpoint_name, {}, query, false); return document['data']; } diff --git a/lib/w8bene/getW8BENEs.js b/lib/w8bene/getW8BENEs.js index 79b642b..64e745a 100644 --- a/lib/w8bene/getW8BENEs.js +++ b/lib/w8bene/getW8BENEs.js @@ -17,12 +17,12 @@ Client.prototype.get_w8benes = async function ( {...kwargs} = {} ) { let endpoint_name = `/w-8ben-e/`; - let request_arguments = { + let query = Object.assign({ "page": page, "page_size": page_size, "bounding_boxes": bounding_boxes, "confidence_details": confidence_details - }; - let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); + }, kwargs); + let document = await this._request("GET", endpoint_name, {}, query, false); return document['data']; } diff --git a/lib/w8bene/tags/addW8beneTag.js b/lib/w8bene/tags/addW8beneTag.js new file mode 100644 index 0000000..927d1ec --- /dev/null +++ b/lib/w8bene/tags/addW8beneTag.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Add a tag to a W-8BEN-E. https://docs.veryfi.com/api/add-a-tag-to-a-w-8-ben-e/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} tag Tag name to add + * @returns {JSON} Tag response + */ +Client.prototype.add_w8bene_tag = async function (document_id, tag) { + let endpoint_name = `/w-8ben-e/${document_id}/tags/`; + let request_arguments = {"name": tag}; + let response = await this._request("PUT", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/w8bene/tags/addW8beneTags.js b/lib/w8bene/tags/addW8beneTags.js new file mode 100644 index 0000000..b38919f --- /dev/null +++ b/lib/w8bene/tags/addW8beneTags.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Add tags to a W-8BEN-E. https://docs.veryfi.com/api/add-tags-to-a-w-8-ben-e/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string[]} tags Tag names to add + * @returns {JSON} Tags response + */ +Client.prototype.add_w8bene_tags = async function (document_id, tags) { + let endpoint_name = `/w-8ben-e/${document_id}/tags/`; + let request_arguments = {"tags": tags}; + let response = await this._request("POST", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/w8bene/tags/deleteW8beneTag.js b/lib/w8bene/tags/deleteW8beneTag.js new file mode 100644 index 0000000..e17f153 --- /dev/null +++ b/lib/w8bene/tags/deleteW8beneTag.js @@ -0,0 +1,13 @@ +const Client = require('../../client/constructor'); +/** + * Unlink a tag from a W-8BEN-E. https://docs.veryfi.com/api/unlink-a-tag-from-a-w-8-ben-e/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} tag_id ID of the tag to unlink + * @returns {JSON} Delete response + */ +Client.prototype.delete_w8bene_tag = async function (document_id, tag_id) { + let endpoint_name = `/w-8ben-e/${document_id}/tags/${tag_id}/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/w8bene/tags/deleteW8beneTags.js b/lib/w8bene/tags/deleteW8beneTags.js new file mode 100644 index 0000000..e389524 --- /dev/null +++ b/lib/w8bene/tags/deleteW8beneTags.js @@ -0,0 +1,12 @@ +const Client = require('../../client/constructor'); +/** + * Unlink all tags from a W-8BEN-E. https://docs.veryfi.com/api/unlink-all-tags-from-a-w-8-ben-e/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @returns {JSON} Delete response + */ +Client.prototype.delete_w8bene_tags = async function (document_id) { + let endpoint_name = `/w-8ben-e/${document_id}/tags/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/w8bene/tags/getW8beneTags.js b/lib/w8bene/tags/getW8beneTags.js new file mode 100644 index 0000000..c8bcc33 --- /dev/null +++ b/lib/w8bene/tags/getW8beneTags.js @@ -0,0 +1,14 @@ +const Client = require('../../client/constructor'); +/** + * Get tags assigned to a W-8BEN-E. https://docs.veryfi.com/api/get-w-8-ben-e-tags/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {Object} kwargs Additional request parameters + * @returns {JSON} List of tags + */ +Client.prototype.get_w8bene_tags = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/w-8ben-e/${document_id}/tags/`; + let response = await this._request("GET", endpoint_name, {}, kwargs, false); + return response['data']; +} diff --git a/lib/w8bene/updateW8BENE.js b/lib/w8bene/updateW8BENE.js new file mode 100644 index 0000000..61236e3 --- /dev/null +++ b/lib/w8bene/updateW8BENE.js @@ -0,0 +1,14 @@ +const Client = require('../client/constructor'); +/** + * Update a W-8BEN-E. https://docs.veryfi.com/api/w-8ben-e/update-a-w-8-ben-e/ + * + * @memberof Client + * @param {string} document_id ID of the resource + * @param {Object} kwargs Fields to update + * @returns {JSON} Updated resource + */ +Client.prototype.update_w8bene = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/w-8ben-e/${document_id}/`; + let response = await this._request("PUT", endpoint_name, kwargs); + return response['data']; +} diff --git a/lib/w9s/getW9.js b/lib/w9s/getW9.js index 930990e..7b5e21c 100644 --- a/lib/w9s/getW9.js +++ b/lib/w9s/getW9.js @@ -15,10 +15,10 @@ Client.prototype.get_w9 = async function ( {...kwargs} = {} ) { let endpoint_name = `/w9s/${document_id}/`; - let request_arguments = { + let query = Object.assign({ "bounding_boxes": bounding_boxes, "confidence_details": confidence_details - }; - let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); + }, kwargs); + let document = await this._request("GET", endpoint_name, {}, query, false); return document['data']; } diff --git a/lib/w9s/getW9s.js b/lib/w9s/getW9s.js index 89f54b9..bc2135f 100644 --- a/lib/w9s/getW9s.js +++ b/lib/w9s/getW9s.js @@ -17,12 +17,12 @@ Client.prototype.get_w9s = async function ( {...kwargs} = {} ) { let endpoint_name = `/w9s/`; - let request_arguments = { + let query = Object.assign({ "page": page, "page_size": page_size, "bounding_boxes": bounding_boxes, "confidence_details": confidence_details - }; - let document = await this._request("GET", endpoint_name, request_arguments, kwargs, false); + }, kwargs); + let document = await this._request("GET", endpoint_name, {}, query, false); return document['data']; } diff --git a/lib/w9s/tags/addW9Tag.js b/lib/w9s/tags/addW9Tag.js new file mode 100644 index 0000000..4d558d0 --- /dev/null +++ b/lib/w9s/tags/addW9Tag.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Add a tag to a W-9. https://docs.veryfi.com/api/add-a-tag-to-a-w-9/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} tag Tag name to add + * @returns {JSON} Tag response + */ +Client.prototype.add_w9_tag = async function (document_id, tag) { + let endpoint_name = `/w9s/${document_id}/tags/`; + let request_arguments = {"name": tag}; + let response = await this._request("PUT", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/w9s/tags/addW9Tags.js b/lib/w9s/tags/addW9Tags.js new file mode 100644 index 0000000..3edc191 --- /dev/null +++ b/lib/w9s/tags/addW9Tags.js @@ -0,0 +1,15 @@ +const Client = require('../../client/constructor'); +/** + * Add tags to a W-9. https://docs.veryfi.com/api/add-tags-to-a-w-9/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string[]} tags Tag names to add + * @returns {JSON} Tags response + */ +Client.prototype.add_w9_tags = async function (document_id, tags) { + let endpoint_name = `/w9s/${document_id}/tags/`; + let request_arguments = {"tags": tags}; + let response = await this._request("POST", endpoint_name, request_arguments); + return response['data']; +} diff --git a/lib/w9s/tags/deleteW9Tag.js b/lib/w9s/tags/deleteW9Tag.js new file mode 100644 index 0000000..6b5c9c1 --- /dev/null +++ b/lib/w9s/tags/deleteW9Tag.js @@ -0,0 +1,13 @@ +const Client = require('../../client/constructor'); +/** + * Unlink a tag from a W-9. https://docs.veryfi.com/api/unlink-a-tag-from-a-w-9/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {string} tag_id ID of the tag to unlink + * @returns {JSON} Delete response + */ +Client.prototype.delete_w9_tag = async function (document_id, tag_id) { + let endpoint_name = `/w9s/${document_id}/tags/${tag_id}/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/w9s/tags/deleteW9Tags.js b/lib/w9s/tags/deleteW9Tags.js new file mode 100644 index 0000000..8e32081 --- /dev/null +++ b/lib/w9s/tags/deleteW9Tags.js @@ -0,0 +1,12 @@ +const Client = require('../../client/constructor'); +/** + * Unlink all tags from a W-9. https://docs.veryfi.com/api/unlink-all-tags-from-a-w-9/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @returns {JSON} Delete response + */ +Client.prototype.delete_w9_tags = async function (document_id) { + let endpoint_name = `/w9s/${document_id}/tags/`; + return this._request("DELETE", endpoint_name, {}); +} diff --git a/lib/w9s/tags/getW9Tags.js b/lib/w9s/tags/getW9Tags.js new file mode 100644 index 0000000..07bf689 --- /dev/null +++ b/lib/w9s/tags/getW9Tags.js @@ -0,0 +1,14 @@ +const Client = require('../../client/constructor'); +/** + * Get tags assigned to a W-9. https://docs.veryfi.com/api/get-w-9-tags/ + * + * @memberof Client + * @param {string} document_id ID of the document + * @param {Object} kwargs Additional request parameters + * @returns {JSON} List of tags + */ +Client.prototype.get_w9_tags = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/w9s/${document_id}/tags/`; + let response = await this._request("GET", endpoint_name, {}, kwargs, false); + return response['data']; +} diff --git a/lib/w9s/updateW9.js b/lib/w9s/updateW9.js new file mode 100644 index 0000000..c62f0aa --- /dev/null +++ b/lib/w9s/updateW9.js @@ -0,0 +1,14 @@ +const Client = require('../client/constructor'); +/** + * Update a W-9. https://docs.veryfi.com/api/w9s/update-a-w-9/ + * + * @memberof Client + * @param {string} document_id ID of the resource + * @param {Object} kwargs Fields to update + * @returns {JSON} Updated resource + */ +Client.prototype.update_w9 = async function (document_id, {...kwargs} = {}) { + let endpoint_name = `/w9s/${document_id}/`; + let response = await this._request("PUT", endpoint_name, kwargs); + return response['data']; +} diff --git a/test/api-coverage.test.js b/test/api-coverage.test.js new file mode 100644 index 0000000..5187794 --- /dev/null +++ b/test/api-coverage.test.js @@ -0,0 +1,936 @@ +/** + * Call-arg assertions for new and expanded Veryfi SDK methods. + */ +const Client = require('../lib/client/client.js'); +const {expect, describe, test} = require("@jest/globals"); + +let client = new Client('client_id', 'client_secret', 'username', 'api_key', 'https://api.veryfi.com/', 120); + +function mockRequest() { + const fn = jest.fn().mockResolvedValue({ + status: 200, + data: { id: 1, documents: [{ id: 1 }], results: [{ id: 1 }], tags: [{ name: 'urgent' }], name: 'urgent', vendor: { name: 'Home Depot' }, categories: ['Food'] } + }); + client._request = fn; + return fn; +} + +describe('API coverage call contracts', () => { + test("create_line_item POSTs fields", async () => { + const mock = mockRequest(); + await client.create_line_item('11', {description: 'Milk', total: 3.5}); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/documents/11/line-items/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"description":"Milk","total":3.5})); + }); + + test("get_document_line_items GETs collection", async () => { + const mock = mockRequest(); + await client.get_document_line_items('11'); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/documents/11/line-items/"); + }); + + test("delete_document_line_items DELETEs collection", async () => { + const mock = mockRequest(); + await client.delete_document_line_items('11'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/documents/11/line-items/"); + }); + + test("get_line_item GETs one", async () => { + const mock = mockRequest(); + await client.get_line_item('11', '22'); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/documents/11/line-items/22/"); + }); + + test("update_line_item PUTs fields", async () => { + const mock = mockRequest(); + await client.update_line_item('11', '22', {total: 4}); + expect(mock.mock.calls[0][0]).toBe("PUT"); + expect(mock.mock.calls[0][1]).toBe("/documents/11/line-items/22/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"total":4})); + }); + + test("delete_line_item DELETEs one", async () => { + const mock = mockRequest(); + await client.delete_line_item('11', '22'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/documents/11/line-items/22/"); + }); + + test("get_document_tags GETs tags", async () => { + const mock = mockRequest(); + await client.get_document_tags('11'); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/documents/11/tags/"); + }); + + test("get_tax_lines GETs collection", async () => { + const mock = mockRequest(); + await client.get_tax_lines('11'); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/documents/11/tax-lines/"); + }); + + test("create_tax_line POSTs fields", async () => { + const mock = mockRequest(); + await client.create_tax_line('11', {tax: 1.2}); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/documents/11/tax-lines/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"tax":1.2})); + }); + + test("get_tax_line GETs one", async () => { + const mock = mockRequest(); + await client.get_tax_line('11', '33'); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/documents/11/tax-lines/33/"); + }); + + test("update_tax_line PUTs fields", async () => { + const mock = mockRequest(); + await client.update_tax_line('11', '33', {tax: 2}); + expect(mock.mock.calls[0][0]).toBe("PUT"); + expect(mock.mock.calls[0][1]).toBe("/documents/11/tax-lines/33/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"tax":2})); + }); + + test("delete_tax_line DELETEs one", async () => { + const mock = mockRequest(); + await client.delete_tax_line('11', '33'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/documents/11/tax-lines/33/"); + }); + + test("process_documents_bulk requires file_urls", async () => { + const mock = mockRequest(); + await client.process_documents_bulk(['https://example.com/a.pdf']); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/documents/bulk/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_urls":["https://example.com/a.pdf"]})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("get_documents sends pagination as query", async () => { + const mock = mockRequest(); + await client.get_documents(2, 10, true, true, {q: 'home'}); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/documents/"); + expect(mock.mock.calls[0][3]).toEqual(expect.objectContaining({"page":2,"page_size":10,"bounding_boxes":true,"confidence_details":true,"q":"home"})); + }); + + test("get_split_document uses a single slash before id", async () => { + const mock = mockRequest(); + await client.get_split_document('99'); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/documents-set/99/"); + }); + + test("process_document forwards categories", async () => { + const mock = mockRequest(); + await client.process_document('resources/receipt.png', ['Food'], false); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/documents/"); + expect(mock.mock.calls[0][4]).toBe(true); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"categories":["Food"]})); + }); + + test("add_any_document_tag PUTs {name}", async () => { + const mock = mockRequest(); + await client.add_any_document_tag('11', 'urgent'); + expect(mock.mock.calls[0][0]).toBe("PUT"); + expect(mock.mock.calls[0][1]).toBe("/any-documents/11/tags/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"name":"urgent"})); + }); + + test("add_any_document_tags POSTs {tags}", async () => { + const mock = mockRequest(); + await client.add_any_document_tags('11', ['a','b']); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/any-documents/11/tags/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"tags":["a","b"]})); + }); + + test("delete_any_document_tags DELETEs all tags", async () => { + const mock = mockRequest(); + await client.delete_any_document_tags('11'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/any-documents/11/tags/"); + }); + + test("update_any_document PUTs fields", async () => { + const mock = mockRequest(); + await client.update_any_document('11', {notes: 'x'}); + expect(mock.mock.calls[0][0]).toBe("PUT"); + expect(mock.mock.calls[0][1]).toBe("/any-documents/11/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"notes":"x"})); + }); + + test("get_blueprints GETs /blueprints/", async () => { + const mock = mockRequest(); + await client.get_blueprints(); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/blueprints/"); + }); + + test("process_any_document_async_from_url posts JSON to /any-documents/async/", async () => { + const mock = mockRequest(); + await client.process_any_document_async_from_url('https://example.com/file.pdf', null); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/any-documents/async/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_url":"https://example.com/file.pdf"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("process_any_document_async_from_base64 posts file_data to /any-documents/async/", async () => { + const mock = mockRequest(); + await client.process_any_document_async_from_base64('file.pdf', 'abc123'); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/any-documents/async/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_name":"file.pdf","file_data":"abc123"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("add_bank_statement_tag PUTs {name}", async () => { + const mock = mockRequest(); + await client.add_bank_statement_tag('11', 'urgent'); + expect(mock.mock.calls[0][0]).toBe("PUT"); + expect(mock.mock.calls[0][1]).toBe("/bank-statements/11/tags/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"name":"urgent"})); + }); + + test("add_bank_statement_tags POSTs {tags}", async () => { + const mock = mockRequest(); + await client.add_bank_statement_tags('11', ['a','b']); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/bank-statements/11/tags/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"tags":["a","b"]})); + }); + + test("get_bank_statement_tags GETs tags", async () => { + const mock = mockRequest(); + await client.get_bank_statement_tags('11'); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/bank-statements/11/tags/"); + }); + + test("delete_bank_statement_tag DELETEs one tag", async () => { + const mock = mockRequest(); + await client.delete_bank_statement_tag('11', '22'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/bank-statements/11/tags/22/"); + }); + + test("delete_bank_statement_tags DELETEs all tags", async () => { + const mock = mockRequest(); + await client.delete_bank_statement_tags('11'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/bank-statements/11/tags/"); + }); + + test("update_bank_statement PUTs fields", async () => { + const mock = mockRequest(); + await client.update_bank_statement('11', {notes: 'x'}); + expect(mock.mock.calls[0][0]).toBe("PUT"); + expect(mock.mock.calls[0][1]).toBe("/bank-statements/11/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"notes":"x"})); + }); + + test("process_bank_statement_async_from_url posts JSON to /bank-statements/async/", async () => { + const mock = mockRequest(); + await client.process_bank_statement_async_from_url('https://example.com/file.pdf', null); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/bank-statements/async/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_url":"https://example.com/file.pdf"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("process_bank_statement_async_from_base64 posts file_data to /bank-statements/async/", async () => { + const mock = mockRequest(); + await client.process_bank_statement_async_from_base64('file.pdf', 'abc123'); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/bank-statements/async/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_name":"file.pdf","file_data":"abc123"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("split_bank_statements_from_url posts JSON to /bank-statements-set/", async () => { + const mock = mockRequest(); + await client.split_bank_statements_from_url('https://example.com/file.pdf', null); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/bank-statements-set/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_url":"https://example.com/file.pdf"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("split_bank_statements_from_base64 posts file_data to /bank-statements-set/", async () => { + const mock = mockRequest(); + await client.split_bank_statements_from_base64('file.pdf', 'abc123'); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/bank-statements-set/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_name":"file.pdf","file_data":"abc123"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("get_bank_statement_set GETs by id", async () => { + const mock = mockRequest(); + await client.get_bank_statement_set('11'); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/bank-statements-set/11/"); + }); + + test("get_bank_statement_sets paginates via query", async () => { + const mock = mockRequest(); + await client.get_bank_statement_sets(2, 10); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/bank-statements-set/"); + expect(mock.mock.calls[0][3]).toEqual(expect.objectContaining({"page":2,"page_size":10})); + }); + + test("add_business_card_tag PUTs {name}", async () => { + const mock = mockRequest(); + await client.add_business_card_tag('11', 'urgent'); + expect(mock.mock.calls[0][0]).toBe("PUT"); + expect(mock.mock.calls[0][1]).toBe("/business-cards/11/tags/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"name":"urgent"})); + }); + + test("add_business_card_tags POSTs {tags}", async () => { + const mock = mockRequest(); + await client.add_business_card_tags('11', ['a','b']); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/business-cards/11/tags/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"tags":["a","b"]})); + }); + + test("get_business_card_tags GETs tags", async () => { + const mock = mockRequest(); + await client.get_business_card_tags('11'); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/business-cards/11/tags/"); + }); + + test("delete_business_card_tag DELETEs one tag", async () => { + const mock = mockRequest(); + await client.delete_business_card_tag('11', '22'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/business-cards/11/tags/22/"); + }); + + test("delete_business_card_tags DELETEs all tags", async () => { + const mock = mockRequest(); + await client.delete_business_card_tags('11'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/business-cards/11/tags/"); + }); + + test("update_business_card PUTs fields", async () => { + const mock = mockRequest(); + await client.update_business_card('11', {notes: 'x'}); + expect(mock.mock.calls[0][0]).toBe("PUT"); + expect(mock.mock.calls[0][1]).toBe("/business-cards/11/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"notes":"x"})); + }); + + test("add_check_tag PUTs {name}", async () => { + const mock = mockRequest(); + await client.add_check_tag('11', 'urgent'); + expect(mock.mock.calls[0][0]).toBe("PUT"); + expect(mock.mock.calls[0][1]).toBe("/checks/11/tags/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"name":"urgent"})); + }); + + test("add_check_tags POSTs {tags}", async () => { + const mock = mockRequest(); + await client.add_check_tags('11', ['a','b']); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/checks/11/tags/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"tags":["a","b"]})); + }); + + test("get_check_tags GETs tags", async () => { + const mock = mockRequest(); + await client.get_check_tags('11'); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/checks/11/tags/"); + }); + + test("delete_check_tag DELETEs one tag", async () => { + const mock = mockRequest(); + await client.delete_check_tag('11', '22'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/checks/11/tags/22/"); + }); + + test("delete_check_tags DELETEs all tags", async () => { + const mock = mockRequest(); + await client.delete_check_tags('11'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/checks/11/tags/"); + }); + + test("update_check PUTs fields", async () => { + const mock = mockRequest(); + await client.update_check('11', {notes: 'x'}); + expect(mock.mock.calls[0][0]).toBe("PUT"); + expect(mock.mock.calls[0][1]).toBe("/checks/11/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"notes":"x"})); + }); + + test("process_check_async_from_url posts JSON to /checks/async/", async () => { + const mock = mockRequest(); + await client.process_check_async_from_url('https://example.com/file.pdf', null); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/checks/async/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_url":"https://example.com/file.pdf"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("process_check_async_from_base64 posts file_data to /checks/async/", async () => { + const mock = mockRequest(); + await client.process_check_async_from_base64('file.pdf', 'abc123'); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/checks/async/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_name":"file.pdf","file_data":"abc123"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("process_check_with_remittance_from_url posts JSON to /check-with-document/", async () => { + const mock = mockRequest(); + await client.process_check_with_remittance_from_url('https://example.com/file.pdf', null); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/check-with-document/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_url":"https://example.com/file.pdf"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("process_check_with_remittance_from_base64 posts file_data to /check-with-document/", async () => { + const mock = mockRequest(); + await client.process_check_with_remittance_from_base64('file.pdf', 'abc123'); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/check-with-document/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_name":"file.pdf","file_data":"abc123"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("add_w2_tag PUTs {name}", async () => { + const mock = mockRequest(); + await client.add_w2_tag('11', 'urgent'); + expect(mock.mock.calls[0][0]).toBe("PUT"); + expect(mock.mock.calls[0][1]).toBe("/w2s/11/tags/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"name":"urgent"})); + }); + + test("add_w2_tags POSTs {tags}", async () => { + const mock = mockRequest(); + await client.add_w2_tags('11', ['a','b']); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/w2s/11/tags/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"tags":["a","b"]})); + }); + + test("get_w2_tags GETs tags", async () => { + const mock = mockRequest(); + await client.get_w2_tags('11'); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/w2s/11/tags/"); + }); + + test("delete_w2_tag DELETEs one tag", async () => { + const mock = mockRequest(); + await client.delete_w2_tag('11', '22'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/w2s/11/tags/22/"); + }); + + test("delete_w2_tags DELETEs all tags", async () => { + const mock = mockRequest(); + await client.delete_w2_tags('11'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/w2s/11/tags/"); + }); + + test("update_w2 PUTs fields", async () => { + const mock = mockRequest(); + await client.update_w2('11', {notes: 'x'}); + expect(mock.mock.calls[0][0]).toBe("PUT"); + expect(mock.mock.calls[0][1]).toBe("/w2s/11/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"notes":"x"})); + }); + + test("split_w2s_from_url posts JSON to /w2s-set/", async () => { + const mock = mockRequest(); + await client.split_w2s_from_url('https://example.com/file.pdf', null); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/w2s-set/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_url":"https://example.com/file.pdf"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("split_w2s_from_base64 posts file_data to /w2s-set/", async () => { + const mock = mockRequest(); + await client.split_w2s_from_base64('file.pdf', 'abc123'); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/w2s-set/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_name":"file.pdf","file_data":"abc123"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("get_w2_set GETs by id", async () => { + const mock = mockRequest(); + await client.get_w2_set('11'); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/w2s-set/11/"); + }); + + test("add_w8bene_tag PUTs {name}", async () => { + const mock = mockRequest(); + await client.add_w8bene_tag('11', 'urgent'); + expect(mock.mock.calls[0][0]).toBe("PUT"); + expect(mock.mock.calls[0][1]).toBe("/w-8ben-e/11/tags/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"name":"urgent"})); + }); + + test("add_w8bene_tags POSTs {tags}", async () => { + const mock = mockRequest(); + await client.add_w8bene_tags('11', ['a','b']); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/w-8ben-e/11/tags/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"tags":["a","b"]})); + }); + + test("get_w8bene_tags GETs tags", async () => { + const mock = mockRequest(); + await client.get_w8bene_tags('11'); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/w-8ben-e/11/tags/"); + }); + + test("delete_w8bene_tag DELETEs one tag", async () => { + const mock = mockRequest(); + await client.delete_w8bene_tag('11', '22'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/w-8ben-e/11/tags/22/"); + }); + + test("delete_w8bene_tags DELETEs all tags", async () => { + const mock = mockRequest(); + await client.delete_w8bene_tags('11'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/w-8ben-e/11/tags/"); + }); + + test("update_w8bene PUTs fields", async () => { + const mock = mockRequest(); + await client.update_w8bene('11', {notes: 'x'}); + expect(mock.mock.calls[0][0]).toBe("PUT"); + expect(mock.mock.calls[0][1]).toBe("/w-8ben-e/11/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"notes":"x"})); + }); + + test("add_w9_tag PUTs {name}", async () => { + const mock = mockRequest(); + await client.add_w9_tag('11', 'urgent'); + expect(mock.mock.calls[0][0]).toBe("PUT"); + expect(mock.mock.calls[0][1]).toBe("/w9s/11/tags/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"name":"urgent"})); + }); + + test("add_w9_tags POSTs {tags}", async () => { + const mock = mockRequest(); + await client.add_w9_tags('11', ['a','b']); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/w9s/11/tags/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"tags":["a","b"]})); + }); + + test("get_w9_tags GETs tags", async () => { + const mock = mockRequest(); + await client.get_w9_tags('11'); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/w9s/11/tags/"); + }); + + test("delete_w9_tag DELETEs one tag", async () => { + const mock = mockRequest(); + await client.delete_w9_tag('11', '22'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/w9s/11/tags/22/"); + }); + + test("delete_w9_tags DELETEs all tags", async () => { + const mock = mockRequest(); + await client.delete_w9_tags('11'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/w9s/11/tags/"); + }); + + test("update_w9 PUTs fields", async () => { + const mock = mockRequest(); + await client.update_w9('11', {notes: 'x'}); + expect(mock.mock.calls[0][0]).toBe("PUT"); + expect(mock.mock.calls[0][1]).toBe("/w9s/11/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"notes":"x"})); + }); + + test("process_contract_from_url posts JSON to /contracts/", async () => { + const mock = mockRequest(); + await client.process_contract_from_url('https://example.com/file.pdf', null); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/contracts/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_url":"https://example.com/file.pdf"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("process_contract_from_base64 posts file_data to /contracts/", async () => { + const mock = mockRequest(); + await client.process_contract_from_base64('file.pdf', 'abc123'); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/contracts/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_name":"file.pdf","file_data":"abc123"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("get_contract sends flags as query", async () => { + const mock = mockRequest(); + await client.get_contract('11', {q: 'x'}); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/contracts/11/"); + expect(mock.mock.calls[0][3]).toEqual(expect.objectContaining({"q":"x"})); + }); + + test("get_contracts sends pagination as query", async () => { + const mock = mockRequest(); + await client.get_contracts(2, 10, {q: 'x'}); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/contracts/"); + expect(mock.mock.calls[0][3]).toEqual(expect.objectContaining({"page":2,"page_size":10,"q":"x"})); + }); + + test("update_contract PUTs fields", async () => { + const mock = mockRequest(); + await client.update_contract('11', {notes: 'hi'}); + expect(mock.mock.calls[0][0]).toBe("PUT"); + expect(mock.mock.calls[0][1]).toBe("/contracts/11/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"notes":"hi"})); + }); + + test("delete_contract DELETEs the document", async () => { + const mock = mockRequest(); + await client.delete_contract('11'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/contracts/11/"); + }); + + test("add_contract_tag PUTs {name}", async () => { + const mock = mockRequest(); + await client.add_contract_tag('11', 'urgent'); + expect(mock.mock.calls[0][0]).toBe("PUT"); + expect(mock.mock.calls[0][1]).toBe("/contracts/11/tags/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"name":"urgent"})); + }); + + test("add_contract_tags POSTs {tags}", async () => { + const mock = mockRequest(); + await client.add_contract_tags('11', ['a','b']); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/contracts/11/tags/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"tags":["a","b"]})); + }); + + test("get_contract_tags GETs tags", async () => { + const mock = mockRequest(); + await client.get_contract_tags('11'); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/contracts/11/tags/"); + }); + + test("delete_contract_tag DELETEs one tag", async () => { + const mock = mockRequest(); + await client.delete_contract_tag('11', '22'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/contracts/11/tags/22/"); + }); + + test("delete_contract_tags DELETEs all tags", async () => { + const mock = mockRequest(); + await client.delete_contract_tags('11'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/contracts/11/tags/"); + }); + + test("process_markdown_document_from_url posts JSON to /parse/", async () => { + const mock = mockRequest(); + await client.process_markdown_document_from_url('https://example.com/file.pdf', null); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/parse/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_url":"https://example.com/file.pdf"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("process_markdown_document_from_base64 posts file_data to /parse/", async () => { + const mock = mockRequest(); + await client.process_markdown_document_from_base64('file.pdf', 'abc123'); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/parse/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_name":"file.pdf","file_data":"abc123"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("process_markdown_document_async_from_url posts JSON to /parse/async/", async () => { + const mock = mockRequest(); + await client.process_markdown_document_async_from_url('https://example.com/file.pdf', null); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/parse/async/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_url":"https://example.com/file.pdf"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("process_markdown_document_async_from_base64 posts file_data to /parse/async/", async () => { + const mock = mockRequest(); + await client.process_markdown_document_async_from_base64('file.pdf', 'abc123'); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/parse/async/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_name":"file.pdf","file_data":"abc123"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("process_markdown_document_set_from_url posts JSON to /parse-set/", async () => { + const mock = mockRequest(); + await client.process_markdown_document_set_from_url('https://example.com/file.pdf', null); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/parse-set/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_url":"https://example.com/file.pdf"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("process_markdown_document_set_from_base64 posts file_data to /parse-set/", async () => { + const mock = mockRequest(); + await client.process_markdown_document_set_from_base64('file.pdf', 'abc123'); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/parse-set/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_name":"file.pdf","file_data":"abc123"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("get_markdown_document GETs by id", async () => { + const mock = mockRequest(); + await client.get_markdown_document('11'); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/parse/11/"); + }); + + test("delete_markdown_document DELETEs", async () => { + const mock = mockRequest(); + await client.delete_markdown_document('11'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/parse/11/"); + }); + + test("update_markdown_document PUTs", async () => { + const mock = mockRequest(); + await client.update_markdown_document('11', {tags: ['a']}); + expect(mock.mock.calls[0][0]).toBe("PUT"); + expect(mock.mock.calls[0][1]).toBe("/parse/11/"); + }); + + test("extract_document_from_url posts JSON to /extract/", async () => { + const mock = mockRequest(); + await client.extract_document_from_url('https://example.com/file.pdf', null); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/extract/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_url":"https://example.com/file.pdf"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("extract_document_from_base64 posts file_data to /extract/", async () => { + const mock = mockRequest(); + await client.extract_document_from_base64('file.pdf', 'abc123'); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/extract/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_name":"file.pdf","file_data":"abc123"})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("get_fraud_blocklist GETs", async () => { + const mock = mockRequest(); + await client.get_fraud_blocklist(); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/fraud/blocklist/"); + }); + + test("add_devices_to_blocklist POSTs device_ids", async () => { + const mock = mockRequest(); + await client.add_devices_to_blocklist(['dev-1']); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/fraud/blocklist/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"device_ids":["dev-1"]})); + }); + + test("remove_device_from_blocklist DELETEs", async () => { + const mock = mockRequest(); + await client.remove_device_from_blocklist('dev-1'); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/fraud/blocklist/dev-1/"); + }); + + test("get_ocr_counts uses query params", async () => { + const mock = mockRequest(); + await client.get_ocr_counts('pepsico_codes', {created_date__gte: '2026-01-01'}); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/ocr-counts/"); + expect(mock.mock.calls[0][3]).toEqual(expect.objectContaining({"ocr_type":"pepsico_codes","created_date__gte":"2026-01-01"})); + }); + + test("get_open_api_schema GETs documents schema", async () => { + const mock = mockRequest(); + await client.get_open_api_schema(); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/documents/schema/"); + }); + + test("get_release_notifications uses v1 without partner", async () => { + const mock = mockRequest(); + await client.get_release_notifications(); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/release-notifications/"); + expect(mock.mock.calls[0][5]).toEqual(expect.objectContaining({"api_version":"v1","skip_partner":true})); + }); + + test("create_api_key posts name on v1", async () => { + const mock = mockRequest(); + await client.create_api_key('ci-key', {full_access: true}); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/settings/api-keys/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"name":"ci-key","full_access":true})); + expect(mock.mock.calls[0][5]).toEqual(expect.objectContaining({"api_version":"v1"})); + }); + + test("rotate_api_key posts rotate path", async () => { + const mock = mockRequest(); + await client.rotate_api_key('9'); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/settings/api-keys/9/rotate/"); + expect(mock.mock.calls[0][5]).toEqual(expect.objectContaining({"api_version":"v1"})); + }); + + test("add_webhook posts url", async () => { + const mock = mockRequest(); + await client.add_webhook('https://example.com/hook'); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/settings/webhooks/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"url":"https://example.com/hook"})); + }); + + test("confirm_webhook posts url and secret", async () => { + const mock = mockRequest(); + await client.confirm_webhook('https://example.com/hook', 's3cret'); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/settings/webhooks/confirm/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"url":"https://example.com/hook","secret":"s3cret"})); + }); + + test("get_api_keys uses v1", async () => { + const mock = mockRequest(); + await client.get_api_keys(); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/settings/api-keys/"); + expect(mock.mock.calls[0][5]).toEqual(expect.objectContaining({"api_version":"v1"})); + }); + + test("split_document_from_stream uses multipart", async () => { + const mock = mockRequest(); + await client.split_document_from_stream(require('fs').createReadStream('resources/split.pdf'), 'split.pdf', {categories: ['Food']}); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/documents-set/"); + expect(mock.mock.calls[0][4]).toBe(true); + }); + + test("classify_document_from_url accepts document_types kwargs", async () => { + const mock = mockRequest(); + await client.classify_document_from_url('https://example.com/a.pdf', null, {document_types: ['receipt']}); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/classify/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_url":"https://example.com/a.pdf","file_urls":null,"document_types":["receipt"]})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("extract_document_from_url requires document_types", async () => { + const mock = mockRequest(); + await client.extract_document_from_url('https://example.com/a.pdf', null, ['receipt', 'invoice']); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/extract/"); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({"file_url":"https://example.com/a.pdf","document_types":["receipt","invoice"]})); + expect(mock.mock.calls[0][4]).toBe(false); + }); + + test("get_bank_statements sends pagination as query", async () => { + const mock = mockRequest(); + await client.get_bank_statements(2, 10, true, true, {q: "x"}); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/bank-statements/"); + expect(mock.mock.calls[0][2]).toEqual({}); + expect(mock.mock.calls[0][3]).toEqual(expect.objectContaining({page: 2, page_size: 10, bounding_boxes: true, confidence_details: true, q: "x"})); + }); + + test("get_any_documents sends pagination as query", async () => { + const mock = mockRequest(); + await client.get_any_documents(2, 10, true, false, {blueprint_name: "us_passport"}); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/any-documents/"); + expect(mock.mock.calls[0][3]).toEqual(expect.objectContaining({page: 2, page_size: 10, bounding_boxes: true, confidence_details: false, blueprint_name: "us_passport"})); + }); + + test("get_checks sends pagination as query", async () => { + const mock = mockRequest(); + await client.get_checks(3, 5, false, true); + expect(mock.mock.calls[0][0]).toBe("GET"); + expect(mock.mock.calls[0][1]).toBe("/checks/"); + expect(mock.mock.calls[0][3]).toEqual(expect.objectContaining({page: 3, page_size: 5, bounding_boxes: false, confidence_details: true})); + }); + + test("get_business_cards sends pagination as query", async () => { + const mock = mockRequest(); + await client.get_business_cards(1, 20, true, false); + expect(mock.mock.calls[0][3]).toEqual(expect.objectContaining({page: 1, page_size: 20, bounding_boxes: true, confidence_details: false})); + }); + + test("get_w9s sends pagination as query", async () => { + const mock = mockRequest(); + await client.get_w9s(1, 50, false, false, {q: "acme"}); + expect(mock.mock.calls[0][3]).toEqual(expect.objectContaining({page: 1, page_size: 50, q: "acme"})); + }); + + test("get_w8benes sends pagination as query", async () => { + const mock = mockRequest(); + await client.get_w8benes(1, 50, true, true); + expect(mock.mock.calls[0][3]).toEqual(expect.objectContaining({page: 1, page_size: 50, bounding_boxes: true, confidence_details: true})); + }); + + test("get_any_document sends flags as query", async () => { + const mock = mockRequest(); + await client.get_any_document(11, true, true); + expect(mock.mock.calls[0][1]).toBe("/any-documents/11/"); + expect(mock.mock.calls[0][2]).toEqual({}); + expect(mock.mock.calls[0][3]).toEqual(expect.objectContaining({bounding_boxes: true, confidence_details: true})); + }); + + test("delete_tag unlinks one receipt tag", async () => { + const mock = mockRequest(); + await client.delete_tag("11", "22"); + expect(mock.mock.calls[0][0]).toBe("DELETE"); + expect(mock.mock.calls[0][1]).toBe("/documents/11/tags/22/"); + }); + + test("classify_document_from_stream posts multipart", async () => { + const mock = mockRequest(); + await client.classify_document_from_stream(require("fs").createReadStream("resources/receipt.png"), "receipt.png", {document_types: ["receipt"]}); + expect(mock.mock.calls[0][0]).toBe("POST"); + expect(mock.mock.calls[0][1]).toBe("/classify/"); + expect(mock.mock.calls[0][4]).toBe(true); + expect(mock.mock.calls[0][2]).toEqual(expect.objectContaining({file_name: "receipt.png", document_types: ["receipt"]})); + }); + +}); diff --git a/test/main.test.js b/test/main.test.js index 135c1d2..8c06a9d 100644 --- a/test/main.test.js +++ b/test/main.test.js @@ -213,6 +213,34 @@ describe('Managing tags', () => { } }); + test(`Delete a tag from a document`, async () => { + try { + if (mock_responses) { + const mockResponse = require('../mocks/deleteTags.json'); + veryfi_client._request = jest.fn().mockResolvedValue(mockResponse); + } + const doc_id = 252469322; + let response = await veryfi_client.delete_tag(doc_id, '1'); + expect(response).toBeDefined(); + } catch (error) { + throw new Error(error); + } + }); + + test(`Get document tags`, async () => { + try { + if (mock_responses) { + const mockResponse = require('../mocks/getTags.json'); + veryfi_client._request = jest.fn().mockResolvedValue(mockResponse); + } + const doc_id = 252469322; + let response = await veryfi_client.get_document_tags(doc_id); + expect(response).toBeDefined(); + } catch (error) { + throw new Error(error); + } + }); + test(`Replace tags in a document`, async () => { try { if (mock_responses) {