Package veryfi
Class NetworkClient
java.lang.Object
veryfi.NetworkClient
-
Field Summary
-
Constructor Summary
ConstructorDescriptionNetworkClient
(Credentials credentials, int apiVersion) Creates an instance ofNetworkClient
.NetworkClient
(Credentials credentials, int apiVersion, HttpClient httpClient) Creates an instance ofNetworkClient
. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.json.JSONObject
addFileToParameters
(String filePath, org.json.JSONObject parameters) Creates the JSON Object for the parameters of the requestprotected org.json.JSONObject
addUrlToParameters
(String fileUrl, List<String> fileUrls, org.json.JSONObject parameters) Creates the JSON object of the parameters of the requestprotected String
request
(HttpMethod httpVerb, String endpointName, org.json.JSONObject requestArguments) Submit the HTTP request.protected CompletableFuture<String>
requestAsync
(HttpMethod httpVerb, String endpointName, org.json.JSONObject requestArguments) Submit the HTTP request.void
setBaseUrl
(String baseUrl) By default, the base URL is https://api.veryfi.com/api/;void
setHttpClient
(HttpClient httpClient) By default is https://api.veryfi.com/api/;void
setTimeOut
(int timeOut) Define new time out for the requests in seconds
-
Field Details
-
logger
-
-
Constructor Details
-
NetworkClient
Creates an instance ofNetworkClient
.- Parameters:
credentials
- theCredentials
provided by Veryfi.apiVersion
- theint
api version to use Veryfi.
-
NetworkClient
Creates an instance ofNetworkClient
.- Parameters:
credentials
- theCredentials
provided by Veryfi.apiVersion
- theint
api version to use Veryfi.httpClient
-HttpClient
for the Veryfi API
-
-
Method Details
-
request
protected String request(HttpMethod httpVerb, String endpointName, org.json.JSONObject requestArguments) Submit the HTTP request.- Parameters:
httpVerb
- HTTP MethodendpointName
- Endpoint name such as 'documents', 'users', etc.requestArguments
- JSON payload to send to Veryfi- Returns:
- A JSON of the response data.
-
requestAsync
protected CompletableFuture<String> requestAsync(HttpMethod httpVerb, String endpointName, org.json.JSONObject requestArguments) Submit the HTTP request.- Parameters:
httpVerb
- HTTP MethodendpointName
- Endpoint name such as 'documents', 'users', etc.requestArguments
- JSON payload to send to Veryfi- Returns:
- A JSON of the response data.
-
setTimeOut
public void setTimeOut(int timeOut) Define new time out for the requests in seconds- Parameters:
timeOut
- of the http requests in seconds
-
setBaseUrl
By default, the base URL is https://api.veryfi.com/api/;- Parameters:
baseUrl
- for the Veryfi API
-
setHttpClient
By default is https://api.veryfi.com/api/;- Parameters:
httpClient
-HttpClient
for the Veryfi API
-
addFileToParameters
Creates the JSON Object for the parameters of the request- Parameters:
filePath
- Path on disk to a file to submit for data extractionparameters
- Additional request parameters- Returns:
- the JSON object of the parameters of the request
-
addUrlToParameters
protected org.json.JSONObject addUrlToParameters(String fileUrl, List<String> fileUrls, org.json.JSONObject parameters) Creates the JSON object of the parameters of the request- Parameters:
fileUrl
- Required if file_urls isn't specified. Publicly accessible URL to a file, e.g. "https://cdn.example.com/receipt.jpg".fileUrls
- Required if file_url isn't specifies. List of publicly accessible URLs to multiple files, e.g. ["https://cdn.example.com/receipt1.jpg", "https://cdn.example.com/receipt2.jpg"]parameters
- Additional request parameters- Returns:
- JSON object of the request arguments
-