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 Deprecated Methods Modifier and Type Method Description JobResponseenqueue(LocalInputSource inputSource, BaseProductParameters params)Enqueue a document in the asynchronous queue.JobResponseenqueue(URLInputSource inputSource, BaseProductParameters params)Enqueue a document in the asynchronous queue.<TResponse extends CommonResponse>
TResponseenqueueAndGetResult(Class<TResponse> responseClass, LocalInputSource inputSource, BaseProductParameters params)Send a local file to an async queue, poll, and parse when complete.<TResponse extends CommonResponse>
TResponseenqueueAndGetResult(Class<TResponse> responseClass, LocalInputSource inputSource, BaseProductParameters 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, BaseProductParameters params)Send a remote file to an async queue, poll, and parse when complete.<TResponse extends CommonResponse>
TResponseenqueueAndGetResult(Class<TResponse> responseClass, URLInputSource inputSource, BaseProductParameters 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.JobResponsegetJobFromUrl(String pollingUrl)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.<TResponse extends CommonResponse>
TResponsegetResultFromUrl(Class<TResponse> responseClass, String inferenceUrl)Get the result of an inference from a given URL.<TSearchResponse extends BaseSearchResponse>
TSearchResponsesearch(BaseSearchParameters<TSearchResponse> searchParameters)Search for resources matching the given criteria.SearchResponsesearchModels()Deprecated.SearchResponsesearchModels(String modelName)Deprecated.SearchResponsesearchModels(String modelName, String modelType)Deprecated.
-
-
-
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, BaseProductParameters 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, BaseProductParameters 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
-
getJobFromUrl
public JobResponse getJobFromUrl(String pollingUrl)
Get the status of an inference that was previously enqueued. Can be used for polling.
-
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.
-
getResultFromUrl
public <TResponse extends CommonResponse> TResponse getResultFromUrl(Class<TResponse> responseClass, String inferenceUrl)
Get the result of an inference from a given URL. The inference will only be available after it has finished processing.
-
enqueueAndGetResult
public <TResponse extends CommonResponse> TResponse enqueueAndGetResult(Class<TResponse> responseClass, LocalInputSource inputSource, BaseProductParameters 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, BaseProductParameters 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, BaseProductParameters 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, BaseProductParameters 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.
-
search
public <TSearchResponse extends BaseSearchResponse> TSearchResponse search(BaseSearchParameters<TSearchResponse> searchParameters)
Search for resources matching the given criteria.- Parameters:
searchParameters- Search parameters
-
searchModels
@Deprecated public SearchResponse searchModels()
Deprecated.Return all models.- Returns:
- an instance of
SearchResponse
-
searchModels
@Deprecated public SearchResponse searchModels(String modelName)
Deprecated.Search for models by name.- Parameters:
modelName- name of the model to search for- Returns:
- an instance of
SearchResponse
-
searchModels
@Deprecated public SearchResponse searchModels(String modelName, String modelType)
Deprecated.Search for models by name and type.- Parameters:
modelName- name of the model to search formodelType- type of the model to search for- Returns:
- an instance of
SearchResponse
-
-