Skip to content

Commit 5cd5da5

Browse files
fix typos & rename enqueue() method on V2
1 parent 90d7752 commit 5cd5da5

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,17 @@ public MindeeClientV2(MindeeApiV2 mindeeApi) {
3434
}
3535

3636
/**
37-
* Enqueue a document in the asynchronous “Generated” queue.
37+
* Enqueue a document in the asynchronous queue.
3838
*/
39-
public JobResponse enqueue(
39+
public JobResponse enqueueInference(
4040
LocalInputSource inputSource,
4141
InferenceParameters params) throws IOException {
4242
return mindeeApi.reqPostInferenceEnqueue(inputSource, params);
4343
}
4444

4545
/**
46-
* Poll queue for a previously enqueued document.
46+
* Get the status of an inference that was previously enqueued.
47+
* Can be used for polling.
4748
*/
4849
public JobResponse getJob(String jobId) {
4950
if (jobId == null || jobId.trim().isEmpty()) {
@@ -53,11 +54,12 @@ public JobResponse getJob(String jobId) {
5354
}
5455

5556
/**
56-
* Retrieve results for a previously enqueued document.
57+
* Get the result of an inference that was previously enqueued.
58+
* The inference will only be available after it has finished processing.
5759
*/
5860
public InferenceResponse getInference(String inferenceId) {
5961
if (inferenceId == null || inferenceId.trim().isEmpty()) {
60-
throw new IllegalArgumentException("jobId must not be null or blank.");
62+
throw new IllegalArgumentException("inferenceId must not be null or blank.");
6163
}
6264

6365
return mindeeApi.reqGetInference(inferenceId);
@@ -77,7 +79,7 @@ public InferenceResponse enqueueAndGetInference(
7779

7880
validatePollingOptions(options.getPollingOptions());
7981

80-
JobResponse job = enqueue(inputSource, options);
82+
JobResponse job = enqueueInference(inputSource, options);
8183

8284
Thread.sleep((long) (options.getPollingOptions().getInitialDelaySec() * 1000));
8385
JobResponse resp = job;
@@ -102,7 +104,7 @@ else if (resp.getJob().getStatus().equals("Processed")) {
102104
}
103105

104106
/**
105-
* Deserialize a webhook payload (or any saved response) into
107+
* Deserialize a webhook payload (or any saved response) into an
106108
* {@link InferenceResponse}.
107109
*/
108110
public InferenceResponse loadInference(LocalResponse localResponse) throws IOException {

src/test/java/com/mindee/MindeeClientV2IT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void invalidModel_mustThrowError() throws IOException {
103103

104104
MindeeHttpExceptionV2 ex = assertThrows(
105105
MindeeHttpExceptionV2.class,
106-
() -> mindeeClient.enqueue(source, options)
106+
() -> mindeeClient.enqueueInference(source, options)
107107
);
108108
assertEquals(422, ex.getStatus());
109109
}

src/test/java/com/mindee/MindeeClientV2Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void enqueue_post_async() throws IOException {
4141

4242
LocalInputSource input =
4343
new LocalInputSource(new File("src/test/resources/file_types/pdf/blank_1.pdf"));
44-
JobResponse response = mindeeClient.enqueue(
44+
JobResponse response = mindeeClient.enqueueInference(
4545
input,
4646
InferenceParameters.builder("dummy-model-id").build()
4747
);

0 commit comments

Comments
 (0)