Skip to content

Commit b033071

Browse files
committedJan 16, 2023
💥 Refacto the Invoice v4 Model (#40)
1 parent 6015464 commit b033071

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1979
-363
lines changed
 

‎.gitattributes

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Auto-detect text files, ensure they use LF.
2+
* text=auto eol=lf
3+
4+
# These files are always considered text and should use LF.
5+
# See core.whitespace @ https://git-scm.com/docs/git-config for whitespace flags.
6+
*.java text eol=lf whitespace=blank-at-eol,space-before-tab,tab-in-indent,tabwidth=2
7+
*.cs text eol=lf whitespace=blank-at-eol,space-before-tab,tab-in-indent,tabwidth=2
8+
*.ts text eol=lf whitespace=blank-at-eol,space-before-tab,tab-in-indent,tabwidth=2
9+
*.js text eol=lf whitespace=blank-at-eol,space-before-tab,tab-in-indent,tabwidth=2
10+
*.json text eol=lf whitespace=blank-at-eol,space-before-tab,tab-in-indent,tabwidth=2
11+
*.sh text eol=lf whitespace=blank-at-eol diff=bash
12+
*.md text eol=lf whitespace=blank-at-eol diff=markdown
13+
*.rst text eol=lf whitespace=blank-at-eol
14+
*.cfg text eol=lf whitespace=blank-at-eol
15+
*.toml text eol=lf whitespace=blank-at-eol,space-before-tab,tab-in-indent,tabwidth=2
16+
17+
# Exclude non-essential files from dist
18+
.gitattributes export-ignore
19+
.gitignore export-ignore
20+
tests/ export-ignore
21+
.github export-ignore

‎README.md

+9-25
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,21 @@ Include the following maven dependency in your project to use the helper library
2020
### Usage
2121
The `Client` class is the entry point for most of the helper library features.
2222

23-
Configuring and using a client to parse invoices, receipts, financial documents, and passports
23+
Configuring and using a client to parse invoices (or receipts, passports, ...)
2424
```java
25-
Client client = new Client("<MINDEE API KEY>");
26-
InvoiceV4Response invoiceResponse = client.loadDocument(new File("src/main/resources/invoices/invoice1.pdf"))
27-
.parse(InvoiceV4Response.class, ParseParameters.builder()
28-
.documentType("invoice")
29-
.build());
30-
31-
ReceiptV4Response receiptResponse = client.loadDocument(new File("src/main/resources/receipts/receipt1.pdf"))
32-
.parse(ReceiptV4Response.class, ParseParameters.builder()
33-
.documentType("receipt")
34-
.build());
35-
36-
FinancialDocumentResponse finDocResponse = client.loadDocument(new File("src/main/resources/findocs/findoc1.pdf"))
37-
.parse(FinancialDocumentResponse.class, ParseParameters.builder()
38-
.documentType("financial_doc")
39-
.build());
40-
```
25+
MindeeClient mindeeClient = new MindeeClient(new MindeeSetings("<MINDEE API KEY>"));
4126

42-
Custom documents are supported as well and can be parsed as follows:
43-
```java
44-
CustomDocumentResponse bill = client.loadDocument(new File("src/test/resources/custom/custom1.pdf"))
45-
.parse(CustomDocumentResponse.class, ParseParameters.builder()
46-
.documentType("bill_of_lading_line_items")
47-
.accountName("<your account name>")
48-
.build());
27+
DocumentToParse documentToParse = mindeeClient.loadDocument(new File("src/main/resources/invoices/invoice1.pdf"));
28+
29+
Document<InvoiceV4Inference> invoiceDocument = mindeeClient.parse(
30+
InvoiceV4Inference.class,
31+
documentToParse);
4932
```
5033

51-
The Client `loadDocument` method supports multiple input types:
34+
Client supports multiple input types:
5235

5336
* java.io.File file
37+
* InputStream fileAsStream, String filename
5438
* byte[] fileAsByteArray, String filename
5539
* String fileAsBase64String, String filename
5640

0 commit comments

Comments
 (0)
Please sign in to comment.