-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMindeeApiV2.java
More file actions
61 lines (55 loc) · 1.65 KB
/
MindeeApiV2.java
File metadata and controls
61 lines (55 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.mindee.http;
import com.mindee.InferenceParameters;
import com.mindee.input.LocalInputSource;
import com.mindee.input.URLInputSource;
import com.mindee.parsing.v2.ErrorResponse;
import com.mindee.parsing.v2.InferenceResponse;
import com.mindee.parsing.v2.JobResponse;
import java.io.IOException;
/**
* Defines required methods for an API.
*/
public abstract class MindeeApiV2 extends MindeeApiCommon {
/**
* Send a file to the prediction queue with a local file.
* @param inputSource Local input source from URL.
* @param options parameters.
*/
public abstract JobResponse reqPostInferenceEnqueue(
LocalInputSource inputSource,
InferenceParameters options
) throws IOException;
/**
* Send a file to the prediction queue with a remote file.
* @param inputSource Remote input source from URL.
* @param options parameters.
*/
public abstract JobResponse reqPostInferenceEnqueue(
URLInputSource inputSource,
InferenceParameters options
) throws IOException;
/**
* Attempts to poll the queue.
* @param jobId id of the job to get.
*/
public abstract JobResponse reqGetJob(
String jobId
);
/**
* Retrieves the inference from a 302 redirect.
* @param inferenceId ID of the inference to poll.
*/
abstract public InferenceResponse reqGetInference(String inferenceId);
/**
* Creates an "unknown error" response from an HTTP status code.
*/
protected ErrorResponse makeUnknownError(int statusCode) {
return new ErrorResponse(
"Unknown Error",
"The server returned an Unknown error.",
statusCode,
statusCode + "-000",
null
);
}
}