diff --git a/.release.json b/.release.json index 45575476..187acb19 100644 --- a/.release.json +++ b/.release.json @@ -1,9 +1,9 @@ { "source": { "repo_url": "https://github.com/onfido/onfido-openapi-spec", - "short_sha": "30c4d08", - "long_sha": "30c4d08a018e09bc02d87e6c04a137c371541163", - "version": "v5.6.0" + "short_sha": "5e1a0b3", + "long_sha": "5e1a0b371b070316fd6b1b7d6fa60e2056047e00", + "version": "v5.7.0" }, - "release": "v6.6.0" + "release": "v6.7.0" } diff --git a/README.md b/README.md index 0c8ecbc3..ed5f9764 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ Add this dependency to your project's POM: com.onfido onfido-api-java - 6.6.0 + 6.7.0 compile ``` @@ -66,7 +66,7 @@ Add this dependency to your project's build file: } dependencies { - implementation "com.onfido:onfido-api-java:6.6.0" + implementation "com.onfido:onfido-api-java:6.7.0" } ``` @@ -80,10 +80,10 @@ mvn clean package Then manually install the following JARs: -- `target/onfido-api-java-6.6.0.jar` +- `target/onfido-api-java-6.7.0.jar` - `target/lib/*.jar` -The latest version can be found at . +The latest version can be found at . ## Getting Started diff --git a/build.gradle b/build.gradle index f9582518..9ce1c4cb 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'com.onfido' -version = '6.6.0' +version = '6.7.0' buildscript { repositories { diff --git a/build.sbt b/build.sbt index 11959438..c5067eba 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "com.onfido", name := "onfido-api-java", - version := "6.6.0", + version := "6.7.0", scalaVersion := "2.11.4", scalacOptions ++= Seq("-feature"), javacOptions in compile ++= Seq("-Xlint:deprecation"), diff --git a/pom.xml b/pom.xml index 2a12b1ee..ef61bb2c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ onfido-api-java jar onfido-api-java - 6.6.0 + 6.7.0 https://documentation.onfido.com Official Java API client library for the Onfido API diff --git a/src/main/java/com/onfido/ApiClient.java b/src/main/java/com/onfido/ApiClient.java index d17c5d1a..511c91ba 100644 --- a/src/main/java/com/onfido/ApiClient.java +++ b/src/main/java/com/onfido/ApiClient.java @@ -162,7 +162,7 @@ private void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("onfido-java/6.6.0"); + setUserAgent("onfido-java/6.7.0"); authentications = new HashMap(); } diff --git a/src/main/java/com/onfido/Configuration.java b/src/main/java/com/onfido/Configuration.java index 0005de10..6dd47f11 100644 --- a/src/main/java/com/onfido/Configuration.java +++ b/src/main/java/com/onfido/Configuration.java @@ -15,7 +15,7 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") public class Configuration { - public static final String VERSION = "6.6.0"; + public static final String VERSION = "6.7.0"; private static ApiClient defaultApiClient = new ApiClient(); diff --git a/src/main/java/com/onfido/JSON.java b/src/main/java/com/onfido/JSON.java index 7b6662c5..f851e686 100644 --- a/src/main/java/com/onfido/JSON.java +++ b/src/main/java/com/onfido/JSON.java @@ -341,6 +341,9 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.LocationShared.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.MotionCapture.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.MotionCapturesList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.Passkey.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.PasskeyUpdater.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.PasskeysList.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.PhotoAutoReasons.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.PhotoReasons.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.ProofOfAddressBreakdown.CustomTypeAdapterFactory()); @@ -365,6 +368,10 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.SdkTokenBuilder.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.SdkTokenRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.SdkTokenResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.SigningDocument.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.SigningDocumentResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.SigningDocumentShared.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.SigningDocumentsList.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.Task.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.TaskItem.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.TimelineFileReference.CustomTypeAdapterFactory()); diff --git a/src/main/java/com/onfido/api/DefaultApi.java b/src/main/java/com/onfido/api/DefaultApi.java index f89eb24f..d32c2045 100644 --- a/src/main/java/com/onfido/api/DefaultApi.java +++ b/src/main/java/com/onfido/api/DefaultApi.java @@ -57,12 +57,17 @@ import com.onfido.model.MotionCapture; import com.onfido.model.MotionCapturesList; import java.time.OffsetDateTime; +import com.onfido.model.Passkey; +import com.onfido.model.PasskeyUpdater; +import com.onfido.model.PasskeysList; import com.onfido.model.RepeatAttemptsList; import com.onfido.model.Report; import com.onfido.model.ReportsList; import com.onfido.model.ResultsFeedback; import com.onfido.model.SdkToken; import com.onfido.model.SdkTokenBuilder; +import com.onfido.model.SigningDocument; +import com.onfido.model.SigningDocumentsList; import com.onfido.model.Task; import com.onfido.model.TaskItem; import com.onfido.model.TimelineFileReference; @@ -1311,6 +1316,278 @@ public okhttp3.Call deleteApplicantAsync(UUID applicantId, final ApiCallback + Response Details + Status Code Description Response Headers + 204 Passkey deleted - + 404 Passkey not found - + 0 Unexpected error - + + */ + public okhttp3.Call deletePasskeyCall(String username, String passkeyId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/passkeys/{username}/{passkey_id}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())) + .replace("{" + "passkey_id" + "}", localVarApiClient.escapeString(passkeyId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Token" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deletePasskeyValidateBeforeCall(String username, String passkeyId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling deletePasskey(Async)"); + } + + // verify the required parameter 'passkeyId' is set + if (passkeyId == null) { + throw new ApiException("Missing the required parameter 'passkeyId' when calling deletePasskey(Async)"); + } + + return deletePasskeyCall(username, passkeyId, _callback); + + } + + /** + * Delete passkey + * Deletes a passkey. + * @param username Username that owns the passkey. (required) + * @param passkeyId Passkey ID. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
204 Passkey deleted -
404 Passkey not found -
0 Unexpected error -
+ */ + public void deletePasskey(String username, String passkeyId) throws ApiException { + deletePasskeyWithHttpInfo(username, passkeyId); + } + + /** + * Delete passkey + * Deletes a passkey. + * @param username Username that owns the passkey. (required) + * @param passkeyId Passkey ID. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
204 Passkey deleted -
404 Passkey not found -
0 Unexpected error -
+ */ + public ApiResponse deletePasskeyWithHttpInfo(String username, String passkeyId) throws ApiException { + okhttp3.Call localVarCall = deletePasskeyValidateBeforeCall(username, passkeyId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete passkey (asynchronously) + * Deletes a passkey. + * @param username Username that owns the passkey. (required) + * @param passkeyId Passkey ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
204 Passkey deleted -
404 Passkey not found -
0 Unexpected error -
+ */ + public okhttp3.Call deletePasskeyAsync(String username, String passkeyId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deletePasskeyValidateBeforeCall(username, passkeyId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deletePasskeys + * @param username Username whose passkeys will be deleted. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
204 All passkeys deleted -
404 Passkey not found -
0 Unexpected error -
+ */ + public okhttp3.Call deletePasskeysCall(String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/passkeys/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Token" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deletePasskeysValidateBeforeCall(String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling deletePasskeys(Async)"); + } + + return deletePasskeysCall(username, _callback); + + } + + /** + * Delete passkeys + * Removes every passkey for the username. + * @param username Username whose passkeys will be deleted. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
204 All passkeys deleted -
404 Passkey not found -
0 Unexpected error -
+ */ + public void deletePasskeys(String username) throws ApiException { + deletePasskeysWithHttpInfo(username); + } + + /** + * Delete passkeys + * Removes every passkey for the username. + * @param username Username whose passkeys will be deleted. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
204 All passkeys deleted -
404 Passkey not found -
0 Unexpected error -
+ */ + public ApiResponse deletePasskeysWithHttpInfo(String username) throws ApiException { + okhttp3.Call localVarCall = deletePasskeysValidateBeforeCall(username, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete passkeys (asynchronously) + * Removes every passkey for the username. + * @param username Username whose passkeys will be deleted. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
204 All passkeys deleted -
404 Passkey not found -
0 Unexpected error -
+ */ + public okhttp3.Call deletePasskeysAsync(String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deletePasskeysValidateBeforeCall(username, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } /** * Build call for deleteWatchlistMonitor * @param monitorId (required) @@ -3326,8 +3603,9 @@ public okhttp3.Call downloadQesDocumentAsync(UUID workflowRunId, UUID fileId, fi return localVarCall; } /** - * Build call for downloadSignedEvidenceFile - * @param workflowRunId Workflow Run ID (required) + * Build call for downloadSesDocument + * @param workflowRunId The unique identifier of the Workflow Run for which you want to retrieve the signed document. (required) + * @param id The unique identifier of the file which you want to retrieve. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -3336,11 +3614,11 @@ public okhttp3.Call downloadQesDocumentAsync(UUID workflowRunId, UUID fileId, fi Response Details Status Code Description Response Headers 302 Found * Location - Link to the Timeline File.
- 200 The signed evidence PDF binary data. - + 200 The signed document PDF binary data. - 0 Unexpected error - */ - public okhttp3.Call downloadSignedEvidenceFileCall(UUID workflowRunId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call downloadSesDocumentCall(UUID workflowRunId, UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; @@ -3357,8 +3635,7 @@ public okhttp3.Call downloadSignedEvidenceFileCall(UUID workflowRunId, final Api Object localVarPostBody = null; // create path and map variables - String localVarPath = "/workflow_runs/{workflow_run_id}/signed_evidence_file" - .replace("{" + "workflow_run_id" + "}", localVarApiClient.escapeString(workflowRunId.toString())); + String localVarPath = "/simple_electronic_signature/documents"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -3366,6 +3643,14 @@ public okhttp3.Call downloadSignedEvidenceFileCall(UUID workflowRunId, final Api Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); + if (workflowRunId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("workflow_run_id", workflowRunId)); + } + + if (id != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("id", id)); + } + final String[] localVarAccepts = { "application/pdf", "application/json" @@ -3387,20 +3672,26 @@ public okhttp3.Call downloadSignedEvidenceFileCall(UUID workflowRunId, final Api } @SuppressWarnings("rawtypes") - private okhttp3.Call downloadSignedEvidenceFileValidateBeforeCall(UUID workflowRunId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call downloadSesDocumentValidateBeforeCall(UUID workflowRunId, UUID id, final ApiCallback _callback) throws ApiException { // verify the required parameter 'workflowRunId' is set if (workflowRunId == null) { - throw new ApiException("Missing the required parameter 'workflowRunId' when calling downloadSignedEvidenceFile(Async)"); + throw new ApiException("Missing the required parameter 'workflowRunId' when calling downloadSesDocument(Async)"); } - return downloadSignedEvidenceFileCall(workflowRunId, _callback); + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling downloadSesDocument(Async)"); + } + + return downloadSesDocumentCall(workflowRunId, id, _callback); } /** - * Retrieve Workflow Run Evidence Summary File - * Retrieves the signed evidence file for the designated Workflow Run - * @param workflowRunId Workflow Run ID (required) + * Retrieves the signed document or signing transaction receipt + * Retrieves the signed document or signing transaction receipt depending on the id provided. + * @param workflowRunId The unique identifier of the Workflow Run for which you want to retrieve the signed document. (required) + * @param id The unique identifier of the file which you want to retrieve. (required) * @return FileTransfer * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -3408,19 +3699,20 @@ private okhttp3.Call downloadSignedEvidenceFileValidateBeforeCall(UUID workflowR Response Details Status Code Description Response Headers 302 Found * Location - Link to the Timeline File.
- 200 The signed evidence PDF binary data. - + 200 The signed document PDF binary data. - 0 Unexpected error - */ - public FileTransfer downloadSignedEvidenceFile(UUID workflowRunId) throws ApiException { - ApiResponse localVarResp = downloadSignedEvidenceFileWithHttpInfo(workflowRunId); + public FileTransfer downloadSesDocument(UUID workflowRunId, UUID id) throws ApiException { + ApiResponse localVarResp = downloadSesDocumentWithHttpInfo(workflowRunId, id); return localVarResp.getData(); } /** - * Retrieve Workflow Run Evidence Summary File - * Retrieves the signed evidence file for the designated Workflow Run - * @param workflowRunId Workflow Run ID (required) + * Retrieves the signed document or signing transaction receipt + * Retrieves the signed document or signing transaction receipt depending on the id provided. + * @param workflowRunId The unique identifier of the Workflow Run for which you want to retrieve the signed document. (required) + * @param id The unique identifier of the file which you want to retrieve. (required) * @return ApiResponse<FileTransfer> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -3428,20 +3720,21 @@ public FileTransfer downloadSignedEvidenceFile(UUID workflowRunId) throws ApiExc Response Details Status Code Description Response Headers 302 Found * Location - Link to the Timeline File.
- 200 The signed evidence PDF binary data. - + 200 The signed document PDF binary data. - 0 Unexpected error - */ - public ApiResponse downloadSignedEvidenceFileWithHttpInfo(UUID workflowRunId) throws ApiException { - okhttp3.Call localVarCall = downloadSignedEvidenceFileValidateBeforeCall(workflowRunId, null); + public ApiResponse downloadSesDocumentWithHttpInfo(UUID workflowRunId, UUID id) throws ApiException { + okhttp3.Call localVarCall = downloadSesDocumentValidateBeforeCall(workflowRunId, id, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Retrieve Workflow Run Evidence Summary File (asynchronously) - * Retrieves the signed evidence file for the designated Workflow Run - * @param workflowRunId Workflow Run ID (required) + * Retrieves the signed document or signing transaction receipt (asynchronously) + * Retrieves the signed document or signing transaction receipt depending on the id provided. + * @param workflowRunId The unique identifier of the Workflow Run for which you want to retrieve the signed document. (required) + * @param id The unique identifier of the file which you want to retrieve. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -3450,19 +3743,287 @@ public ApiResponse downloadSignedEvidenceFileWithHttpInfo(UUID wor Response Details Status Code Description Response Headers 302 Found * Location - Link to the Timeline File.
- 200 The signed evidence PDF binary data. - + 200 The signed document PDF binary data. - 0 Unexpected error - */ - public okhttp3.Call downloadSignedEvidenceFileAsync(UUID workflowRunId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call downloadSesDocumentAsync(UUID workflowRunId, UUID id, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = downloadSignedEvidenceFileValidateBeforeCall(workflowRunId, _callback); + okhttp3.Call localVarCall = downloadSesDocumentValidateBeforeCall(workflowRunId, id, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** - * Build call for extract + * Build call for downloadSignedEvidenceFile + * @param workflowRunId Workflow Run ID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
302 Found * Location - Link to the Timeline File.
200 The signed evidence PDF binary data. -
0 Unexpected error -
+ */ + public okhttp3.Call downloadSignedEvidenceFileCall(UUID workflowRunId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/workflow_runs/{workflow_run_id}/signed_evidence_file" + .replace("{" + "workflow_run_id" + "}", localVarApiClient.escapeString(workflowRunId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/pdf", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Token" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call downloadSignedEvidenceFileValidateBeforeCall(UUID workflowRunId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'workflowRunId' is set + if (workflowRunId == null) { + throw new ApiException("Missing the required parameter 'workflowRunId' when calling downloadSignedEvidenceFile(Async)"); + } + + return downloadSignedEvidenceFileCall(workflowRunId, _callback); + + } + + /** + * Retrieve Workflow Run Evidence Summary File + * Retrieves the signed evidence file for the designated Workflow Run + * @param workflowRunId Workflow Run ID (required) + * @return FileTransfer + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
302 Found * Location - Link to the Timeline File.
200 The signed evidence PDF binary data. -
0 Unexpected error -
+ */ + public FileTransfer downloadSignedEvidenceFile(UUID workflowRunId) throws ApiException { + ApiResponse localVarResp = downloadSignedEvidenceFileWithHttpInfo(workflowRunId); + return localVarResp.getData(); + } + + /** + * Retrieve Workflow Run Evidence Summary File + * Retrieves the signed evidence file for the designated Workflow Run + * @param workflowRunId Workflow Run ID (required) + * @return ApiResponse<FileTransfer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
302 Found * Location - Link to the Timeline File.
200 The signed evidence PDF binary data. -
0 Unexpected error -
+ */ + public ApiResponse downloadSignedEvidenceFileWithHttpInfo(UUID workflowRunId) throws ApiException { + okhttp3.Call localVarCall = downloadSignedEvidenceFileValidateBeforeCall(workflowRunId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Retrieve Workflow Run Evidence Summary File (asynchronously) + * Retrieves the signed evidence file for the designated Workflow Run + * @param workflowRunId Workflow Run ID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
302 Found * Location - Link to the Timeline File.
200 The signed evidence PDF binary data. -
0 Unexpected error -
+ */ + public okhttp3.Call downloadSignedEvidenceFileAsync(UUID workflowRunId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = downloadSignedEvidenceFileValidateBeforeCall(workflowRunId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for downloadSigningDocument + * @param signingDocumentId (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The signing document binary data -
0 Unexpected error -
+ */ + public okhttp3.Call downloadSigningDocumentCall(UUID signingDocumentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/signing_documents/{signing_document_id}/download" + .replace("{" + "signing_document_id" + "}", localVarApiClient.escapeString(signingDocumentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Token" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call downloadSigningDocumentValidateBeforeCall(UUID signingDocumentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'signingDocumentId' is set + if (signingDocumentId == null) { + throw new ApiException("Missing the required parameter 'signingDocumentId' when calling downloadSigningDocument(Async)"); + } + + return downloadSigningDocumentCall(signingDocumentId, _callback); + + } + + /** + * Download signing document + * Downloads specific signing documents belonging to an applicant. If successful, the response will be the binary data representing the pdf. + * @param signingDocumentId (required) + * @return FileTransfer + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The signing document binary data -
0 Unexpected error -
+ */ + public FileTransfer downloadSigningDocument(UUID signingDocumentId) throws ApiException { + ApiResponse localVarResp = downloadSigningDocumentWithHttpInfo(signingDocumentId); + return localVarResp.getData(); + } + + /** + * Download signing document + * Downloads specific signing documents belonging to an applicant. If successful, the response will be the binary data representing the pdf. + * @param signingDocumentId (required) + * @return ApiResponse<FileTransfer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The signing document binary data -
0 Unexpected error -
+ */ + public ApiResponse downloadSigningDocumentWithHttpInfo(UUID signingDocumentId) throws ApiException { + okhttp3.Call localVarCall = downloadSigningDocumentValidateBeforeCall(signingDocumentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Download signing document (asynchronously) + * Downloads specific signing documents belonging to an applicant. If successful, the response will be the binary data representing the pdf. + * @param signingDocumentId (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The signing document binary data -
0 Unexpected error -
+ */ + public okhttp3.Call downloadSigningDocumentAsync(UUID signingDocumentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = downloadSigningDocumentValidateBeforeCall(signingDocumentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for extract * @param extractRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute @@ -4774,6 +5335,151 @@ public okhttp3.Call findMotionCaptureAsync(UUID motionCaptureId, final ApiCallba localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for findPasskey + * @param username Username that owns the passkey. (required) + * @param passkeyId Passkey ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The requested passkey -
404 Passkey not found -
0 Unexpected error -
+ */ + public okhttp3.Call findPasskeyCall(String username, String passkeyId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/passkeys/{username}/{passkey_id}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())) + .replace("{" + "passkey_id" + "}", localVarApiClient.escapeString(passkeyId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Token" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call findPasskeyValidateBeforeCall(String username, String passkeyId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling findPasskey(Async)"); + } + + // verify the required parameter 'passkeyId' is set + if (passkeyId == null) { + throw new ApiException("Missing the required parameter 'passkeyId' when calling findPasskey(Async)"); + } + + return findPasskeyCall(username, passkeyId, _callback); + + } + + /** + * Retrieve passkey + * Returns a passkey's details. + * @param username Username that owns the passkey. (required) + * @param passkeyId Passkey ID. (required) + * @return Passkey + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The requested passkey -
404 Passkey not found -
0 Unexpected error -
+ */ + public Passkey findPasskey(String username, String passkeyId) throws ApiException { + ApiResponse localVarResp = findPasskeyWithHttpInfo(username, passkeyId); + return localVarResp.getData(); + } + + /** + * Retrieve passkey + * Returns a passkey's details. + * @param username Username that owns the passkey. (required) + * @param passkeyId Passkey ID. (required) + * @return ApiResponse<Passkey> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The requested passkey -
404 Passkey not found -
0 Unexpected error -
+ */ + public ApiResponse findPasskeyWithHttpInfo(String username, String passkeyId) throws ApiException { + okhttp3.Call localVarCall = findPasskeyValidateBeforeCall(username, passkeyId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Retrieve passkey (asynchronously) + * Returns a passkey's details. + * @param username Username that owns the passkey. (required) + * @param passkeyId Passkey ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The requested passkey -
404 Passkey not found -
0 Unexpected error -
+ */ + public okhttp3.Call findPasskeyAsync(String username, String passkeyId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = findPasskeyValidateBeforeCall(username, passkeyId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for findReport * @param reportId (required) @@ -4834,59 +5540,190 @@ public okhttp3.Call findReportCall(UUID reportId, final ApiCallback _callback) t } @SuppressWarnings("rawtypes") - private okhttp3.Call findReportValidateBeforeCall(UUID reportId, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'reportId' is set - if (reportId == null) { - throw new ApiException("Missing the required parameter 'reportId' when calling findReport(Async)"); + private okhttp3.Call findReportValidateBeforeCall(UUID reportId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'reportId' is set + if (reportId == null) { + throw new ApiException("Missing the required parameter 'reportId' when calling findReport(Async)"); + } + + return findReportCall(reportId, _callback); + + } + + /** + * Retrieve report + * A single report can be retrieved using this endpoint with the corresponding unique identifier. + * @param reportId (required) + * @return Report + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Report object -
0 Unexpected error -
+ */ + public Report findReport(UUID reportId) throws ApiException { + ApiResponse localVarResp = findReportWithHttpInfo(reportId); + return localVarResp.getData(); + } + + /** + * Retrieve report + * A single report can be retrieved using this endpoint with the corresponding unique identifier. + * @param reportId (required) + * @return ApiResponse<Report> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Report object -
0 Unexpected error -
+ */ + public ApiResponse findReportWithHttpInfo(UUID reportId) throws ApiException { + okhttp3.Call localVarCall = findReportValidateBeforeCall(reportId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Retrieve report (asynchronously) + * A single report can be retrieved using this endpoint with the corresponding unique identifier. + * @param reportId (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Report object -
0 Unexpected error -
+ */ + public okhttp3.Call findReportAsync(UUID reportId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = findReportValidateBeforeCall(reportId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for findSigningDocument + * @param signingDocumentId (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 A signing document -
0 Unexpected error -
+ */ + public okhttp3.Call findSigningDocumentCall(UUID signingDocumentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/signing_documents/{signing_document_id}" + .replace("{" + "signing_document_id" + "}", localVarApiClient.escapeString(signingDocumentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Token" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call findSigningDocumentValidateBeforeCall(UUID signingDocumentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'signingDocumentId' is set + if (signingDocumentId == null) { + throw new ApiException("Missing the required parameter 'signingDocumentId' when calling findSigningDocument(Async)"); } - return findReportCall(reportId, _callback); + return findSigningDocumentCall(signingDocumentId, _callback); } /** - * Retrieve report - * A single report can be retrieved using this endpoint with the corresponding unique identifier. - * @param reportId (required) - * @return Report + * Retrieve signing document + * A single signing document can be retrieved by calling this endpoint with the signing document's unique identifier. + * @param signingDocumentId (required) + * @return SigningDocument * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
Response Details
Status Code Description Response Headers
200 Report object -
200 A signing document -
0 Unexpected error -
*/ - public Report findReport(UUID reportId) throws ApiException { - ApiResponse localVarResp = findReportWithHttpInfo(reportId); + public SigningDocument findSigningDocument(UUID signingDocumentId) throws ApiException { + ApiResponse localVarResp = findSigningDocumentWithHttpInfo(signingDocumentId); return localVarResp.getData(); } /** - * Retrieve report - * A single report can be retrieved using this endpoint with the corresponding unique identifier. - * @param reportId (required) - * @return ApiResponse<Report> + * Retrieve signing document + * A single signing document can be retrieved by calling this endpoint with the signing document's unique identifier. + * @param signingDocumentId (required) + * @return ApiResponse<SigningDocument> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
Response Details
Status Code Description Response Headers
200 Report object -
200 A signing document -
0 Unexpected error -
*/ - public ApiResponse findReportWithHttpInfo(UUID reportId) throws ApiException { - okhttp3.Call localVarCall = findReportValidateBeforeCall(reportId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse findSigningDocumentWithHttpInfo(UUID signingDocumentId) throws ApiException { + okhttp3.Call localVarCall = findSigningDocumentValidateBeforeCall(signingDocumentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Retrieve report (asynchronously) - * A single report can be retrieved using this endpoint with the corresponding unique identifier. - * @param reportId (required) + * Retrieve signing document (asynchronously) + * A single signing document can be retrieved by calling this endpoint with the signing document's unique identifier. + * @param signingDocumentId (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -4894,14 +5731,14 @@ public ApiResponse findReportWithHttpInfo(UUID reportId) throws ApiExcep - +
Response Details
Status Code Description Response Headers
200 Report object -
200 A signing document -
0 Unexpected error -
*/ - public okhttp3.Call findReportAsync(UUID reportId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call findSigningDocumentAsync(UUID signingDocumentId, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = findReportValidateBeforeCall(reportId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + okhttp3.Call localVarCall = findSigningDocumentValidateBeforeCall(signingDocumentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } @@ -6792,6 +7629,141 @@ public okhttp3.Call listMotionCapturesAsync(UUID applicantId, final ApiCallback< localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for listPasskeys + * @param username Username that owns the passkeys. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Passkeys belonging to the username -
404 Passkey not found -
0 Unexpected error -
+ */ + public okhttp3.Call listPasskeysCall(String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/passkeys/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Token" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listPasskeysValidateBeforeCall(String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling listPasskeys(Async)"); + } + + return listPasskeysCall(username, _callback); + + } + + /** + * List passkeys + * Returns every passkey registered under the supplied username. + * @param username Username that owns the passkeys. (required) + * @return PasskeysList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Passkeys belonging to the username -
404 Passkey not found -
0 Unexpected error -
+ */ + public PasskeysList listPasskeys(String username) throws ApiException { + ApiResponse localVarResp = listPasskeysWithHttpInfo(username); + return localVarResp.getData(); + } + + /** + * List passkeys + * Returns every passkey registered under the supplied username. + * @param username Username that owns the passkeys. (required) + * @return ApiResponse<PasskeysList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Passkeys belonging to the username -
404 Passkey not found -
0 Unexpected error -
+ */ + public ApiResponse listPasskeysWithHttpInfo(String username) throws ApiException { + okhttp3.Call localVarCall = listPasskeysValidateBeforeCall(username, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List passkeys (asynchronously) + * Returns every passkey registered under the supplied username. + * @param username Username that owns the passkeys. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Passkeys belonging to the username -
404 Passkey not found -
0 Unexpected error -
+ */ + public okhttp3.Call listPasskeysAsync(String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = listPasskeysValidateBeforeCall(username, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for listRepeatAttempts * @param reportId (required) @@ -6954,7 +7926,141 @@ public okhttp3.Call listReportsCall(UUID checkId, final ApiCallback _callback) t Object localVarPostBody = null; // create path and map variables - String localVarPath = "/reports"; + String localVarPath = "/reports"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (checkId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("check_id", checkId)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Token" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listReportsValidateBeforeCall(UUID checkId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'checkId' is set + if (checkId == null) { + throw new ApiException("Missing the required parameter 'checkId' when calling listReports(Async)"); + } + + return listReportsCall(checkId, _callback); + + } + + /** + * List reports + * All the reports belonging to a particular check can be listed from this endpoint. + * @param checkId (required) + * @return ReportsList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 List of Reports -
0 Unexpected error -
+ */ + public ReportsList listReports(UUID checkId) throws ApiException { + ApiResponse localVarResp = listReportsWithHttpInfo(checkId); + return localVarResp.getData(); + } + + /** + * List reports + * All the reports belonging to a particular check can be listed from this endpoint. + * @param checkId (required) + * @return ApiResponse<ReportsList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 List of Reports -
0 Unexpected error -
+ */ + public ApiResponse listReportsWithHttpInfo(UUID checkId) throws ApiException { + okhttp3.Call localVarCall = listReportsValidateBeforeCall(checkId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List reports (asynchronously) + * All the reports belonging to a particular check can be listed from this endpoint. + * @param checkId (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 List of Reports -
0 Unexpected error -
+ */ + public okhttp3.Call listReportsAsync(UUID checkId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = listReportsValidateBeforeCall(checkId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for listSigningDocuments + * @param applicantId (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 List of Signing Documents -
0 Unexpected error -
+ */ + public okhttp3.Call listSigningDocumentsCall(UUID applicantId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/signing_documents"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -6962,8 +8068,8 @@ public okhttp3.Call listReportsCall(UUID checkId, final ApiCallback _callback) t Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (checkId != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("check_id", checkId)); + if (applicantId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("applicant_id", applicantId)); } final String[] localVarAccepts = { @@ -6986,59 +8092,59 @@ public okhttp3.Call listReportsCall(UUID checkId, final ApiCallback _callback) t } @SuppressWarnings("rawtypes") - private okhttp3.Call listReportsValidateBeforeCall(UUID checkId, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'checkId' is set - if (checkId == null) { - throw new ApiException("Missing the required parameter 'checkId' when calling listReports(Async)"); + private okhttp3.Call listSigningDocumentsValidateBeforeCall(UUID applicantId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'applicantId' is set + if (applicantId == null) { + throw new ApiException("Missing the required parameter 'applicantId' when calling listSigningDocuments(Async)"); } - return listReportsCall(checkId, _callback); + return listSigningDocumentsCall(applicantId, _callback); } /** - * List reports - * All the reports belonging to a particular check can be listed from this endpoint. - * @param checkId (required) - * @return ReportsList + * List signing documents + * All signing documents belonging to an applicant can be listed from this endpoint + * @param applicantId (required) + * @return SigningDocumentsList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
Response Details
Status Code Description Response Headers
200 List of Reports -
200 List of Signing Documents -
0 Unexpected error -
*/ - public ReportsList listReports(UUID checkId) throws ApiException { - ApiResponse localVarResp = listReportsWithHttpInfo(checkId); + public SigningDocumentsList listSigningDocuments(UUID applicantId) throws ApiException { + ApiResponse localVarResp = listSigningDocumentsWithHttpInfo(applicantId); return localVarResp.getData(); } /** - * List reports - * All the reports belonging to a particular check can be listed from this endpoint. - * @param checkId (required) - * @return ApiResponse<ReportsList> + * List signing documents + * All signing documents belonging to an applicant can be listed from this endpoint + * @param applicantId (required) + * @return ApiResponse<SigningDocumentsList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
Response Details
Status Code Description Response Headers
200 List of Reports -
200 List of Signing Documents -
0 Unexpected error -
*/ - public ApiResponse listReportsWithHttpInfo(UUID checkId) throws ApiException { - okhttp3.Call localVarCall = listReportsValidateBeforeCall(checkId, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse listSigningDocumentsWithHttpInfo(UUID applicantId) throws ApiException { + okhttp3.Call localVarCall = listSigningDocumentsValidateBeforeCall(applicantId, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List reports (asynchronously) - * All the reports belonging to a particular check can be listed from this endpoint. - * @param checkId (required) + * List signing documents (asynchronously) + * All signing documents belonging to an applicant can be listed from this endpoint + * @param applicantId (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -7046,14 +8152,14 @@ public ApiResponse listReportsWithHttpInfo(UUID checkId) throws Api - +
Response Details
Status Code Description Response Headers
200 List of Reports -
200 List of Signing Documents -
0 Unexpected error -
*/ - public okhttp3.Call listReportsAsync(UUID checkId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call listSigningDocumentsAsync(UUID applicantId, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = listReportsValidateBeforeCall(checkId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + okhttp3.Call localVarCall = listSigningDocumentsValidateBeforeCall(applicantId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } @@ -8653,6 +9759,165 @@ public okhttp3.Call updateApplicantAsync(UUID applicantId, ApplicantUpdater appl localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for updatePasskey + * @param username Username that owns the passkey. (required) + * @param passkeyId Passkey ID. (required) + * @param passkeyUpdater Passkey update payload. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Passkey updated -
400 Invalid request body -
404 Passkey not found -
0 Unexpected error -
+ */ + public okhttp3.Call updatePasskeyCall(String username, String passkeyId, PasskeyUpdater passkeyUpdater, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = passkeyUpdater; + + // create path and map variables + String localVarPath = "/passkeys/{username}/{passkey_id}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())) + .replace("{" + "passkey_id" + "}", localVarApiClient.escapeString(passkeyId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Token" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePasskeyValidateBeforeCall(String username, String passkeyId, PasskeyUpdater passkeyUpdater, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling updatePasskey(Async)"); + } + + // verify the required parameter 'passkeyId' is set + if (passkeyId == null) { + throw new ApiException("Missing the required parameter 'passkeyId' when calling updatePasskey(Async)"); + } + + // verify the required parameter 'passkeyUpdater' is set + if (passkeyUpdater == null) { + throw new ApiException("Missing the required parameter 'passkeyUpdater' when calling updatePasskey(Async)"); + } + + return updatePasskeyCall(username, passkeyId, passkeyUpdater, _callback); + + } + + /** + * Update passkey + * Updates a passkey's state. + * @param username Username that owns the passkey. (required) + * @param passkeyId Passkey ID. (required) + * @param passkeyUpdater Passkey update payload. (required) + * @return Passkey + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Passkey updated -
400 Invalid request body -
404 Passkey not found -
0 Unexpected error -
+ */ + public Passkey updatePasskey(String username, String passkeyId, PasskeyUpdater passkeyUpdater) throws ApiException { + ApiResponse localVarResp = updatePasskeyWithHttpInfo(username, passkeyId, passkeyUpdater); + return localVarResp.getData(); + } + + /** + * Update passkey + * Updates a passkey's state. + * @param username Username that owns the passkey. (required) + * @param passkeyId Passkey ID. (required) + * @param passkeyUpdater Passkey update payload. (required) + * @return ApiResponse<Passkey> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Passkey updated -
400 Invalid request body -
404 Passkey not found -
0 Unexpected error -
+ */ + public ApiResponse updatePasskeyWithHttpInfo(String username, String passkeyId, PasskeyUpdater passkeyUpdater) throws ApiException { + okhttp3.Call localVarCall = updatePasskeyValidateBeforeCall(username, passkeyId, passkeyUpdater, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update passkey (asynchronously) + * Updates a passkey's state. + * @param username Username that owns the passkey. (required) + * @param passkeyId Passkey ID. (required) + * @param passkeyUpdater Passkey update payload. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Passkey updated -
400 Invalid request body -
404 Passkey not found -
0 Unexpected error -
+ */ + public okhttp3.Call updatePasskeyAsync(String username, String passkeyId, PasskeyUpdater passkeyUpdater, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePasskeyValidateBeforeCall(username, passkeyId, passkeyUpdater, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for updateWatchlistMonitorMatch * @param monitorId (required) @@ -9420,4 +10685,152 @@ public okhttp3.Call uploadLivePhotoAsync(UUID applicantId, FileTransfer _file, B localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for uploadSigningDocument + * @param applicantId The ID of the applicant whose signing document is being uploaded. (required) + * @param _file The file to be uploaded. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
201 A signing document -
0 Unexpected error -
+ */ + public okhttp3.Call uploadSigningDocumentCall(UUID applicantId, FileTransfer _file, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/signing_documents"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (applicantId != null) { + localVarFormParams.put("applicant_id", applicantId); + } + + if (_file != null) { + localVarFormParams.put("file", _file); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Token" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadSigningDocumentValidateBeforeCall(UUID applicantId, FileTransfer _file, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'applicantId' is set + if (applicantId == null) { + throw new ApiException("Missing the required parameter 'applicantId' when calling uploadSigningDocument(Async)"); + } + + // verify the required parameter '_file' is set + if (_file == null) { + throw new ApiException("Missing the required parameter '_file' when calling uploadSigningDocument(Async)"); + } + + return uploadSigningDocumentCall(applicantId, _file, _callback); + + } + + /** + * Upload a signing document + * Signing documents are uploaded using this endpoint. Signing documents must be uploaded as a multipart form. The only valid file type is pdf. The file size must be between 2KB and 3MB. + * @param applicantId The ID of the applicant whose signing document is being uploaded. (required) + * @param _file The file to be uploaded. (required) + * @return SigningDocument + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
201 A signing document -
0 Unexpected error -
+ */ + public SigningDocument uploadSigningDocument(UUID applicantId, FileTransfer _file) throws ApiException { + ApiResponse localVarResp = uploadSigningDocumentWithHttpInfo(applicantId, _file); + return localVarResp.getData(); + } + + /** + * Upload a signing document + * Signing documents are uploaded using this endpoint. Signing documents must be uploaded as a multipart form. The only valid file type is pdf. The file size must be between 2KB and 3MB. + * @param applicantId The ID of the applicant whose signing document is being uploaded. (required) + * @param _file The file to be uploaded. (required) + * @return ApiResponse<SigningDocument> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
201 A signing document -
0 Unexpected error -
+ */ + public ApiResponse uploadSigningDocumentWithHttpInfo(UUID applicantId, FileTransfer _file) throws ApiException { + okhttp3.Call localVarCall = uploadSigningDocumentValidateBeforeCall(applicantId, _file, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Upload a signing document (asynchronously) + * Signing documents are uploaded using this endpoint. Signing documents must be uploaded as a multipart form. The only valid file type is pdf. The file size must be between 2KB and 3MB. + * @param applicantId The ID of the applicant whose signing document is being uploaded. (required) + * @param _file The file to be uploaded. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
201 A signing document -
0 Unexpected error -
+ */ + public okhttp3.Call uploadSigningDocumentAsync(UUID applicantId, FileTransfer _file, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadSigningDocumentValidateBeforeCall(applicantId, _file, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } } diff --git a/src/main/java/com/onfido/model/Passkey.java b/src/main/java/com/onfido/model/Passkey.java new file mode 100644 index 00000000..9d0c3abd --- /dev/null +++ b/src/main/java/com/onfido/model/Passkey.java @@ -0,0 +1,469 @@ +/* + * Onfido Public API v3.6 + * The Onfido Public API (v3.6) + * + * The version of the OpenAPI document: v3.6 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.onfido.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.onfido.JSON; + +/** + * Passkey + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class Passkey { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_APPLICATION_DOMAIN = "application_domain"; + @SerializedName(SERIALIZED_NAME_APPLICATION_DOMAIN) + @javax.annotation.Nonnull + private String applicationDomain; + + /** + * Current passkey state. + */ + @JsonAdapter(StateEnum.Adapter.class) + public enum StateEnum { + ACTIVE("ACTIVE"), + + INACTIVE("INACTIVE"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + StateEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StateEnum fromValue(String value) { + for (StateEnum b : StateEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StateEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StateEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StateEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StateEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATE = "state"; + @SerializedName(SERIALIZED_NAME_STATE) + @javax.annotation.Nonnull + private StateEnum state; + + public static final String SERIALIZED_NAME_CREATED_AT = "created_at"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_LAST_USED_AT = "lastUsedAt"; + @SerializedName(SERIALIZED_NAME_LAST_USED_AT) + @javax.annotation.Nullable + private OffsetDateTime lastUsedAt; + + public Passkey() { + } + + public Passkey id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Passkey identifier. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public Passkey applicationDomain(@javax.annotation.Nonnull String applicationDomain) { + this.applicationDomain = applicationDomain; + return this; + } + + /** + * domain that the passkey is registered to, the rpId. + * @return applicationDomain + */ + @javax.annotation.Nonnull + public String getApplicationDomain() { + return applicationDomain; + } + + public void setApplicationDomain(@javax.annotation.Nonnull String applicationDomain) { + this.applicationDomain = applicationDomain; + } + + + public Passkey state(@javax.annotation.Nonnull StateEnum state) { + this.state = state; + return this; + } + + /** + * Current passkey state. + * @return state + */ + @javax.annotation.Nonnull + public StateEnum getState() { + return state; + } + + public void setState(@javax.annotation.Nonnull StateEnum state) { + this.state = state; + } + + + public Passkey createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Timestamp when the passkey was created. + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public Passkey lastUsedAt(@javax.annotation.Nullable OffsetDateTime lastUsedAt) { + this.lastUsedAt = lastUsedAt; + return this; + } + + /** + * Timestamp when the passkey was last used. + * @return lastUsedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getLastUsedAt() { + return lastUsedAt; + } + + public void setLastUsedAt(@javax.annotation.Nullable OffsetDateTime lastUsedAt) { + this.lastUsedAt = lastUsedAt; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Passkey instance itself + */ + public Passkey putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Passkey passkey = (Passkey) o; + return Objects.equals(this.id, passkey.id) && + Objects.equals(this.applicationDomain, passkey.applicationDomain) && + Objects.equals(this.state, passkey.state) && + Objects.equals(this.createdAt, passkey.createdAt) && + Objects.equals(this.lastUsedAt, passkey.lastUsedAt)&& + Objects.equals(this.additionalProperties, passkey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, applicationDomain, state, createdAt, lastUsedAt, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Passkey {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" applicationDomain: ").append(toIndentedString(applicationDomain)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" lastUsedAt: ").append(toIndentedString(lastUsedAt)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("application_domain"); + openapiFields.add("state"); + openapiFields.add("created_at"); + openapiFields.add("lastUsedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("application_domain"); + openapiRequiredFields.add("state"); + openapiRequiredFields.add("created_at"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Passkey + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Passkey.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Passkey is not found in the empty JSON string", Passkey.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Passkey.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("application_domain").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `application_domain` to be a primitive type in the JSON string but got `%s`", jsonObj.get("application_domain").toString())); + } + if (!jsonObj.get("state").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString())); + } + // validate the required field `state` + StateEnum.validateJsonElement(jsonObj.get("state")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Passkey.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Passkey' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Passkey.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Passkey value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else if (jsonElement.isJsonObject()) { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Passkey read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Passkey instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Passkey given an JSON string + * + * @param jsonString JSON string + * @return An instance of Passkey + * @throws IOException if the JSON string is invalid with respect to Passkey + */ + public static Passkey fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Passkey.class); + } + + /** + * Convert an instance of Passkey to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/PasskeyUpdater.java b/src/main/java/com/onfido/model/PasskeyUpdater.java new file mode 100644 index 00000000..6e1274c8 --- /dev/null +++ b/src/main/java/com/onfido/model/PasskeyUpdater.java @@ -0,0 +1,351 @@ +/* + * Onfido Public API v3.6 + * The Onfido Public API (v3.6) + * + * The version of the OpenAPI document: v3.6 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.onfido.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.onfido.JSON; + +/** + * PasskeyUpdater + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PasskeyUpdater { + /** + * Desired passkey state value. + */ + @JsonAdapter(StateEnum.Adapter.class) + public enum StateEnum { + ACTIVE("ACTIVE"), + + INACTIVE("INACTIVE"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + StateEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StateEnum fromValue(String value) { + for (StateEnum b : StateEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StateEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StateEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StateEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StateEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATE = "state"; + @SerializedName(SERIALIZED_NAME_STATE) + @javax.annotation.Nonnull + private StateEnum state; + + public PasskeyUpdater() { + } + + public PasskeyUpdater state(@javax.annotation.Nonnull StateEnum state) { + this.state = state; + return this; + } + + /** + * Desired passkey state value. + * @return state + */ + @javax.annotation.Nonnull + public StateEnum getState() { + return state; + } + + public void setState(@javax.annotation.Nonnull StateEnum state) { + this.state = state; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PasskeyUpdater instance itself + */ + public PasskeyUpdater putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PasskeyUpdater passkeyUpdater = (PasskeyUpdater) o; + return Objects.equals(this.state, passkeyUpdater.state)&& + Objects.equals(this.additionalProperties, passkeyUpdater.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(state, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PasskeyUpdater {\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("state"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("state"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PasskeyUpdater + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PasskeyUpdater.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PasskeyUpdater is not found in the empty JSON string", PasskeyUpdater.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PasskeyUpdater.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("state").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString())); + } + // validate the required field `state` + StateEnum.validateJsonElement(jsonObj.get("state")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PasskeyUpdater.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PasskeyUpdater' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PasskeyUpdater.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PasskeyUpdater value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else if (jsonElement.isJsonObject()) { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PasskeyUpdater read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PasskeyUpdater instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PasskeyUpdater given an JSON string + * + * @param jsonString JSON string + * @return An instance of PasskeyUpdater + * @throws IOException if the JSON string is invalid with respect to PasskeyUpdater + */ + public static PasskeyUpdater fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PasskeyUpdater.class); + } + + /** + * Convert an instance of PasskeyUpdater to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/PasskeysList.java b/src/main/java/com/onfido/model/PasskeysList.java new file mode 100644 index 00000000..235ad7e9 --- /dev/null +++ b/src/main/java/com/onfido/model/PasskeysList.java @@ -0,0 +1,313 @@ +/* + * Onfido Public API v3.6 + * The Onfido Public API (v3.6) + * + * The version of the OpenAPI document: v3.6 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.onfido.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.onfido.model.Passkey; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.onfido.JSON; + +/** + * PasskeysList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class PasskeysList { + public static final String SERIALIZED_NAME_PASSKEYS = "passkeys"; + @SerializedName(SERIALIZED_NAME_PASSKEYS) + @javax.annotation.Nonnull + private List passkeys = new ArrayList<>(); + + public PasskeysList() { + } + + public PasskeysList passkeys(@javax.annotation.Nonnull List passkeys) { + this.passkeys = passkeys; + return this; + } + + public PasskeysList addPasskeysItem(Passkey passkeysItem) { + if (this.passkeys == null) { + this.passkeys = new ArrayList<>(); + } + this.passkeys.add(passkeysItem); + return this; + } + + /** + * Get passkeys + * @return passkeys + */ + @javax.annotation.Nonnull + public List getPasskeys() { + return passkeys; + } + + public void setPasskeys(@javax.annotation.Nonnull List passkeys) { + this.passkeys = passkeys; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PasskeysList instance itself + */ + public PasskeysList putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PasskeysList passkeysList = (PasskeysList) o; + return Objects.equals(this.passkeys, passkeysList.passkeys)&& + Objects.equals(this.additionalProperties, passkeysList.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(passkeys, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PasskeysList {\n"); + sb.append(" passkeys: ").append(toIndentedString(passkeys)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("passkeys"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("passkeys"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PasskeysList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PasskeysList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PasskeysList is not found in the empty JSON string", PasskeysList.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PasskeysList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("passkeys").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `passkeys` to be an array in the JSON string but got `%s`", jsonObj.get("passkeys").toString())); + } + + JsonArray jsonArraypasskeys = jsonObj.getAsJsonArray("passkeys"); + // validate the required field `passkeys` (array) + for (int i = 0; i < jsonArraypasskeys.size(); i++) { + Passkey.validateJsonElement(jsonArraypasskeys.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PasskeysList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PasskeysList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PasskeysList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PasskeysList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else if (jsonElement.isJsonObject()) { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PasskeysList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PasskeysList instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PasskeysList given an JSON string + * + * @param jsonString JSON string + * @return An instance of PasskeysList + * @throws IOException if the JSON string is invalid with respect to PasskeysList + */ + public static PasskeysList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PasskeysList.class); + } + + /** + * Convert an instance of PasskeysList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/SigningDocument.java b/src/main/java/com/onfido/model/SigningDocument.java new file mode 100644 index 00000000..07eb9cfc --- /dev/null +++ b/src/main/java/com/onfido/model/SigningDocument.java @@ -0,0 +1,501 @@ +/* + * Onfido Public API v3.6 + * The Onfido Public API (v3.6) + * + * The version of the OpenAPI document: v3.6 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.onfido.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.onfido.JSON; + +/** + * SigningDocument + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class SigningDocument { + public static final String SERIALIZED_NAME_APPLICANT_ID = "applicant_id"; + @SerializedName(SERIALIZED_NAME_APPLICANT_ID) + @javax.annotation.Nullable + private UUID applicantId; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_CREATED_AT = "created_at"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_HREF = "href"; + @SerializedName(SERIALIZED_NAME_HREF) + @javax.annotation.Nullable + private String href; + + public static final String SERIALIZED_NAME_DOWNLOAD_HREF = "download_href"; + @SerializedName(SERIALIZED_NAME_DOWNLOAD_HREF) + @javax.annotation.Nullable + private String downloadHref; + + public static final String SERIALIZED_NAME_FILE_TYPE = "file_type"; + @SerializedName(SERIALIZED_NAME_FILE_TYPE) + @javax.annotation.Nullable + private String fileType; + + public static final String SERIALIZED_NAME_FILE_NAME = "file_name"; + @SerializedName(SERIALIZED_NAME_FILE_NAME) + @javax.annotation.Nullable + private String fileName; + + public static final String SERIALIZED_NAME_FILE_SIZE = "file_size"; + @SerializedName(SERIALIZED_NAME_FILE_SIZE) + @javax.annotation.Nullable + private Integer fileSize; + + public SigningDocument() { + } + + public SigningDocument applicantId(@javax.annotation.Nullable UUID applicantId) { + this.applicantId = applicantId; + return this; + } + + /** + * The ID of the applicant whose signing document is being uploaded. + * @return applicantId + */ + @javax.annotation.Nullable + public UUID getApplicantId() { + return applicantId; + } + + public void setApplicantId(@javax.annotation.Nullable UUID applicantId) { + this.applicantId = applicantId; + } + + + public SigningDocument id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * The unique identifier for the signing document + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + public SigningDocument createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The date and time at which the signing document was uploaded + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public SigningDocument href(@javax.annotation.Nullable String href) { + this.href = href; + return this; + } + + /** + * The uri of this resource + * @return href + */ + @javax.annotation.Nullable + public String getHref() { + return href; + } + + public void setHref(@javax.annotation.Nullable String href) { + this.href = href; + } + + + public SigningDocument downloadHref(@javax.annotation.Nullable String downloadHref) { + this.downloadHref = downloadHref; + return this; + } + + /** + * The uri that can be used to download the signing document + * @return downloadHref + */ + @javax.annotation.Nullable + public String getDownloadHref() { + return downloadHref; + } + + public void setDownloadHref(@javax.annotation.Nullable String downloadHref) { + this.downloadHref = downloadHref; + } + + + public SigningDocument fileType(@javax.annotation.Nullable String fileType) { + this.fileType = fileType; + return this; + } + + /** + * The file type of the uploaded file + * @return fileType + */ + @javax.annotation.Nullable + public String getFileType() { + return fileType; + } + + public void setFileType(@javax.annotation.Nullable String fileType) { + this.fileType = fileType; + } + + + public SigningDocument fileName(@javax.annotation.Nullable String fileName) { + this.fileName = fileName; + return this; + } + + /** + * The name of the uploaded file + * @return fileName + */ + @javax.annotation.Nullable + public String getFileName() { + return fileName; + } + + public void setFileName(@javax.annotation.Nullable String fileName) { + this.fileName = fileName; + } + + + public SigningDocument fileSize(@javax.annotation.Nullable Integer fileSize) { + this.fileSize = fileSize; + return this; + } + + /** + * The size of the file in bytes + * @return fileSize + */ + @javax.annotation.Nullable + public Integer getFileSize() { + return fileSize; + } + + public void setFileSize(@javax.annotation.Nullable Integer fileSize) { + this.fileSize = fileSize; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SigningDocument instance itself + */ + public SigningDocument putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SigningDocument signingDocument = (SigningDocument) o; + return Objects.equals(this.applicantId, signingDocument.applicantId) && + Objects.equals(this.id, signingDocument.id) && + Objects.equals(this.createdAt, signingDocument.createdAt) && + Objects.equals(this.href, signingDocument.href) && + Objects.equals(this.downloadHref, signingDocument.downloadHref) && + Objects.equals(this.fileType, signingDocument.fileType) && + Objects.equals(this.fileName, signingDocument.fileName) && + Objects.equals(this.fileSize, signingDocument.fileSize)&& + Objects.equals(this.additionalProperties, signingDocument.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(applicantId, id, createdAt, href, downloadHref, fileType, fileName, fileSize, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SigningDocument {\n"); + sb.append(" applicantId: ").append(toIndentedString(applicantId)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" href: ").append(toIndentedString(href)).append("\n"); + sb.append(" downloadHref: ").append(toIndentedString(downloadHref)).append("\n"); + sb.append(" fileType: ").append(toIndentedString(fileType)).append("\n"); + sb.append(" fileName: ").append(toIndentedString(fileName)).append("\n"); + sb.append(" fileSize: ").append(toIndentedString(fileSize)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("applicant_id"); + openapiFields.add("id"); + openapiFields.add("created_at"); + openapiFields.add("href"); + openapiFields.add("download_href"); + openapiFields.add("file_type"); + openapiFields.add("file_name"); + openapiFields.add("file_size"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SigningDocument + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SigningDocument.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SigningDocument is not found in the empty JSON string", SigningDocument.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SigningDocument.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("applicant_id") != null && !jsonObj.get("applicant_id").isJsonNull()) && !jsonObj.get("applicant_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicant_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicant_id").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("href") != null && !jsonObj.get("href").isJsonNull()) && !jsonObj.get("href").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `href` to be a primitive type in the JSON string but got `%s`", jsonObj.get("href").toString())); + } + if ((jsonObj.get("download_href") != null && !jsonObj.get("download_href").isJsonNull()) && !jsonObj.get("download_href").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `download_href` to be a primitive type in the JSON string but got `%s`", jsonObj.get("download_href").toString())); + } + if ((jsonObj.get("file_type") != null && !jsonObj.get("file_type").isJsonNull()) && !jsonObj.get("file_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `file_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("file_type").toString())); + } + if ((jsonObj.get("file_name") != null && !jsonObj.get("file_name").isJsonNull()) && !jsonObj.get("file_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `file_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("file_name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SigningDocument.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SigningDocument' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SigningDocument.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SigningDocument value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else if (jsonElement.isJsonObject()) { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SigningDocument read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SigningDocument instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SigningDocument given an JSON string + * + * @param jsonString JSON string + * @return An instance of SigningDocument + * @throws IOException if the JSON string is invalid with respect to SigningDocument + */ + public static SigningDocument fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SigningDocument.class); + } + + /** + * Convert an instance of SigningDocument to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/SigningDocumentResponse.java b/src/main/java/com/onfido/model/SigningDocumentResponse.java new file mode 100644 index 00000000..37c68ee7 --- /dev/null +++ b/src/main/java/com/onfido/model/SigningDocumentResponse.java @@ -0,0 +1,471 @@ +/* + * Onfido Public API v3.6 + * The Onfido Public API (v3.6) + * + * The version of the OpenAPI document: v3.6 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.onfido.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.onfido.JSON; + +/** + * SigningDocumentResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class SigningDocumentResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_CREATED_AT = "created_at"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_HREF = "href"; + @SerializedName(SERIALIZED_NAME_HREF) + @javax.annotation.Nullable + private String href; + + public static final String SERIALIZED_NAME_DOWNLOAD_HREF = "download_href"; + @SerializedName(SERIALIZED_NAME_DOWNLOAD_HREF) + @javax.annotation.Nullable + private String downloadHref; + + public static final String SERIALIZED_NAME_FILE_TYPE = "file_type"; + @SerializedName(SERIALIZED_NAME_FILE_TYPE) + @javax.annotation.Nullable + private String fileType; + + public static final String SERIALIZED_NAME_FILE_NAME = "file_name"; + @SerializedName(SERIALIZED_NAME_FILE_NAME) + @javax.annotation.Nullable + private String fileName; + + public static final String SERIALIZED_NAME_FILE_SIZE = "file_size"; + @SerializedName(SERIALIZED_NAME_FILE_SIZE) + @javax.annotation.Nullable + private Integer fileSize; + + public SigningDocumentResponse() { + } + + public SigningDocumentResponse id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * The unique identifier for the signing document + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + public SigningDocumentResponse createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The date and time at which the signing document was uploaded + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public SigningDocumentResponse href(@javax.annotation.Nullable String href) { + this.href = href; + return this; + } + + /** + * The uri of this resource + * @return href + */ + @javax.annotation.Nullable + public String getHref() { + return href; + } + + public void setHref(@javax.annotation.Nullable String href) { + this.href = href; + } + + + public SigningDocumentResponse downloadHref(@javax.annotation.Nullable String downloadHref) { + this.downloadHref = downloadHref; + return this; + } + + /** + * The uri that can be used to download the signing document + * @return downloadHref + */ + @javax.annotation.Nullable + public String getDownloadHref() { + return downloadHref; + } + + public void setDownloadHref(@javax.annotation.Nullable String downloadHref) { + this.downloadHref = downloadHref; + } + + + public SigningDocumentResponse fileType(@javax.annotation.Nullable String fileType) { + this.fileType = fileType; + return this; + } + + /** + * The file type of the uploaded file + * @return fileType + */ + @javax.annotation.Nullable + public String getFileType() { + return fileType; + } + + public void setFileType(@javax.annotation.Nullable String fileType) { + this.fileType = fileType; + } + + + public SigningDocumentResponse fileName(@javax.annotation.Nullable String fileName) { + this.fileName = fileName; + return this; + } + + /** + * The name of the uploaded file + * @return fileName + */ + @javax.annotation.Nullable + public String getFileName() { + return fileName; + } + + public void setFileName(@javax.annotation.Nullable String fileName) { + this.fileName = fileName; + } + + + public SigningDocumentResponse fileSize(@javax.annotation.Nullable Integer fileSize) { + this.fileSize = fileSize; + return this; + } + + /** + * The size of the file in bytes + * @return fileSize + */ + @javax.annotation.Nullable + public Integer getFileSize() { + return fileSize; + } + + public void setFileSize(@javax.annotation.Nullable Integer fileSize) { + this.fileSize = fileSize; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SigningDocumentResponse instance itself + */ + public SigningDocumentResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SigningDocumentResponse signingDocumentResponse = (SigningDocumentResponse) o; + return Objects.equals(this.id, signingDocumentResponse.id) && + Objects.equals(this.createdAt, signingDocumentResponse.createdAt) && + Objects.equals(this.href, signingDocumentResponse.href) && + Objects.equals(this.downloadHref, signingDocumentResponse.downloadHref) && + Objects.equals(this.fileType, signingDocumentResponse.fileType) && + Objects.equals(this.fileName, signingDocumentResponse.fileName) && + Objects.equals(this.fileSize, signingDocumentResponse.fileSize)&& + Objects.equals(this.additionalProperties, signingDocumentResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, createdAt, href, downloadHref, fileType, fileName, fileSize, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SigningDocumentResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" href: ").append(toIndentedString(href)).append("\n"); + sb.append(" downloadHref: ").append(toIndentedString(downloadHref)).append("\n"); + sb.append(" fileType: ").append(toIndentedString(fileType)).append("\n"); + sb.append(" fileName: ").append(toIndentedString(fileName)).append("\n"); + sb.append(" fileSize: ").append(toIndentedString(fileSize)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("created_at"); + openapiFields.add("href"); + openapiFields.add("download_href"); + openapiFields.add("file_type"); + openapiFields.add("file_name"); + openapiFields.add("file_size"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SigningDocumentResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SigningDocumentResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SigningDocumentResponse is not found in the empty JSON string", SigningDocumentResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SigningDocumentResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("href") != null && !jsonObj.get("href").isJsonNull()) && !jsonObj.get("href").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `href` to be a primitive type in the JSON string but got `%s`", jsonObj.get("href").toString())); + } + if ((jsonObj.get("download_href") != null && !jsonObj.get("download_href").isJsonNull()) && !jsonObj.get("download_href").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `download_href` to be a primitive type in the JSON string but got `%s`", jsonObj.get("download_href").toString())); + } + if ((jsonObj.get("file_type") != null && !jsonObj.get("file_type").isJsonNull()) && !jsonObj.get("file_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `file_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("file_type").toString())); + } + if ((jsonObj.get("file_name") != null && !jsonObj.get("file_name").isJsonNull()) && !jsonObj.get("file_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `file_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("file_name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SigningDocumentResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SigningDocumentResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SigningDocumentResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SigningDocumentResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else if (jsonElement.isJsonObject()) { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SigningDocumentResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SigningDocumentResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SigningDocumentResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of SigningDocumentResponse + * @throws IOException if the JSON string is invalid with respect to SigningDocumentResponse + */ + public static SigningDocumentResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SigningDocumentResponse.class); + } + + /** + * Convert an instance of SigningDocumentResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/SigningDocumentShared.java b/src/main/java/com/onfido/model/SigningDocumentShared.java new file mode 100644 index 00000000..d70923ee --- /dev/null +++ b/src/main/java/com/onfido/model/SigningDocumentShared.java @@ -0,0 +1,288 @@ +/* + * Onfido Public API v3.6 + * The Onfido Public API (v3.6) + * + * The version of the OpenAPI document: v3.6 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.onfido.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.onfido.JSON; + +/** + * SigningDocumentShared + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class SigningDocumentShared { + public static final String SERIALIZED_NAME_APPLICANT_ID = "applicant_id"; + @SerializedName(SERIALIZED_NAME_APPLICANT_ID) + @javax.annotation.Nullable + private UUID applicantId; + + public SigningDocumentShared() { + } + + public SigningDocumentShared applicantId(@javax.annotation.Nullable UUID applicantId) { + this.applicantId = applicantId; + return this; + } + + /** + * The ID of the applicant whose signing document is being uploaded. + * @return applicantId + */ + @javax.annotation.Nullable + public UUID getApplicantId() { + return applicantId; + } + + public void setApplicantId(@javax.annotation.Nullable UUID applicantId) { + this.applicantId = applicantId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SigningDocumentShared instance itself + */ + public SigningDocumentShared putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SigningDocumentShared signingDocumentShared = (SigningDocumentShared) o; + return Objects.equals(this.applicantId, signingDocumentShared.applicantId)&& + Objects.equals(this.additionalProperties, signingDocumentShared.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(applicantId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SigningDocumentShared {\n"); + sb.append(" applicantId: ").append(toIndentedString(applicantId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("applicant_id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SigningDocumentShared + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SigningDocumentShared.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SigningDocumentShared is not found in the empty JSON string", SigningDocumentShared.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("applicant_id") != null && !jsonObj.get("applicant_id").isJsonNull()) && !jsonObj.get("applicant_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicant_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicant_id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SigningDocumentShared.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SigningDocumentShared' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SigningDocumentShared.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SigningDocumentShared value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else if (jsonElement.isJsonObject()) { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SigningDocumentShared read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SigningDocumentShared instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SigningDocumentShared given an JSON string + * + * @param jsonString JSON string + * @return An instance of SigningDocumentShared + * @throws IOException if the JSON string is invalid with respect to SigningDocumentShared + */ + public static SigningDocumentShared fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SigningDocumentShared.class); + } + + /** + * Convert an instance of SigningDocumentShared to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/SigningDocumentsList.java b/src/main/java/com/onfido/model/SigningDocumentsList.java new file mode 100644 index 00000000..e123157a --- /dev/null +++ b/src/main/java/com/onfido/model/SigningDocumentsList.java @@ -0,0 +1,309 @@ +/* + * Onfido Public API v3.6 + * The Onfido Public API (v3.6) + * + * The version of the OpenAPI document: v3.6 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.onfido.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.onfido.model.SigningDocument; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.onfido.JSON; + +/** + * SigningDocumentsList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.11.0") +public class SigningDocumentsList { + public static final String SERIALIZED_NAME_DOCUMENTS = "documents"; + @SerializedName(SERIALIZED_NAME_DOCUMENTS) + @javax.annotation.Nullable + private List documents = new ArrayList<>(); + + public SigningDocumentsList() { + } + + public SigningDocumentsList documents(@javax.annotation.Nullable List documents) { + this.documents = documents; + return this; + } + + public SigningDocumentsList addDocumentsItem(SigningDocument documentsItem) { + if (this.documents == null) { + this.documents = new ArrayList<>(); + } + this.documents.add(documentsItem); + return this; + } + + /** + * Get documents + * @return documents + */ + @javax.annotation.Nullable + public List getDocuments() { + return documents; + } + + public void setDocuments(@javax.annotation.Nullable List documents) { + this.documents = documents; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SigningDocumentsList instance itself + */ + public SigningDocumentsList putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SigningDocumentsList signingDocumentsList = (SigningDocumentsList) o; + return Objects.equals(this.documents, signingDocumentsList.documents)&& + Objects.equals(this.additionalProperties, signingDocumentsList.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(documents, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SigningDocumentsList {\n"); + sb.append(" documents: ").append(toIndentedString(documents)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("documents"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SigningDocumentsList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SigningDocumentsList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SigningDocumentsList is not found in the empty JSON string", SigningDocumentsList.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("documents") != null && !jsonObj.get("documents").isJsonNull()) { + JsonArray jsonArraydocuments = jsonObj.getAsJsonArray("documents"); + if (jsonArraydocuments != null) { + // ensure the json data is an array + if (!jsonObj.get("documents").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `documents` to be an array in the JSON string but got `%s`", jsonObj.get("documents").toString())); + } + + // validate the optional field `documents` (array) + for (int i = 0; i < jsonArraydocuments.size(); i++) { + SigningDocument.validateJsonElement(jsonArraydocuments.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SigningDocumentsList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SigningDocumentsList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SigningDocumentsList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SigningDocumentsList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else if (jsonElement.isJsonObject()) { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SigningDocumentsList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SigningDocumentsList instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SigningDocumentsList given an JSON string + * + * @param jsonString JSON string + * @return An instance of SigningDocumentsList + * @throws IOException if the JSON string is invalid with respect to SigningDocumentsList + */ + public static SigningDocumentsList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SigningDocumentsList.class); + } + + /** + * Convert an instance of SigningDocumentsList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +