public class Client
extends java.lang.Object
| Constructor and Description |
|---|
Client(Credentials credentials)
A client to invoke api methods from Lucidtech AI Services.
|
| Modifier and Type | Method and Description |
|---|---|
org.json.JSONObject |
createBatch(java.lang.String description)
Creates a batch handle, calls the POST /batches endpoint
|
org.json.JSONObject |
createDocument(byte[] content,
ContentType contentType,
java.lang.String consentId)
Creates a document handle, calls POST /documents endpoint
|
org.json.JSONObject |
createDocument(byte[] content,
ContentType contentType,
java.lang.String consentId,
java.util.Map<java.lang.String,java.lang.Object> options)
Creates a document handle, calls POST /documents endpoint
|
org.json.JSONObject |
createDocument(java.io.InputStream content,
ContentType contentType,
java.lang.String consentId)
Creates a document handle, calls POST /documents endpoint
|
org.json.JSONObject |
createDocument(java.io.InputStream content,
ContentType contentType,
java.lang.String consentId,
java.util.Map<java.lang.String,java.lang.Object> options)
Creates a document handle, calls POST /documents endpoint
|
org.json.JSONObject |
createPrediction(java.lang.String documentId,
java.lang.String modelName)
Run inference and create a prediction, calls the POST /predictions endpoint
|
org.json.JSONObject |
createPrediction(java.lang.String documentId,
java.lang.String modelName,
java.util.Map<java.lang.String,java.lang.Object> options)
Run inference and create a prediction, calls the POST /predictions endpoint
|
org.json.JSONObject |
deleteConsent(java.lang.String consentId)
Delete documents with this consent_id, calls the DELETE /consent/{consentId} endpoint.
|
org.json.JSONObject |
getDocument(java.lang.String documentId) |
org.json.JSONObject |
getUser(java.lang.String userId)
Get information about user, calls the GET /users/{user_id} endpoint.
|
org.json.JSONObject |
listDocuments() |
org.json.JSONObject |
listDocuments(java.util.List<org.apache.http.NameValuePair> options) |
Prediction |
predict(java.lang.String documentPath,
java.lang.String modelName,
java.lang.String consentId)
Create a prediction on a document documentPath by path using model modelName.
|
org.json.JSONObject |
updateDocument(java.lang.String documentId,
org.json.JSONObject feedback)
Post feedback to the REST API, calls the POST /documents/{documentId} endpoint.
|
public Client(Credentials credentials)
credentials - Credentials to useCredentialspublic org.json.JSONObject getDocument(java.lang.String documentId)
throws java.io.IOException,
APIException,
MissingAccessTokenException
documentId - The document id to run inference and create a prediction onjava.io.IOException - General IOExceptionAPIException - Raised when API returns an erroneous status codeMissingAccessTokenException - Raised if access token cannot be obtainedpublic org.json.JSONObject listDocuments()
throws java.io.IOException,
APIException,
MissingAccessTokenException
java.io.IOException - General IOExceptionAPIException - Raised when API returns an erroneous status codeMissingAccessTokenException - Raised if access token cannot be obtainedpublic org.json.JSONObject listDocuments(java.util.List<org.apache.http.NameValuePair> options)
throws java.io.IOException,
APIException,
MissingAccessTokenException
options - Available options are:java.io.IOException - General IOExceptionAPIException - Raised when API returns an erroneous status codeMissingAccessTokenException - Raised if access token cannot be obtainedpublic org.json.JSONObject createDocument(java.io.InputStream content,
ContentType contentType,
java.lang.String consentId,
java.util.Map<java.lang.String,java.lang.Object> options)
throws java.io.IOException,
APIException,
MissingAccessTokenException
content - Input streamcontentType - A mime type for the document handleconsentId - An identifier to mark the owner of the document handleoptions - Additional options to include in request bodyjava.io.IOException - General IOExceptionAPIException - Raised when API returns an erroneous status codeMissingAccessTokenException - Raised if access token cannot be obtainedContentTypepublic org.json.JSONObject createDocument(java.io.InputStream content,
ContentType contentType,
java.lang.String consentId)
throws java.io.IOException,
APIException,
MissingAccessTokenException
content - Input streamcontentType - A mime type for the document handleconsentId - An identifier to mark the owner of the document handlejava.io.IOException - General IOExceptionAPIException - Raised when API returns an erroneous status codeMissingAccessTokenException - Raised if access token cannot be obtainedContentTypepublic org.json.JSONObject createDocument(byte[] content,
ContentType contentType,
java.lang.String consentId,
java.util.Map<java.lang.String,java.lang.Object> options)
throws java.io.IOException,
APIException,
MissingAccessTokenException
content - Binary datacontentType - A mime type for the document handleconsentId - An identifier to mark the owner of the document handleoptions - Additional options to include in request bodyjava.io.IOException - General IOExceptionAPIException - Raised when API returns an erroneous status codeMissingAccessTokenException - Raised if access token cannot be obtainedContentTypepublic org.json.JSONObject createDocument(byte[] content,
ContentType contentType,
java.lang.String consentId)
throws java.io.IOException,
APIException,
MissingAccessTokenException
content - Binary datacontentType - A mime type for the document handleconsentId - An identifier to mark the owner of the document handlejava.io.IOException - General IOExceptionAPIException - Raised when API returns an erroneous status codeMissingAccessTokenException - Raised if access token cannot be obtainedContentTypepublic org.json.JSONObject createPrediction(java.lang.String documentId,
java.lang.String modelName)
throws java.io.IOException,
APIException,
MissingAccessTokenException
documentId - The document id to run inference and create a prediction. See createDocument for how to get documentIdmodelName - The name of the model to use for inferencejava.io.IOException - General IOExceptionAPIException - Raised when API returns an erroneous status codeMissingAccessTokenException - Raised if access token cannot be obtainedcreateDocument(java.io.InputStream, ai.lucidtech.las.sdk.ContentType, java.lang.String, java.util.Map<java.lang.String, java.lang.Object>)public org.json.JSONObject createPrediction(java.lang.String documentId,
java.lang.String modelName,
java.util.Map<java.lang.String,java.lang.Object> options)
throws java.io.IOException,
APIException,
MissingAccessTokenException
documentId - The document id to run inference and create a prediction. See createDocument for how to get documentIdmodelName - The name of the model to use for inferenceoptions - Available options are:
maxPages - maximum number of pages to run predictions on
autoRotate - whether or not to let the API try different rotations onjava.io.IOException - General IOExceptionAPIException - Raised when API returns an erroneous status codeMissingAccessTokenException - Raised if access token cannot be obtainedcreateDocument(java.io.InputStream, ai.lucidtech.las.sdk.ContentType, java.lang.String, java.util.Map<java.lang.String, java.lang.Object>)public Prediction predict(java.lang.String documentPath, java.lang.String modelName, java.lang.String consentId) throws java.io.IOException, APIException, MissingAccessTokenException
documentPath - Path to document to run inference onmodelName - The name of the model to use for inferenceconsentId - An identifier to mark the owner of the document handlejava.io.IOException - General IOExceptionAPIException - Raised when API returns an erroneous status codeMissingAccessTokenException - Raised if access token cannot be obtainedpublic org.json.JSONObject updateDocument(java.lang.String documentId,
org.json.JSONObject feedback)
throws java.io.IOException,
APIException,
MissingAccessTokenException
documentId - The document id to post feedback to.feedback - Feedback to postjava.io.IOException - General IOExceptionAPIException - Raised when API returns an erroneous status codeMissingAccessTokenException - Raised if access token cannot be obtainedcreateDocument(java.io.InputStream, ai.lucidtech.las.sdk.ContentType, java.lang.String, java.util.Map<java.lang.String, java.lang.Object>)public org.json.JSONObject createBatch(java.lang.String description)
throws java.io.IOException,
APIException,
MissingAccessTokenException
description - Creates a batch handle, calls the POST /batches endpointjava.io.IOException - General IOExceptionAPIException - Raised when API returns an erroneous status codeMissingAccessTokenException - Raised if access token cannot be obtainedpublic org.json.JSONObject deleteConsent(java.lang.String consentId)
throws java.io.IOException,
APIException,
MissingAccessTokenException
consentId - Delete documents with this consentIdjava.io.IOException - General IOExceptionAPIException - Raised when API returns an erroneous status codeMissingAccessTokenException - Raised if access token cannot be obtainedcreateDocument(java.io.InputStream, ai.lucidtech.las.sdk.ContentType, java.lang.String, java.util.Map<java.lang.String, java.lang.Object>)public org.json.JSONObject getUser(java.lang.String userId)
throws java.io.IOException,
APIException,
MissingAccessTokenException
userId - The user_id to get consent hash forjava.io.IOException - General IOExceptionAPIException - Raised when API returns an erroneous status codeMissingAccessTokenException - Raised if access token cannot be obtained