Package com.mindee
Class MindeeClient
- java.lang.Object
-
- com.mindee.MindeeClient
-
public class MindeeClient extends Object
Main entrypoint for Mindee operations.
-
-
Constructor Summary
Constructors Constructor Description MindeeClient()
Create a default MindeeClient.MindeeClient(MindeeApi mindeeApi)
Create a MindeeClient using a MindeeApi.MindeeClient(PdfOperation pdfOperation, MindeeApi mindeeApi)
Create a MindeeClient.MindeeClient(String apiKey)
Create a default MindeeClient.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends GeneratedV1>
AsyncPredictResponse<T>enqueue(Class<T> type, Endpoint endpoint, LocalInputSource localInputSource)
Send a local file to a Generated prediction async API queue.<T extends GeneratedV1>
AsyncPredictResponse<T>enqueue(Class<T> type, Endpoint endpoint, LocalInputSource localInputSource, PredictOptions predictOptions, PageOptions pageOptions)
Send a local file to a Generated prediction async API queue.<T extends GeneratedV1>
AsyncPredictResponse<T>enqueue(Class<T> type, Endpoint endpoint, URL sourceUrl)
Send a remote file to a Generated prediction async API queue.<T extends GeneratedV1>
AsyncPredictResponse<T>enqueue(Class<T> type, Endpoint endpoint, URL sourceUrl, PredictOptions predictOptions)
Send a remote file to a Generated prediction async API queue.<T extends Inference>
AsyncPredictResponse<T>enqueue(Class<T> type, LocalInputSource localInputSource)
Send a local file to an async queue.<T extends Inference>
AsyncPredictResponse<T>enqueue(Class<T> type, LocalInputSource localInputSource, PredictOptions predictOptions, PageOptions pageOptions)
Send a local file to an async queue.<T extends Inference>
AsyncPredictResponse<T>enqueue(Class<T> type, URL sourceUrl)
Send a remote file to an async queue.<T extends Inference>
AsyncPredictResponse<T>enqueue(Class<T> type, URL sourceUrl, PredictOptions predictOptions)
Send a remote file to an async queue.<T extends GeneratedV1>
AsyncPredictResponse<T>enqueueAndParse(Class<T> type, Endpoint endpoint, LocalInputSource localInputSource)
Send a local file to a Generated prediction API async queue, poll, and parse when complete.<T extends GeneratedV1>
AsyncPredictResponse<T>enqueueAndParse(Class<T> type, Endpoint endpoint, LocalInputSource localInputSource, AsyncPollingOptions pollingOptions)
Send a local file to a Generated prediction API async queue, poll, and parse when complete.<T extends GeneratedV1>
AsyncPredictResponse<T>enqueueAndParse(Class<T> type, Endpoint endpoint, LocalInputSource localInputSource, PredictOptions predictOptions, PageOptions pageOptions, AsyncPollingOptions pollingOptions)
Send a local file to a Generated prediction API async queue, poll, and parse when complete.<T extends GeneratedV1>
AsyncPredictResponse<T>enqueueAndParse(Class<T> type, Endpoint endpoint, URL sourceUrl)
Send a remote file to a Generated prediction API async queue, poll, and parse when complete.<T extends Inference>
AsyncPredictResponse<T>enqueueAndParse(Class<T> type, LocalInputSource localInputSource)
Send a local file to an async queue, poll, and parse when complete.<T extends Inference>
AsyncPredictResponse<T>enqueueAndParse(Class<T> type, LocalInputSource localInputSource, AsyncPollingOptions pollingOptions)
Send a local file to an async queue, poll, and parse when complete.<T extends Inference>
AsyncPredictResponse<T>enqueueAndParse(Class<T> type, LocalInputSource localInputSource, PredictOptions predictOptions, PageOptions pageOptions, AsyncPollingOptions pollingOptions)
Send a local file to an async queue, poll, and parse when complete.<T extends Inference>
AsyncPredictResponse<T>enqueueAndParse(Class<T> type, URL sourceUrl)
Send a remote file to an async queue, poll, and parse when complete.WorkflowResponse<GeneratedV1>
executeWorkflow(String workflowId, LocalInputSource localInputSource)
Send a local file to a workflow execution.WorkflowResponse<GeneratedV1>
executeWorkflow(String workflowId, LocalInputSource localInputSource, WorkflowOptions workflowOptions)
Send a local file to a workflow execution.<T extends Inference>
AsyncPredictResponse<T>loadPrediction(Class<T> type, LocalResponse localResponse)
Load a local prediction.PredictResponse<CustomV1>
parse(LocalInputSource localInputSource, Endpoint endpoint)
Send a local file to a Custom prediction API and parse the results.PredictResponse<CustomV1>
parse(LocalInputSource localInputSource, Endpoint endpoint, PageOptions pageOptions)
Send a local file to a Custom prediction API and parse the results.<T extends GeneratedV1>
PredictResponse<T>parse(Class<T> type, Endpoint endpoint, LocalInputSource localInputSource)
Send a local file to a Generated prediction API and parse the results.<T extends GeneratedV1>
PredictResponse<T>parse(Class<T> type, Endpoint endpoint, LocalInputSource localInputSource, PageOptions pageOptions)
Send a local file to a Generated prediction API and parse the results.<T extends GeneratedV1>
PredictResponse<T>parse(Class<T> type, Endpoint endpoint, LocalInputSource localInputSource, PredictOptions predictOptions)
Send a local file to a Generated prediction API and parse the results.<T extends GeneratedV1>
PredictResponse<T>parse(Class<T> type, Endpoint endpoint, LocalInputSource localInputSource, PredictOptions predictOptions, PageOptions pageOptions)
Send a local file to a Standard prediction API and parse the results.<T extends GeneratedV1>
PredictResponse<T>parse(Class<T> type, Endpoint endpoint, URL documentUrl)
Send a remote file to a Generated prediction API and parse the results.<T extends GeneratedV1>
PredictResponse<T>parse(Class<T> type, Endpoint endpoint, URL documentUrl, PredictOptions predictOptions)
Send a remote file to a Generated prediction API and parse the results.<T extends Inference>
PredictResponse<T>parse(Class<T> type, LocalInputSource localInputSource)
Send a local file to a Standard prediction API and parse the results.<T extends Inference>
PredictResponse<T>parse(Class<T> type, LocalInputSource localInputSource, PageOptions pageOptions)
Send a local file to a Standard prediction API and parse the results.<T extends Inference>
PredictResponse<T>parse(Class<T> type, LocalInputSource localInputSource, PredictOptions predictOptions)
Send a local file to a Standard prediction API and parse the results.<T extends Inference>
PredictResponse<T>parse(Class<T> type, LocalInputSource localInputSource, PredictOptions predictOptions, PageOptions pageOptions)
Send a local file to a Standard prediction API and parse the results.<T extends Inference>
PredictResponse<T>parse(Class<T> type, URL urlInputSource)
Send a remote file to a Standard prediction API and parse the results.<T extends Inference>
PredictResponse<T>parse(Class<T> type, URL urlInputSource, PredictOptions predictOptions)
Send a remote file to a Standard prediction API and parse the results.PredictResponse<CustomV1>
parse(URL documentUrl, Endpoint endpoint)
Send a remote file to a Custom prediction API and parse the results.<T extends GeneratedV1>
AsyncPredictResponse<T>parseQueued(Class<T> type, Endpoint endpoint, String jobId)
Parse a document from a Generated prediction API async queue.<T extends Inference>
AsyncPredictResponse<T>parseQueued(Class<T> type, String jobId)
Parse a document from an async queue.
-
-
-
Constructor Detail
-
MindeeClient
public MindeeClient()
Create a default MindeeClient. You'll need to set the API key in the environment for this approach to work properly.
-
MindeeClient
public MindeeClient(String apiKey)
Create a default MindeeClient.- Parameters:
apiKey
- The api key to use.
-
MindeeClient
public MindeeClient(MindeeApi mindeeApi)
Create a MindeeClient using a MindeeApi.- Parameters:
mindeeApi
- The MindeeApi implementation to be used by the created MindeeClient.
-
MindeeClient
public MindeeClient(PdfOperation pdfOperation, MindeeApi mindeeApi)
Create a MindeeClient.- Parameters:
pdfOperation
- The PdfOperation implementation to be used by the created MindeeClient.mindeeApi
- The MindeeApi implementation to be used by the created MindeeClient.
-
-
Method Detail
-
parseQueued
public <T extends Inference> AsyncPredictResponse<T> parseQueued(Class<T> type, String jobId)
Parse a document from an async queue.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference;jobId
- ID of the job.- Returns:
- A valid prediction.
-
enqueue
public <T extends Inference> AsyncPredictResponse<T> enqueue(Class<T> type, LocalInputSource localInputSource) throws IOException
Send a local file to an async queue.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.localInputSource
- A local input source file.- Returns:
- an instance of
AsyncPredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
enqueue
public <T extends Inference> AsyncPredictResponse<T> enqueue(Class<T> type, LocalInputSource localInputSource, PredictOptions predictOptions, PageOptions pageOptions) throws IOException
Send a local file to an async queue.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.localInputSource
- A local input source file.predictOptions
- Prediction options for the enqueuing.pageOptions
- Page options for PDF documents.- Returns:
- an instance of
AsyncPredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
enqueue
public <T extends Inference> AsyncPredictResponse<T> enqueue(Class<T> type, URL sourceUrl) throws IOException
Send a remote file to an async queue.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.sourceUrl
- A URL to a remote file.- Returns:
- an instance of
AsyncPredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
enqueue
public <T extends Inference> AsyncPredictResponse<T> enqueue(Class<T> type, URL sourceUrl, PredictOptions predictOptions) throws IOException
Send a remote file to an async queue.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.sourceUrl
- A URL to a remote file.predictOptions
- Prediction options for the enqueuing.- Returns:
- an instance of
AsyncPredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
enqueueAndParse
public <T extends Inference> AsyncPredictResponse<T> enqueueAndParse(Class<T> type, LocalInputSource localInputSource) throws IOException, InterruptedException
Send a local file to an async queue, poll, and parse when complete.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.localInputSource
- A local input source file.- Returns:
- an instance of
AsyncPredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.InterruptedException
- Throws in case of timeout.
-
enqueueAndParse
public <T extends Inference> AsyncPredictResponse<T> enqueueAndParse(Class<T> type, LocalInputSource localInputSource, AsyncPollingOptions pollingOptions) throws IOException, InterruptedException
Send a local file to an async queue, poll, and parse when complete.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.localInputSource
- A local input source file.pollingOptions
- Options for async call parameters- Returns:
- an instance of
AsyncPredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.InterruptedException
- Throws in the event of a timeout.
-
enqueueAndParse
public <T extends Inference> AsyncPredictResponse<T> enqueueAndParse(Class<T> type, LocalInputSource localInputSource, PredictOptions predictOptions, PageOptions pageOptions, AsyncPollingOptions pollingOptions) throws IOException, InterruptedException
Send a local file to an async queue, poll, and parse when complete.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.localInputSource
- A local input source file.predictOptions
- Prediction options for the enqueuing.pageOptions
- Page options for PDF documents.pollingOptions
- Options for async call parameters.- Returns:
- an instance of
AsyncPredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.InterruptedException
- Throws in the event of a timeout.
-
enqueueAndParse
public <T extends Inference> AsyncPredictResponse<T> enqueueAndParse(Class<T> type, URL sourceUrl) throws IOException, InterruptedException
Send a remote file to an async queue, poll, and parse when complete.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.sourceUrl
- A URL to a remote file.- Returns:
- an instance of
AsyncPredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.InterruptedException
- Throws in the event of a timeout.
-
executeWorkflow
public WorkflowResponse<GeneratedV1> executeWorkflow(String workflowId, LocalInputSource localInputSource, WorkflowOptions workflowOptions) throws IOException
Send a local file to a workflow execution.- Parameters:
workflowId
- ID of the workflow to send the document to.localInputSource
- A local input source file.workflowOptions
- Options for the workflow execution.- Returns:
- A workflow response.
- Throws:
IOException
- Throws if the file can't be accessed.
-
executeWorkflow
public WorkflowResponse<GeneratedV1> executeWorkflow(String workflowId, LocalInputSource localInputSource) throws IOException
Send a local file to a workflow execution.- Parameters:
workflowId
- ID of the workflow to send the document to.localInputSource
- A local input source file.- Returns:
- A workflow response.
- Throws:
IOException
- Throws if the file can't be accessed.
-
parse
public <T extends Inference> PredictResponse<T> parse(Class<T> type, LocalInputSource localInputSource) throws IOException
Send a local file to a Standard prediction API and parse the results.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.localInputSource
- A local input source file.- Returns:
- an instance of
PredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
parse
public <T extends Inference> PredictResponse<T> parse(Class<T> type, LocalInputSource localInputSource, PredictOptions predictOptions) throws IOException
Send a local file to a Standard prediction API and parse the results.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.localInputSource
- A local input source file.predictOptions
- Prediction options for the enqueuing.- Returns:
- an instance of
PredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
parse
public <T extends Inference> PredictResponse<T> parse(Class<T> type, LocalInputSource localInputSource, PageOptions pageOptions) throws IOException
Send a local file to a Standard prediction API and parse the results.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.localInputSource
- A local input source file.pageOptions
- Page options for PDF documents.- Returns:
- an instance of
PredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
parse
public <T extends Inference> PredictResponse<T> parse(Class<T> type, LocalInputSource localInputSource, PredictOptions predictOptions, PageOptions pageOptions) throws IOException
Send a local file to a Standard prediction API and parse the results.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.localInputSource
- A local input source file.predictOptions
- Prediction options for the enqueuing.pageOptions
- Page options for PDF documents.- Returns:
- an instance of
PredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
parse
public <T extends Inference> PredictResponse<T> parse(Class<T> type, URL urlInputSource) throws IOException
Send a remote file to a Standard prediction API and parse the results.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.urlInputSource
- A URL to a remote file.- Returns:
- an instance of
PredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
parse
public <T extends Inference> PredictResponse<T> parse(Class<T> type, URL urlInputSource, PredictOptions predictOptions) throws IOException
Send a remote file to a Standard prediction API and parse the results.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.urlInputSource
- A URL to a remote file.predictOptions
- Prediction options for the enqueuing.- Returns:
- an instance of
PredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
parse
public PredictResponse<CustomV1> parse(LocalInputSource localInputSource, Endpoint endpoint) throws IOException
Send a local file to a Custom prediction API and parse the results.- Parameters:
localInputSource
- A local input source file.endpoint
- Custom endpoint to send the document to.- Returns:
- an instance of
PredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
parse
public PredictResponse<CustomV1> parse(LocalInputSource localInputSource, Endpoint endpoint, PageOptions pageOptions) throws IOException
Send a local file to a Custom prediction API and parse the results.- Parameters:
localInputSource
- A local input source file.endpoint
- Custom endpoint to send the document to.pageOptions
- Page options for PDF documents.- Returns:
- an instance of
PredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
parse
public PredictResponse<CustomV1> parse(URL documentUrl, Endpoint endpoint) throws IOException
Send a remote file to a Custom prediction API and parse the results.- Parameters:
documentUrl
- A URL to a remote file.endpoint
- Custom endpoint to send the document to.- Returns:
- an instance of
PredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
enqueue
public <T extends GeneratedV1> AsyncPredictResponse<T> enqueue(Class<T> type, Endpoint endpoint, LocalInputSource localInputSource) throws IOException
Send a local file to a Generated prediction async API queue.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.localInputSource
- A local input source file.endpoint
- Custom endpoint to send the document to.- Returns:
- an instance of
AsyncPredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
enqueue
public <T extends GeneratedV1> AsyncPredictResponse<T> enqueue(Class<T> type, Endpoint endpoint, LocalInputSource localInputSource, PredictOptions predictOptions, PageOptions pageOptions) throws IOException
Send a local file to a Generated prediction async API queue.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.localInputSource
- A local input source file.predictOptions
- Prediction options for the enqueuing.pageOptions
- Page options for PDF documents.endpoint
- Custom endpoint to send the document to.- Returns:
- an instance of
AsyncPredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
enqueue
public <T extends GeneratedV1> AsyncPredictResponse<T> enqueue(Class<T> type, Endpoint endpoint, URL sourceUrl) throws IOException
Send a remote file to a Generated prediction async API queue.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.endpoint
- Custom endpoint to send the document to.sourceUrl
- A URL to a remote file.- Returns:
- an instance of
AsyncPredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
enqueue
public <T extends GeneratedV1> AsyncPredictResponse<T> enqueue(Class<T> type, Endpoint endpoint, URL sourceUrl, PredictOptions predictOptions) throws IOException
Send a remote file to a Generated prediction async API queue.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.sourceUrl
- A URL to a remote file.predictOptions
- Prediction options for the enqueuing.endpoint
- Custom endpoint to send the document to.- Returns:
- an instance of
PredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
enqueueAndParse
public <T extends GeneratedV1> AsyncPredictResponse<T> enqueueAndParse(Class<T> type, Endpoint endpoint, LocalInputSource localInputSource) throws IOException, InterruptedException
Send a local file to a Generated prediction API async queue, poll, and parse when complete.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.localInputSource
- A local input source file.endpoint
- Custom endpoint to send the document to.- Returns:
- an instance of
AsyncPredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.InterruptedException
- Throws in the event of a timeout.
-
enqueueAndParse
public <T extends GeneratedV1> AsyncPredictResponse<T> enqueueAndParse(Class<T> type, Endpoint endpoint, LocalInputSource localInputSource, AsyncPollingOptions pollingOptions) throws IOException, InterruptedException
Send a local file to a Generated prediction API async queue, poll, and parse when complete.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.localInputSource
- A local input source file.pollingOptions
- Options for async call parameters.endpoint
- Custom endpoint to send the document to.- Returns:
- an instance of
AsyncPredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.InterruptedException
- Throws in the event of a timeout.
-
enqueueAndParse
public <T extends GeneratedV1> AsyncPredictResponse<T> enqueueAndParse(Class<T> type, Endpoint endpoint, LocalInputSource localInputSource, PredictOptions predictOptions, PageOptions pageOptions, AsyncPollingOptions pollingOptions) throws IOException, InterruptedException
Send a local file to a Generated prediction API async queue, poll, and parse when complete.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.localInputSource
- A local input source file.predictOptions
- Prediction options for the enqueuing.pageOptions
- Page options for PDF documents.pollingOptions
- Options for async call parameters.endpoint
- Custom endpoint to send the document to.- Returns:
- an instance of
AsyncPredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.InterruptedException
- Throws in the event of a timeout.
-
enqueueAndParse
public <T extends GeneratedV1> AsyncPredictResponse<T> enqueueAndParse(Class<T> type, Endpoint endpoint, URL sourceUrl) throws IOException, InterruptedException
Send a remote file to a Generated prediction API async queue, poll, and parse when complete.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.endpoint
- Custom endpoint to send the document to.sourceUrl
- A URL to a remote file.- Returns:
- an instance of
AsyncPredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.InterruptedException
- Throws in the event of a timeout.
-
parse
public <T extends GeneratedV1> PredictResponse<T> parse(Class<T> type, Endpoint endpoint, LocalInputSource localInputSource) throws IOException
Send a local file to a Generated prediction API and parse the results.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.localInputSource
- A local input source file.endpoint
- Custom endpoint to send the document to.- Returns:
- an instance of
PredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
parse
public <T extends GeneratedV1> PredictResponse<T> parse(Class<T> type, Endpoint endpoint, LocalInputSource localInputSource, PredictOptions predictOptions) throws IOException
Send a local file to a Generated prediction API and parse the results.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.localInputSource
- A local input source file.predictOptions
- Prediction options for the enqueuing.endpoint
- Custom endpoint to send the document to.- Returns:
- an instance of
PredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
parse
public <T extends GeneratedV1> PredictResponse<T> parse(Class<T> type, Endpoint endpoint, LocalInputSource localInputSource, PageOptions pageOptions) throws IOException
Send a local file to a Generated prediction API and parse the results.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.localInputSource
- A local input source file.pageOptions
- Page options for PDF documents.endpoint
- Custom endpoint to send the document to.- Returns:
- an instance of
PredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
parse
public <T extends GeneratedV1> PredictResponse<T> parse(Class<T> type, Endpoint endpoint, LocalInputSource localInputSource, PredictOptions predictOptions, PageOptions pageOptions) throws IOException
Send a local file to a Standard prediction API and parse the results.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.localInputSource
- A local input source file.predictOptions
- Prediction options for the enqueuing.pageOptions
- Page options for PDF documents.endpoint
- Custom endpoint to send the document to.- Returns:
- an instance of
PredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
parse
public <T extends GeneratedV1> PredictResponse<T> parse(Class<T> type, Endpoint endpoint, URL documentUrl) throws IOException
Send a remote file to a Generated prediction API and parse the results.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.endpoint
- Custom endpoint to send the document to.documentUrl
- A URL to a remote file.- Returns:
- an instance of
PredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
parse
public <T extends GeneratedV1> PredictResponse<T> parse(Class<T> type, Endpoint endpoint, URL documentUrl, PredictOptions predictOptions) throws IOException
Send a remote file to a Generated prediction API and parse the results.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.documentUrl
- A URL to a remote file.predictOptions
- Prediction options for the enqueuing.endpoint
- Custom endpoint to send the document to.- Returns:
- an instance of
PredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
parseQueued
public <T extends GeneratedV1> AsyncPredictResponse<T> parseQueued(Class<T> type, Endpoint endpoint, String jobId)
Parse a document from a Generated prediction API async queue.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.endpoint
- Custom endpoint to send the document to.jobId
- ID of the job.- Returns:
- an instance of
AsyncPredictResponse
.
-
loadPrediction
public <T extends Inference> AsyncPredictResponse<T> loadPrediction(Class<T> type, LocalResponse localResponse) throws IOException
Load a local prediction. Typically used when wanting to load from a webhook callback. However, any kind of Mindee response may be loaded.- Type Parameters:
T
- Type of inference.- Parameters:
type
- Type of inference.localResponse
- A loaded local response.- Returns:
- an instance of
AsyncPredictResponse
. - Throws:
IOException
- Throws if the file can't be accessed.
-
-