Skip to content

Commit 1524eda

Browse files
committed
♻️ 💥 rework v1 and v2 namespaces
1 parent 9cc5d84 commit 1524eda

File tree

184 files changed

+679
-647
lines changed

Some content is hidden

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

184 files changed

+679
-647
lines changed

docs/code_samples/default.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import com.mindee.MindeeClient;
22
import com.mindee.input.LocalInputSource;
33
import com.mindee.parsing.common.PredictResponse;
44
import com.mindee.product.generated.GeneratedV1;
5-
import com.mindee.http.Endpoint;
5+
import com.mindee.v1.http.Endpoint;
66
import java.io.File;
77
import java.io.IOException;
88

docs/code_samples/default_async.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import com.mindee.MindeeClient;
22
import com.mindee.input.LocalInputSource;
33
import com.mindee.parsing.common.AsyncPredictResponse;
44
import com.mindee.product.generated.GeneratedV1;
5-
import com.mindee.http.Endpoint;
5+
import com.mindee.v1.http.Endpoint;
66
import java.io.File;
77
import java.io.IOException;
88

docs/code_samples/v2_extraction.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import com.mindee.MindeeClientV2;
2-
import com.mindee.InferenceParameters;
2+
import com.mindee.v2.product.extraction.params.ExtractionParameters;
33
import com.mindee.input.LocalInputSource;
4-
import com.mindee.parsing.v2.InferenceResponse;
4+
import com.mindee.v2.product.extraction.ExtractionResponse;
55
import com.mindee.parsing.v2.field.InferenceFields;
66
import java.io.IOException;
77

docs/code_samples/workflow_execution.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import com.mindee.MindeeClient;
22
import com.mindee.input.LocalInputSource;
33
import com.mindee.parsing.common.WorkflowResponse;
44
import com.mindee.product.generated.GeneratedV1;
5-
import com.mindee.http.MindeeHttpException;
5+
import com.mindee.v1.http.MindeeHttpException;
66
import java.io.IOException;
77

88
public class SimpleMindeeClientV1 {

src/main/java/com/mindee/CommandLineInterface.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
package com.mindee;
22

3-
import com.mindee.cli.CommandLineInterfaceProducts;
4-
import com.mindee.cli.ProductProcessor;
5-
import com.mindee.http.Endpoint;
63
import com.mindee.input.LocalInputSource;
74
import com.mindee.input.PageOptions;
85
import com.mindee.input.PageOptionsOperation;
9-
import com.mindee.parsing.common.AsyncPredictResponse;
10-
import com.mindee.parsing.common.Inference;
11-
import com.mindee.parsing.common.PredictResponse;
12-
import com.mindee.parsing.common.ocr.Ocr;
13-
import com.mindee.product.generated.GeneratedV1;
6+
import com.mindee.v1.cli.CommandLineInterfaceProducts;
7+
import com.mindee.v1.cli.ProductProcessor;
8+
import com.mindee.v1.http.Endpoint;
9+
import com.mindee.v1.parsing.common.AsyncPredictResponse;
10+
import com.mindee.v1.parsing.common.Inference;
11+
import com.mindee.v1.parsing.common.PredictResponse;
12+
import com.mindee.v1.parsing.common.ocr.Ocr;
13+
import com.mindee.v1.product.generated.GeneratedV1;
1414
import java.io.File;
1515
import java.io.IOException;
1616
import java.lang.reflect.Method;

src/main/java/com/mindee/MindeeClient.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22

33
import com.fasterxml.jackson.databind.JavaType;
44
import com.fasterxml.jackson.databind.ObjectMapper;
5-
import com.mindee.http.Endpoint;
6-
import com.mindee.http.MindeeApi;
7-
import com.mindee.http.MindeeHttpApi;
8-
import com.mindee.http.RequestParameters;
95
import com.mindee.input.InputSourceUtils;
106
import com.mindee.input.LocalInputSource;
117
import com.mindee.input.LocalResponse;
128
import com.mindee.input.PageOptions;
13-
import com.mindee.parsing.common.AsyncPredictResponse;
14-
import com.mindee.parsing.common.Inference;
15-
import com.mindee.parsing.common.PredictResponse;
16-
import com.mindee.parsing.common.WorkflowResponse;
179
import com.mindee.pdf.PdfBoxApi;
1810
import com.mindee.pdf.PdfOperation;
1911
import com.mindee.pdf.SplitQuery;
20-
import com.mindee.product.generated.GeneratedV1;
12+
import com.mindee.v1.http.Endpoint;
13+
import com.mindee.v1.http.MindeeApi;
14+
import com.mindee.v1.http.MindeeHttpApi;
15+
import com.mindee.v1.http.RequestParameters;
16+
import com.mindee.v1.parsing.common.AsyncPredictResponse;
17+
import com.mindee.v1.parsing.common.Inference;
18+
import com.mindee.v1.parsing.common.PredictResponse;
19+
import com.mindee.v1.parsing.common.WorkflowResponse;
20+
import com.mindee.v1.product.generated.GeneratedV1;
2121
import java.io.IOException;
2222
import java.net.URL;
2323

src/main/java/com/mindee/MindeeClientV2.java

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
package com.mindee;
22

3-
import com.mindee.http.MindeeApiV2;
4-
import com.mindee.http.MindeeHttpApiV2;
5-
import com.mindee.http.MindeeHttpExceptionV2;
63
import com.mindee.input.LocalInputSource;
74
import com.mindee.input.URLInputSource;
8-
import com.mindee.parsing.v2.CommonResponse;
9-
import com.mindee.parsing.v2.ErrorResponse;
10-
import com.mindee.parsing.v2.InferenceResponse;
11-
import com.mindee.parsing.v2.JobResponse;
125
import com.mindee.v2.clientOptions.BaseParameters;
6+
import com.mindee.v2.http.MindeeApiV2;
7+
import com.mindee.v2.http.MindeeHttpApiV2;
8+
import com.mindee.v2.http.MindeeHttpException;
9+
import com.mindee.v2.parsing.CommonResponse;
10+
import com.mindee.v2.parsing.ErrorResponse;
11+
import com.mindee.v2.parsing.JobResponse;
12+
import com.mindee.v2.product.extraction.ExtractionResponse;
13+
import com.mindee.v2.product.extraction.params.ExtractionParameters;
1314
import java.io.IOException;
1415

1516
/**
@@ -38,7 +39,7 @@ public MindeeClientV2(MindeeApiV2 mindeeApi) {
3839
*/
3940
public JobResponse enqueueInference(
4041
LocalInputSource inputSource,
41-
InferenceParameters params
42+
ExtractionParameters params
4243
) throws IOException {
4344
return enqueue(inputSource, params);
4445
}
@@ -48,7 +49,7 @@ public JobResponse enqueueInference(
4849
*/
4950
public JobResponse enqueueInference(
5051
URLInputSource inputSource,
51-
InferenceParameters params
52+
ExtractionParameters params
5253
) throws IOException {
5354
return enqueue(inputSource, params);
5455
}
@@ -90,8 +91,8 @@ public JobResponse getJob(String jobId) {
9091
/**
9192
* @deprecated use `getResult` instead.
9293
*/
93-
public InferenceResponse getInference(String inferenceId) {
94-
return getResult(InferenceResponse.class, inferenceId);
94+
public ExtractionResponse getInference(String inferenceId) {
95+
return getResult(ExtractionResponse.class, inferenceId);
9596
}
9697

9798
/**
@@ -111,29 +112,29 @@ public <TResponse extends CommonResponse> TResponse getResult(
111112
/**
112113
* @deprecated use `enqueueAndGetResult` instead.
113114
*/
114-
public InferenceResponse enqueueAndGetInference(
115+
public ExtractionResponse enqueueAndGetInference(
115116
LocalInputSource inputSource,
116-
InferenceParameters options
117+
ExtractionParameters options
117118
) throws IOException, InterruptedException {
118-
return enqueueAndGetResult(InferenceResponse.class, inputSource, options);
119+
return enqueueAndGetResult(ExtractionResponse.class, inputSource, options);
119120
}
120121

121122
/**
122123
* @deprecated use `enqueueAndGetResult` instead.
123124
*/
124-
public InferenceResponse enqueueAndGetInference(
125+
public ExtractionResponse enqueueAndGetInference(
125126
URLInputSource inputSource,
126-
InferenceParameters options
127+
ExtractionParameters options
127128
) throws IOException, InterruptedException {
128-
return enqueueAndGetResult(InferenceResponse.class, inputSource, options);
129+
return enqueueAndGetResult(ExtractionResponse.class, inputSource, options);
129130
}
130131

131132
/**
132133
* Send a local file to an async queue, poll, and parse when complete.
133134
*
134135
* @param inputSource The local input source to send.
135136
* @param params The parameters to send along with the file.
136-
* @return an instance of {@link InferenceResponse}.
137+
* @return an instance of {@link ExtractionResponse}.
137138
* @throws IOException Throws if the file can't be accessed.
138139
* @throws InterruptedException Throws if the thread is interrupted.
139140
*/
@@ -152,7 +153,7 @@ public <TResponse extends CommonResponse> TResponse enqueueAndGetResult(
152153
*
153154
* @param inputSource The URL input source to send.
154155
* @param params The parameters to send along with the file.
155-
* @return an instance of {@link InferenceResponse}.
156+
* @return an instance of {@link ExtractionResponse}.
156157
* @throws IOException Throws if the file can't be accessed.
157158
* @throws InterruptedException Throws if the thread is interrupted.
158159
*/
@@ -170,7 +171,7 @@ public <TResponse extends CommonResponse> TResponse enqueueAndGetResult(
170171
* Common logic for polling an asynchronous job for local & url files.
171172
*
172173
* @param initialJob The initial job response.
173-
* @return an instance of {@link InferenceResponse}.
174+
* @return an instance of {@link ExtractionResponse}.
174175
* @throws InterruptedException Throws if interrupted.
175176
*/
176177
private <TResponse extends CommonResponse> TResponse pollAndFetch(
@@ -199,7 +200,7 @@ private <TResponse extends CommonResponse> TResponse pollAndFetch(
199200

200201
ErrorResponse error = resp.getJob().getError();
201202
if (error != null) {
202-
throw new MindeeHttpExceptionV2(error.getStatus(), error.getDetail());
203+
throw new MindeeHttpException(error.getStatus(), error.getDetail());
203204
}
204205
throw new RuntimeException("Max retries exceeded (" + max + ").");
205206
}

src/main/java/com/mindee/WorkflowOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.mindee;
22

3-
import com.mindee.parsing.common.ExecutionPriority;
3+
import com.mindee.v1.parsing.common.ExecutionPriority;
44
import lombok.Builder;
55
import lombok.Value;
66

src/main/java/com/mindee/extraction/ImageExtractor.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import com.mindee.geometry.Polygon;
66
import com.mindee.input.InputSourceUtils;
77
import com.mindee.input.LocalInputSource;
8-
import com.mindee.parsing.standard.PositionData;
98
import com.mindee.pdf.PDFUtils;
109
import com.mindee.pdf.PdfPageImage;
10+
import com.mindee.v1.parsing.standard.PositionData;
1111
import java.awt.image.BufferedImage;
1212
import java.io.ByteArrayInputStream;
1313
import java.io.IOException;
@@ -25,7 +25,7 @@ public class ImageExtractor {
2525

2626
/**
2727
* Init from a path.
28-
*
28+
*
2929
* @param filePath Path to the file.
3030
* @throws IOException Throws if the file can't be accessed.
3131
*/
@@ -35,7 +35,7 @@ public ImageExtractor(String filePath) throws IOException {
3535

3636
/**
3737
* Init from a {@link LocalInputSource}.
38-
*
38+
*
3939
* @param source The local source.
4040
* @throws IOException Throws if the file can't be accessed.
4141
*/
@@ -69,7 +69,7 @@ public int getPageCount() {
6969

7070
/**
7171
* Extract multiple images on a given page from a list of fields having position data.
72-
*
72+
*
7373
* @param <FieldT> Type of field (needs to support positioning data).
7474
* @param fields List of Fields to extract.
7575
* @param pageIndex The page index to extract, begins at 0.
@@ -84,7 +84,7 @@ public <FieldT extends PositionData> List<ExtractedImage> extractImagesFromPage(
8484

8585
/**
8686
* Extract multiple images on a given page from a list of fields having position data.
87-
*
87+
*
8888
* @param <FieldT> Type of field (needs to support positioning data).
8989
* @param fields List of Fields to extract.
9090
* @param pageIndex The page index to extract, begins at 0.
@@ -128,7 +128,7 @@ private <FieldT extends PositionData> List<ExtractedImage> extractFromPage(
128128

129129
/**
130130
* Extract a single image from a field having position data.
131-
*
131+
*
132132
* @param <FieldT> Type of field (needs to support positioning data).
133133
* @param field The field to extract.
134134
* @param index The index to use for naming the extracted image.
@@ -159,7 +159,7 @@ public <FieldT extends PositionData> ExtractedImage extractImage(
159159

160160
/**
161161
* Extract a single image from a field having position data.
162-
*
162+
*
163163
* @param <FieldT> Type of field (needs to support positioning data).
164164
* @param field The field to extract.
165165
* @param index The index to use for naming the extracted image.

src/main/java/com/mindee/extraction/PDFExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.mindee.MindeeException;
66
import com.mindee.input.InputSourceUtils;
77
import com.mindee.input.LocalInputSource;
8-
import com.mindee.product.invoicesplitter.InvoiceSplitterV1InvoicePageGroup;
8+
import com.mindee.v1.product.invoicesplitter.InvoiceSplitterV1InvoicePageGroup;
99
import java.awt.image.BufferedImage;
1010
import java.io.ByteArrayInputStream;
1111
import java.io.IOException;

0 commit comments

Comments
 (0)