Package com.mindee.v2
Class MindeeClient
- java.lang.Object
-
- com.mindee.v2.MindeeClient
-
public class MindeeClient extends Object
Entry point for the Mindee **V2** API features.
-
-
Constructor Summary
Constructors Constructor Description MindeeClient()Uses an API key read from the environment variables.MindeeClient(MindeeApiV2 mindeeApi)Inject a custom HTTP API implementation.MindeeClient(String apiKey)Uses the supplied API key.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JobResponseenqueue(LocalInputSource inputSource, BaseParameters params)Enqueue a document in the asynchronous queue.JobResponseenqueue(URLInputSource inputSource, BaseParameters params)Enqueue a document in the asynchronous queue.<TResponse extends CommonResponse>
TResponseenqueueAndGetResult(Class<TResponse> responseClass, LocalInputSource inputSource, BaseParameters params)Send a local file to an async queue, poll, and parse when complete.<TResponse extends CommonResponse>
TResponseenqueueAndGetResult(Class<TResponse> responseClass, LocalInputSource inputSource, BaseParameters params, PollingOptions pollingOptions)Send a local file to an async queue, poll, and parse when complete.<TResponse extends CommonResponse>
TResponseenqueueAndGetResult(Class<TResponse> responseClass, URLInputSource inputSource, BaseParameters params)Send a remote file to an async queue, poll, and parse when complete.<TResponse extends CommonResponse>
TResponseenqueueAndGetResult(Class<TResponse> responseClass, URLInputSource inputSource, BaseParameters params, PollingOptions pollingOptions)Send a remote file to an async queue, poll, and parse when complete.JobResponsegetJob(String jobId)Get the status of an inference that was previously enqueued.<TResponse extends CommonResponse>
TResponsegetResult(Class<TResponse> responseClass, String inferenceId)Get the result of an inference that was previously enqueued.
-
-
-
Constructor Detail
-
MindeeClient
public MindeeClient()
Uses an API key read from the environment variables.
-
MindeeClient
public MindeeClient(String apiKey)
Uses the supplied API key.
-
MindeeClient
public MindeeClient(MindeeApiV2 mindeeApi)
Inject a custom HTTP API implementation.
-
-
Method Detail
-
enqueue
public JobResponse enqueue(LocalInputSource inputSource, BaseParameters params) throws IOException
Enqueue a document in the asynchronous queue.- Parameters:
inputSource- The local input source to send.params- The parameters to send along with the file.- Throws:
IOException
-
enqueue
public JobResponse enqueue(URLInputSource inputSource, BaseParameters params) throws IOException
Enqueue a document in the asynchronous queue.- Parameters:
inputSource- The URL input source to send.params- The parameters to send along with the file.- Throws:
IOException
-
getJob
public JobResponse getJob(String jobId)
Get the status of an inference that was previously enqueued. Can be used for polling.
-
getResult
public <TResponse extends CommonResponse> TResponse getResult(Class<TResponse> responseClass, String inferenceId)
Get the result of an inference that was previously enqueued. The inference will only be available after it has finished processing.
-
enqueueAndGetResult
public <TResponse extends CommonResponse> TResponse enqueueAndGetResult(Class<TResponse> responseClass, LocalInputSource inputSource, BaseParameters params) throws IOException, InterruptedException
Send a local file to an async queue, poll, and parse when complete. Use default polling options.- Parameters:
inputSource- The local input source to send.params- The product parameters to send along with the file.- Returns:
- an instance of
ExtractionResponse. - Throws:
IOException- Throws if the file can't be accessed.InterruptedException- Throws if the thread is interrupted.
-
enqueueAndGetResult
public <TResponse extends CommonResponse> TResponse enqueueAndGetResult(Class<TResponse> responseClass, LocalInputSource inputSource, BaseParameters params, PollingOptions pollingOptions) throws IOException, InterruptedException
Send a local file to an async queue, poll, and parse when complete. Specify polling options.- Parameters:
inputSource- The local input source to send.params- The product parameters to send along with the file.pollingOptions- The polling options to use.- Returns:
- an instance of
ExtractionResponse. - Throws:
IOException- Throws if the file can't be accessed.InterruptedException- Throws if the thread is interrupted.
-
enqueueAndGetResult
public <TResponse extends CommonResponse> TResponse enqueueAndGetResult(Class<TResponse> responseClass, URLInputSource inputSource, BaseParameters params) throws IOException, InterruptedException
Send a remote file to an async queue, poll, and parse when complete. Use default polling options.- Parameters:
inputSource- The URL input source to send.params- The product parameters to send along with the file.- Returns:
- an instance of
ExtractionResponse. - Throws:
IOException- Throws if the file can't be accessed.InterruptedException- Throws if the thread is interrupted.
-
enqueueAndGetResult
public <TResponse extends CommonResponse> TResponse enqueueAndGetResult(Class<TResponse> responseClass, URLInputSource inputSource, BaseParameters params, PollingOptions pollingOptions) throws IOException, InterruptedException
Send a remote file to an async queue, poll, and parse when complete. Specify polling options.- Parameters:
inputSource- The URL input source to send.params- The product parameters to send along with the file.pollingOptions- The polling options to use.- Returns:
- an instance of
ExtractionResponse. - Throws:
IOException- Throws if the file can't be accessed.InterruptedException- Throws if the thread is interrupted.
-
-