diff --git a/.release.json b/.release.json index e670585..1d2b8c0 100644 --- a/.release.json +++ b/.release.json @@ -1,8 +1,8 @@ { "source": { "repo_url": "https://github.com/onfido/onfido-openapi-spec", - "short_sha": "46cd3c9", - "long_sha": "46cd3c929587a947b834033b94943f53745088c0", + "short_sha": "5bda1d2", + "long_sha": "5bda1d2f01afcb4aef0a10f2783e5b5372670bd6", "version": "v6.2.0" }, "release": "v7.3.0" diff --git a/src/main/java/com/onfido/JSON.java b/src/main/java/com/onfido/JSON.java index 32e64b3..d1d2c8a 100644 --- a/src/main/java/com/onfido/JSON.java +++ b/src/main/java/com/onfido/JSON.java @@ -395,6 +395,22 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistEnhancedPropertiesRecordsInnerEventInnerSource.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistEnhancedPropertiesRecordsInnerSourceInner.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistEnhancedReport.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistMeshAddedMentions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistMeshAlertRisk.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistMeshAlertRisk1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistMeshAssociate.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistMeshDateValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistMeshField.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistMeshImage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistMeshLists.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistMeshMedia.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistMeshName.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistMeshPep.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistMeshPerson.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistMeshProfile.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistMeshRiskDetail.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistMeshRiskIndicators.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistMeshSanctions.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistMonitor.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistMonitorBuilder.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.onfido.model.WatchlistMonitorMatch.CustomTypeAdapterFactory()); diff --git a/src/main/java/com/onfido/api/DefaultApi.java b/src/main/java/com/onfido/api/DefaultApi.java index d421565..d41fe30 100644 --- a/src/main/java/com/onfido/api/DefaultApi.java +++ b/src/main/java/com/onfido/api/DefaultApi.java @@ -79,6 +79,7 @@ import java.net.URI; import java.util.UUID; import com.onfido.model.UpdatedBiometricTokenResponse; +import com.onfido.model.WatchlistMeshAlertRisk; import com.onfido.model.WatchlistMonitor; import com.onfido.model.WatchlistMonitorBuilder; import com.onfido.model.WatchlistMonitorMatchesList; @@ -10958,6 +10959,201 @@ public okhttp3.Call executeAsync(final ApiCallback> _callback) th public APIlistTasksRequest listTasks(@javax.annotation.Nonnull UUID workflowRunId) { return new APIlistTasksRequest(workflowRunId); } + private okhttp3.Call listWatchlistMeshAlertRisksCall(@javax.annotation.Nonnull UUID alertId, @javax.annotation.Nullable Integer page, @javax.annotation.Nullable Integer perPage, 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 = "/complyadvantage_watchlists/alerts/{alert_id}/risks" + .replace("{" + "alert_id" + "}", localVarApiClient.escapeString(alertId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page", page)); + } + + if (perPage != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("per_page", perPage)); + } + + 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[] { "OAuth2ClientCredentials", "Token" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listWatchlistMeshAlertRisksValidateBeforeCall(@javax.annotation.Nonnull UUID alertId, @javax.annotation.Nullable Integer page, @javax.annotation.Nullable Integer perPage, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'alertId' is set + if (alertId == null) { + throw new ApiException("Missing the required parameter 'alertId' when calling listWatchlistMeshAlertRisks(Async)"); + } + + return listWatchlistMeshAlertRisksCall(alertId, page, perPage, _callback); + + } + + + private ApiResponse> listWatchlistMeshAlertRisksWithHttpInfo(@javax.annotation.Nonnull UUID alertId, @javax.annotation.Nullable Integer page, @javax.annotation.Nullable Integer perPage) throws ApiException { + okhttp3.Call localVarCall = listWatchlistMeshAlertRisksValidateBeforeCall(alertId, page, perPage, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call listWatchlistMeshAlertRisksAsync(@javax.annotation.Nonnull UUID alertId, @javax.annotation.Nullable Integer page, @javax.annotation.Nullable Integer perPage, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = listWatchlistMeshAlertRisksValidateBeforeCall(alertId, page, perPage, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIlistWatchlistMeshAlertRisksRequest { + @javax.annotation.Nonnull + private final UUID alertId; + @javax.annotation.Nullable + private Integer page; + @javax.annotation.Nullable + private Integer perPage; + + private APIlistWatchlistMeshAlertRisksRequest(@javax.annotation.Nonnull UUID alertId) { + this.alertId = alertId; + } + + /** + * Set page + * @param page The page of results to retrieve. (optional, default to 1) + * @return APIlistWatchlistMeshAlertRisksRequest + */ + public APIlistWatchlistMeshAlertRisksRequest page(@javax.annotation.Nullable Integer page) { + this.page = page; + return this; + } + + /** + * Set perPage + * @param perPage The number of risks to return per page. (optional, default to 25) + * @return APIlistWatchlistMeshAlertRisksRequest + */ + public APIlistWatchlistMeshAlertRisksRequest perPage(@javax.annotation.Nullable Integer perPage) { + this.perPage = perPage; + return this; + } + + /** + * Build call for listWatchlistMeshAlertRisks + * @param _callback ApiCallback API callback + * @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 An array of watchlist alert risks. * X-Total-Count - The total number of risks associated with the alert.
0 Unexpected error -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return listWatchlistMeshAlertRisksCall(alertId, page, perPage, _callback); + } + + /** + * Execute listWatchlistMeshAlertRisks request + * @return List<WatchlistMeshAlertRisk> + * @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 An array of watchlist alert risks. * X-Total-Count - The total number of risks associated with the alert.
0 Unexpected error -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = listWatchlistMeshAlertRisksWithHttpInfo(alertId, page, perPage); + return localVarResp.getData(); + } + + /** + * Execute listWatchlistMeshAlertRisks request with HTTP info returned + * @return ApiResponse<List<WatchlistMeshAlertRisk>> + * @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 An array of watchlist alert risks. * X-Total-Count - The total number of risks associated with the alert.
0 Unexpected error -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return listWatchlistMeshAlertRisksWithHttpInfo(alertId, page, perPage); + } + + /** + * Execute listWatchlistMeshAlertRisks request (asynchronously) + * @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 An array of watchlist alert risks. * X-Total-Count - The total number of risks associated with the alert.
0 Unexpected error -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return listWatchlistMeshAlertRisksAsync(alertId, page, perPage, _callback); + } + } + + /** + * Retrieve watchlist mesh alert risks + * Retrieves the detailed risks associated with a watchlist mesh alert. + * @param alertId The unique identifier of the alert whose risks you want to retrieve. (required) + * @return APIlistWatchlistMeshAlertRisksRequest + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 An array of watchlist alert risks. * X-Total-Count - The total number of risks associated with the alert.
0 Unexpected error -
+ */ + public APIlistWatchlistMeshAlertRisksRequest listWatchlistMeshAlertRisks(@javax.annotation.Nonnull UUID alertId) { + return new APIlistWatchlistMeshAlertRisksRequest(alertId); + } private okhttp3.Call listWatchlistMonitorMatchesCall(@javax.annotation.Nonnull UUID monitorId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers diff --git a/src/main/java/com/onfido/model/InvalidatedBiometricTokenResponse.java b/src/main/java/com/onfido/model/InvalidatedBiometricTokenResponse.java index e7202ae..fe39398 100644 --- a/src/main/java/com/onfido/model/InvalidatedBiometricTokenResponse.java +++ b/src/main/java/com/onfido/model/InvalidatedBiometricTokenResponse.java @@ -53,30 +53,30 @@ */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0") public class InvalidatedBiometricTokenResponse { - public static final String SERIALIZED_NAME_BIOMETRIC_TOKEN = "biometric_token"; - @SerializedName(SERIALIZED_NAME_BIOMETRIC_TOKEN) + public static final String SERIALIZED_NAME_BIOMETRIC_TOKENS = "biometric_tokens"; + @SerializedName(SERIALIZED_NAME_BIOMETRIC_TOKENS) @javax.annotation.Nonnull - private InvalidatedBiometricTokenSummary biometricToken; + private InvalidatedBiometricTokenSummary biometricTokens; public InvalidatedBiometricTokenResponse() { } - public InvalidatedBiometricTokenResponse biometricToken(@javax.annotation.Nonnull InvalidatedBiometricTokenSummary biometricToken) { - this.biometricToken = biometricToken; + public InvalidatedBiometricTokenResponse biometricTokens(@javax.annotation.Nonnull InvalidatedBiometricTokenSummary biometricTokens) { + this.biometricTokens = biometricTokens; return this; } /** - * Get biometricToken - * @return biometricToken + * Get biometricTokens + * @return biometricTokens */ @javax.annotation.Nonnull - public InvalidatedBiometricTokenSummary getBiometricToken() { - return biometricToken; + public InvalidatedBiometricTokenSummary getBiometricTokens() { + return biometricTokens; } - public void setBiometricToken(@javax.annotation.Nonnull InvalidatedBiometricTokenSummary biometricToken) { - this.biometricToken = biometricToken; + public void setBiometricTokens(@javax.annotation.Nonnull InvalidatedBiometricTokenSummary biometricTokens) { + this.biometricTokens = biometricTokens; } /** @@ -134,20 +134,20 @@ public boolean equals(Object o) { return false; } InvalidatedBiometricTokenResponse invalidatedBiometricTokenResponse = (InvalidatedBiometricTokenResponse) o; - return Objects.equals(this.biometricToken, invalidatedBiometricTokenResponse.biometricToken)&& + return Objects.equals(this.biometricTokens, invalidatedBiometricTokenResponse.biometricTokens)&& Objects.equals(this.additionalProperties, invalidatedBiometricTokenResponse.additionalProperties); } @Override public int hashCode() { - return Objects.hash(biometricToken, additionalProperties); + return Objects.hash(biometricTokens, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class InvalidatedBiometricTokenResponse {\n"); - sb.append(" biometricToken: ").append(toIndentedString(biometricToken)).append("\n"); + sb.append(" biometricTokens: ").append(toIndentedString(biometricTokens)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -170,10 +170,10 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("biometric_token")); + openapiFields = new HashSet(Arrays.asList("biometric_tokens")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("biometric_token")); + openapiRequiredFields = new HashSet(Arrays.asList("biometric_tokens")); } /** @@ -196,8 +196,8 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the required field `biometric_token` - InvalidatedBiometricTokenSummary.validateJsonElement(jsonObj.get("biometric_token")); + // validate the required field `biometric_tokens` + InvalidatedBiometricTokenSummary.validateJsonElement(jsonObj.get("biometric_tokens")); } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/com/onfido/model/WatchlistMeshAddedMentions.java b/src/main/java/com/onfido/model/WatchlistMeshAddedMentions.java new file mode 100644 index 0000000..2a91704 --- /dev/null +++ b/src/main/java/com/onfido/model/WatchlistMeshAddedMentions.java @@ -0,0 +1,387 @@ +/* + * 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 java.util.Locale; +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.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +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 java.util.Locale; + +import com.onfido.JSON; + +/** + * WatchlistMeshAddedMentions + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0") +public class WatchlistMeshAddedMentions { + public static final String SERIALIZED_NAME_ADDED_AML_TYPES = "added_aml_types"; + @SerializedName(SERIALIZED_NAME_ADDED_AML_TYPES) + @javax.annotation.Nullable + private List addedAmlTypes; + + public static final String SERIALIZED_NAME_ADDED_SNIPPETS = "added_snippets"; + @SerializedName(SERIALIZED_NAME_ADDED_SNIPPETS) + @javax.annotation.Nullable + private List addedSnippets; + + public static final String SERIALIZED_NAME_ADDED_LISTINGS = "added_listings"; + @SerializedName(SERIALIZED_NAME_ADDED_LISTINGS) + @javax.annotation.Nullable + private List addedListings; + + public WatchlistMeshAddedMentions() { + } + + public WatchlistMeshAddedMentions addedAmlTypes(@javax.annotation.Nullable List addedAmlTypes) { + this.addedAmlTypes = addedAmlTypes; + return this; + } + + public WatchlistMeshAddedMentions addAddedAmlTypesItem(String addedAmlTypesItem) { + if (this.addedAmlTypes == null) { + this.addedAmlTypes = new ArrayList<>(); + } + this.addedAmlTypes.add(addedAmlTypesItem); + return this; + } + + /** + * Get addedAmlTypes + * @return addedAmlTypes + */ + @javax.annotation.Nullable + public List getAddedAmlTypes() { + return addedAmlTypes; + } + + public void setAddedAmlTypes(@javax.annotation.Nullable List addedAmlTypes) { + this.addedAmlTypes = addedAmlTypes; + } + + + public WatchlistMeshAddedMentions addedSnippets(@javax.annotation.Nullable List addedSnippets) { + this.addedSnippets = addedSnippets; + return this; + } + + public WatchlistMeshAddedMentions addAddedSnippetsItem(String addedSnippetsItem) { + if (this.addedSnippets == null) { + this.addedSnippets = new ArrayList<>(); + } + this.addedSnippets.add(addedSnippetsItem); + return this; + } + + /** + * Get addedSnippets + * @return addedSnippets + */ + @javax.annotation.Nullable + public List getAddedSnippets() { + return addedSnippets; + } + + public void setAddedSnippets(@javax.annotation.Nullable List addedSnippets) { + this.addedSnippets = addedSnippets; + } + + + public WatchlistMeshAddedMentions addedListings(@javax.annotation.Nullable List addedListings) { + this.addedListings = addedListings; + return this; + } + + public WatchlistMeshAddedMentions addAddedListingsItem(String addedListingsItem) { + if (this.addedListings == null) { + this.addedListings = new ArrayList<>(); + } + this.addedListings.add(addedListingsItem); + return this; + } + + /** + * Get addedListings + * @return addedListings + */ + @javax.annotation.Nullable + public List getAddedListings() { + return addedListings; + } + + public void setAddedListings(@javax.annotation.Nullable List addedListings) { + this.addedListings = addedListings; + } + + /** + * 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 WatchlistMeshAddedMentions instance itself + */ + public WatchlistMeshAddedMentions 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; + } + WatchlistMeshAddedMentions watchlistMeshAddedMentions = (WatchlistMeshAddedMentions) o; + return Objects.equals(this.addedAmlTypes, watchlistMeshAddedMentions.addedAmlTypes) && + Objects.equals(this.addedSnippets, watchlistMeshAddedMentions.addedSnippets) && + Objects.equals(this.addedListings, watchlistMeshAddedMentions.addedListings)&& + Objects.equals(this.additionalProperties, watchlistMeshAddedMentions.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(addedAmlTypes, addedSnippets, addedListings, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WatchlistMeshAddedMentions {\n"); + sb.append(" addedAmlTypes: ").append(toIndentedString(addedAmlTypes)).append("\n"); + sb.append(" addedSnippets: ").append(toIndentedString(addedSnippets)).append("\n"); + sb.append(" addedListings: ").append(toIndentedString(addedListings)).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(Arrays.asList("added_aml_types", "added_snippets", "added_listings")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 WatchlistMeshAddedMentions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WatchlistMeshAddedMentions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in WatchlistMeshAddedMentions is not found in the empty JSON string", WatchlistMeshAddedMentions.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("added_aml_types") != null && !jsonObj.get("added_aml_types").isJsonNull() && !jsonObj.get("added_aml_types").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `added_aml_types` to be an array in the JSON string but got `%s`", jsonObj.get("added_aml_types").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("added_snippets") != null && !jsonObj.get("added_snippets").isJsonNull() && !jsonObj.get("added_snippets").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `added_snippets` to be an array in the JSON string but got `%s`", jsonObj.get("added_snippets").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("added_listings") != null && !jsonObj.get("added_listings").isJsonNull() && !jsonObj.get("added_listings").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `added_listings` to be an array in the JSON string but got `%s`", jsonObj.get("added_listings").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WatchlistMeshAddedMentions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WatchlistMeshAddedMentions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WatchlistMeshAddedMentions.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WatchlistMeshAddedMentions 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 WatchlistMeshAddedMentions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WatchlistMeshAddedMentions 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(Locale.ROOT, "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 WatchlistMeshAddedMentions given an JSON string + * + * @param jsonString JSON string + * @return An instance of WatchlistMeshAddedMentions + * @throws IOException if the JSON string is invalid with respect to WatchlistMeshAddedMentions + */ + public static WatchlistMeshAddedMentions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WatchlistMeshAddedMentions.class); + } + + /** + * Convert an instance of WatchlistMeshAddedMentions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/WatchlistMeshAlertRisk.java b/src/main/java/com/onfido/model/WatchlistMeshAlertRisk.java new file mode 100644 index 0000000..59293c0 --- /dev/null +++ b/src/main/java/com/onfido/model/WatchlistMeshAlertRisk.java @@ -0,0 +1,503 @@ +/* + * 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 java.util.Locale; +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.WatchlistMeshRiskDecision; +import com.onfido.model.WatchlistMeshRiskDetail; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +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 java.util.Locale; + +import com.onfido.JSON; + +/** + * WatchlistMeshAlertRisk + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0") +public class WatchlistMeshAlertRisk { + 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_DECISION = "decision"; + @SerializedName(SERIALIZED_NAME_DECISION) + @javax.annotation.Nullable + private WatchlistMeshRiskDecision decision; + + public static final String SERIALIZED_NAME_PREVIOUS_DECISION = "previous_decision"; + @SerializedName(SERIALIZED_NAME_PREVIOUS_DECISION) + @javax.annotation.Nullable + private WatchlistMeshRiskDecision previousDecision; + + public static final String SERIALIZED_NAME_DETAIL = "detail"; + @SerializedName(SERIALIZED_NAME_DETAIL) + @javax.annotation.Nullable + private WatchlistMeshRiskDetail detail; + + public static final String SERIALIZED_NAME_IDENTIFIER = "identifier"; + @SerializedName(SERIALIZED_NAME_IDENTIFIER) + @javax.annotation.Nullable + private String identifier; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_UPDATED_BY = "updated_by"; + @SerializedName(SERIALIZED_NAME_UPDATED_BY) + @javax.annotation.Nullable + private String updatedBy; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updated_at"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable + private OffsetDateTime updatedAt; + + public WatchlistMeshAlertRisk() { + } + + public WatchlistMeshAlertRisk createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The date and time at which the risk record was created. + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public WatchlistMeshAlertRisk decision(@javax.annotation.Nullable WatchlistMeshRiskDecision decision) { + this.decision = decision; + return this; + } + + /** + * The review decision currently applied to the risk. + * @return decision + */ + @javax.annotation.Nullable + public WatchlistMeshRiskDecision getDecision() { + return decision; + } + + public void setDecision(@javax.annotation.Nullable WatchlistMeshRiskDecision decision) { + this.decision = decision; + } + + + public WatchlistMeshAlertRisk previousDecision(@javax.annotation.Nullable WatchlistMeshRiskDecision previousDecision) { + this.previousDecision = previousDecision; + return this; + } + + /** + * The previous review decision, if one exists. + * @return previousDecision + */ + @javax.annotation.Nullable + public WatchlistMeshRiskDecision getPreviousDecision() { + return previousDecision; + } + + public void setPreviousDecision(@javax.annotation.Nullable WatchlistMeshRiskDecision previousDecision) { + this.previousDecision = previousDecision; + } + + + public WatchlistMeshAlertRisk detail(@javax.annotation.Nullable WatchlistMeshRiskDetail detail) { + this.detail = detail; + return this; + } + + /** + * Additional details about the risk. + * @return detail + */ + @javax.annotation.Nullable + public WatchlistMeshRiskDetail getDetail() { + return detail; + } + + public void setDetail(@javax.annotation.Nullable WatchlistMeshRiskDetail detail) { + this.detail = detail; + } + + + public WatchlistMeshAlertRisk identifier(@javax.annotation.Nullable String identifier) { + this.identifier = identifier; + return this; + } + + /** + * The unique identifier of the risk record. + * @return identifier + */ + @javax.annotation.Nullable + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(@javax.annotation.Nullable String identifier) { + this.identifier = identifier; + } + + + public WatchlistMeshAlertRisk type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * The type of risk returned for the alert. + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public WatchlistMeshAlertRisk updatedBy(@javax.annotation.Nullable String updatedBy) { + this.updatedBy = updatedBy; + return this; + } + + /** + * The identifier of the user or system that last updated the risk decision. + * @return updatedBy + */ + @javax.annotation.Nullable + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(@javax.annotation.Nullable String updatedBy) { + this.updatedBy = updatedBy; + } + + + public WatchlistMeshAlertRisk updatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The date and time at which the risk record was last updated. + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + /** + * 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 WatchlistMeshAlertRisk instance itself + */ + public WatchlistMeshAlertRisk 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; + } + WatchlistMeshAlertRisk watchlistMeshAlertRisk = (WatchlistMeshAlertRisk) o; + return Objects.equals(this.createdAt, watchlistMeshAlertRisk.createdAt) && + Objects.equals(this.decision, watchlistMeshAlertRisk.decision) && + Objects.equals(this.previousDecision, watchlistMeshAlertRisk.previousDecision) && + Objects.equals(this.detail, watchlistMeshAlertRisk.detail) && + Objects.equals(this.identifier, watchlistMeshAlertRisk.identifier) && + Objects.equals(this.type, watchlistMeshAlertRisk.type) && + Objects.equals(this.updatedBy, watchlistMeshAlertRisk.updatedBy) && + Objects.equals(this.updatedAt, watchlistMeshAlertRisk.updatedAt)&& + Objects.equals(this.additionalProperties, watchlistMeshAlertRisk.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, decision, previousDecision, detail, identifier, type, updatedBy, updatedAt, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WatchlistMeshAlertRisk {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" decision: ").append(toIndentedString(decision)).append("\n"); + sb.append(" previousDecision: ").append(toIndentedString(previousDecision)).append("\n"); + sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); + sb.append(" identifier: ").append(toIndentedString(identifier)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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(Arrays.asList("created_at", "decision", "previous_decision", "detail", "identifier", "type", "updated_by", "updated_at")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 WatchlistMeshAlertRisk + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WatchlistMeshAlertRisk.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in WatchlistMeshAlertRisk is not found in the empty JSON string", WatchlistMeshAlertRisk.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `decision` + if (jsonObj.get("decision") != null && !jsonObj.get("decision").isJsonNull()) { + WatchlistMeshRiskDecision.validateJsonElement(jsonObj.get("decision")); + } + // validate the optional field `previous_decision` + if (jsonObj.get("previous_decision") != null && !jsonObj.get("previous_decision").isJsonNull()) { + WatchlistMeshRiskDecision.validateJsonElement(jsonObj.get("previous_decision")); + } + // validate the optional field `detail` + if (jsonObj.get("detail") != null && !jsonObj.get("detail").isJsonNull()) { + WatchlistMeshRiskDetail.validateJsonElement(jsonObj.get("detail")); + } + if ((jsonObj.get("identifier") != null && !jsonObj.get("identifier").isJsonNull()) && !jsonObj.get("identifier").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `identifier` to be a primitive type in the JSON string but got `%s`", jsonObj.get("identifier").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("updated_by") != null && !jsonObj.get("updated_by").isJsonNull()) && !jsonObj.get("updated_by").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `updated_by` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updated_by").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WatchlistMeshAlertRisk.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WatchlistMeshAlertRisk' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WatchlistMeshAlertRisk.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WatchlistMeshAlertRisk 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 WatchlistMeshAlertRisk read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WatchlistMeshAlertRisk 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(Locale.ROOT, "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 WatchlistMeshAlertRisk given an JSON string + * + * @param jsonString JSON string + * @return An instance of WatchlistMeshAlertRisk + * @throws IOException if the JSON string is invalid with respect to WatchlistMeshAlertRisk + */ + public static WatchlistMeshAlertRisk fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WatchlistMeshAlertRisk.class); + } + + /** + * Convert an instance of WatchlistMeshAlertRisk to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/WatchlistMeshAlertRisk1.java b/src/main/java/com/onfido/model/WatchlistMeshAlertRisk1.java new file mode 100644 index 0000000..d449b2f --- /dev/null +++ b/src/main/java/com/onfido/model/WatchlistMeshAlertRisk1.java @@ -0,0 +1,503 @@ +/* + * 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 java.util.Locale; +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.WatchlistMeshRiskDecision; +import com.onfido.model.WatchlistMeshRiskDetail; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +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 java.util.Locale; + +import com.onfido.JSON; + +/** + * WatchlistMeshAlertRisk1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0") +public class WatchlistMeshAlertRisk1 { + 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_DECISION = "decision"; + @SerializedName(SERIALIZED_NAME_DECISION) + @javax.annotation.Nullable + private WatchlistMeshRiskDecision decision; + + public static final String SERIALIZED_NAME_PREVIOUS_DECISION = "previous_decision"; + @SerializedName(SERIALIZED_NAME_PREVIOUS_DECISION) + @javax.annotation.Nullable + private WatchlistMeshRiskDecision previousDecision; + + public static final String SERIALIZED_NAME_DETAIL = "detail"; + @SerializedName(SERIALIZED_NAME_DETAIL) + @javax.annotation.Nullable + private WatchlistMeshRiskDetail detail; + + public static final String SERIALIZED_NAME_IDENTIFIER = "identifier"; + @SerializedName(SERIALIZED_NAME_IDENTIFIER) + @javax.annotation.Nullable + private String identifier; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_UPDATED_BY = "updated_by"; + @SerializedName(SERIALIZED_NAME_UPDATED_BY) + @javax.annotation.Nullable + private String updatedBy; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updated_at"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable + private OffsetDateTime updatedAt; + + public WatchlistMeshAlertRisk1() { + } + + public WatchlistMeshAlertRisk1 createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The date and time at which the risk record was created. + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public WatchlistMeshAlertRisk1 decision(@javax.annotation.Nullable WatchlistMeshRiskDecision decision) { + this.decision = decision; + return this; + } + + /** + * The review decision currently applied to the risk. + * @return decision + */ + @javax.annotation.Nullable + public WatchlistMeshRiskDecision getDecision() { + return decision; + } + + public void setDecision(@javax.annotation.Nullable WatchlistMeshRiskDecision decision) { + this.decision = decision; + } + + + public WatchlistMeshAlertRisk1 previousDecision(@javax.annotation.Nullable WatchlistMeshRiskDecision previousDecision) { + this.previousDecision = previousDecision; + return this; + } + + /** + * The previous review decision, if one exists. + * @return previousDecision + */ + @javax.annotation.Nullable + public WatchlistMeshRiskDecision getPreviousDecision() { + return previousDecision; + } + + public void setPreviousDecision(@javax.annotation.Nullable WatchlistMeshRiskDecision previousDecision) { + this.previousDecision = previousDecision; + } + + + public WatchlistMeshAlertRisk1 detail(@javax.annotation.Nullable WatchlistMeshRiskDetail detail) { + this.detail = detail; + return this; + } + + /** + * Additional details about the risk. + * @return detail + */ + @javax.annotation.Nullable + public WatchlistMeshRiskDetail getDetail() { + return detail; + } + + public void setDetail(@javax.annotation.Nullable WatchlistMeshRiskDetail detail) { + this.detail = detail; + } + + + public WatchlistMeshAlertRisk1 identifier(@javax.annotation.Nullable String identifier) { + this.identifier = identifier; + return this; + } + + /** + * The unique identifier of the risk record. + * @return identifier + */ + @javax.annotation.Nullable + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(@javax.annotation.Nullable String identifier) { + this.identifier = identifier; + } + + + public WatchlistMeshAlertRisk1 type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * The type of risk returned for the alert. + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public WatchlistMeshAlertRisk1 updatedBy(@javax.annotation.Nullable String updatedBy) { + this.updatedBy = updatedBy; + return this; + } + + /** + * The identifier of the user or system that last updated the risk decision. + * @return updatedBy + */ + @javax.annotation.Nullable + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(@javax.annotation.Nullable String updatedBy) { + this.updatedBy = updatedBy; + } + + + public WatchlistMeshAlertRisk1 updatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The date and time at which the risk record was last updated. + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + /** + * 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 WatchlistMeshAlertRisk1 instance itself + */ + public WatchlistMeshAlertRisk1 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; + } + WatchlistMeshAlertRisk1 watchlistMeshAlertRisk1 = (WatchlistMeshAlertRisk1) o; + return Objects.equals(this.createdAt, watchlistMeshAlertRisk1.createdAt) && + Objects.equals(this.decision, watchlistMeshAlertRisk1.decision) && + Objects.equals(this.previousDecision, watchlistMeshAlertRisk1.previousDecision) && + Objects.equals(this.detail, watchlistMeshAlertRisk1.detail) && + Objects.equals(this.identifier, watchlistMeshAlertRisk1.identifier) && + Objects.equals(this.type, watchlistMeshAlertRisk1.type) && + Objects.equals(this.updatedBy, watchlistMeshAlertRisk1.updatedBy) && + Objects.equals(this.updatedAt, watchlistMeshAlertRisk1.updatedAt)&& + Objects.equals(this.additionalProperties, watchlistMeshAlertRisk1.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, decision, previousDecision, detail, identifier, type, updatedBy, updatedAt, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WatchlistMeshAlertRisk1 {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" decision: ").append(toIndentedString(decision)).append("\n"); + sb.append(" previousDecision: ").append(toIndentedString(previousDecision)).append("\n"); + sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); + sb.append(" identifier: ").append(toIndentedString(identifier)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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(Arrays.asList("created_at", "decision", "previous_decision", "detail", "identifier", "type", "updated_by", "updated_at")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 WatchlistMeshAlertRisk1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WatchlistMeshAlertRisk1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in WatchlistMeshAlertRisk1 is not found in the empty JSON string", WatchlistMeshAlertRisk1.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `decision` + if (jsonObj.get("decision") != null && !jsonObj.get("decision").isJsonNull()) { + WatchlistMeshRiskDecision.validateJsonElement(jsonObj.get("decision")); + } + // validate the optional field `previous_decision` + if (jsonObj.get("previous_decision") != null && !jsonObj.get("previous_decision").isJsonNull()) { + WatchlistMeshRiskDecision.validateJsonElement(jsonObj.get("previous_decision")); + } + // validate the optional field `detail` + if (jsonObj.get("detail") != null && !jsonObj.get("detail").isJsonNull()) { + WatchlistMeshRiskDetail.validateJsonElement(jsonObj.get("detail")); + } + if ((jsonObj.get("identifier") != null && !jsonObj.get("identifier").isJsonNull()) && !jsonObj.get("identifier").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `identifier` to be a primitive type in the JSON string but got `%s`", jsonObj.get("identifier").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("updated_by") != null && !jsonObj.get("updated_by").isJsonNull()) && !jsonObj.get("updated_by").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `updated_by` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updated_by").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WatchlistMeshAlertRisk1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WatchlistMeshAlertRisk1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WatchlistMeshAlertRisk1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WatchlistMeshAlertRisk1 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 WatchlistMeshAlertRisk1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WatchlistMeshAlertRisk1 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(Locale.ROOT, "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 WatchlistMeshAlertRisk1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of WatchlistMeshAlertRisk1 + * @throws IOException if the JSON string is invalid with respect to WatchlistMeshAlertRisk1 + */ + public static WatchlistMeshAlertRisk1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WatchlistMeshAlertRisk1.class); + } + + /** + * Convert an instance of WatchlistMeshAlertRisk1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/WatchlistMeshAssociate.java b/src/main/java/com/onfido/model/WatchlistMeshAssociate.java new file mode 100644 index 0000000..2562c86 --- /dev/null +++ b/src/main/java/com/onfido/model/WatchlistMeshAssociate.java @@ -0,0 +1,329 @@ +/* + * 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 java.util.Locale; +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 org.openapitools.jackson.nullable.JsonNullable; + +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 java.util.Locale; + +import com.onfido.JSON; + +/** + * WatchlistMeshAssociate + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0") +public class WatchlistMeshAssociate { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public WatchlistMeshAssociate() { + } + + public WatchlistMeshAssociate name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public WatchlistMeshAssociate type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + /** + * 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 WatchlistMeshAssociate instance itself + */ + public WatchlistMeshAssociate 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; + } + WatchlistMeshAssociate watchlistMeshAssociate = (WatchlistMeshAssociate) o; + return Objects.equals(this.name, watchlistMeshAssociate.name) && + Objects.equals(this.type, watchlistMeshAssociate.type)&& + Objects.equals(this.additionalProperties, watchlistMeshAssociate.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, type, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WatchlistMeshAssociate {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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(Arrays.asList("name", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 WatchlistMeshAssociate + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WatchlistMeshAssociate.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in WatchlistMeshAssociate is not found in the empty JSON string", WatchlistMeshAssociate.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WatchlistMeshAssociate.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WatchlistMeshAssociate' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WatchlistMeshAssociate.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WatchlistMeshAssociate 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 WatchlistMeshAssociate read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WatchlistMeshAssociate 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(Locale.ROOT, "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 WatchlistMeshAssociate given an JSON string + * + * @param jsonString JSON string + * @return An instance of WatchlistMeshAssociate + * @throws IOException if the JSON string is invalid with respect to WatchlistMeshAssociate + */ + public static WatchlistMeshAssociate fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WatchlistMeshAssociate.class); + } + + /** + * Convert an instance of WatchlistMeshAssociate to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/WatchlistMeshDateValue.java b/src/main/java/com/onfido/model/WatchlistMeshDateValue.java new file mode 100644 index 0000000..7ce47d6 --- /dev/null +++ b/src/main/java/com/onfido/model/WatchlistMeshDateValue.java @@ -0,0 +1,329 @@ +/* + * 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 java.util.Locale; +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 org.openapitools.jackson.nullable.JsonNullable; + +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 java.util.Locale; + +import com.onfido.JSON; + +/** + * WatchlistMeshDateValue + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0") +public class WatchlistMeshDateValue { + public static final String SERIALIZED_NAME_SOURCE = "source"; + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nullable + private String source; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private String value; + + public WatchlistMeshDateValue() { + } + + public WatchlistMeshDateValue source(@javax.annotation.Nullable String source) { + this.source = source; + return this; + } + + /** + * Get source + * @return source + */ + @javax.annotation.Nullable + public String getSource() { + return source; + } + + public void setSource(@javax.annotation.Nullable String source) { + this.source = source; + } + + + public WatchlistMeshDateValue value(@javax.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable String value) { + this.value = value; + } + + /** + * 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 WatchlistMeshDateValue instance itself + */ + public WatchlistMeshDateValue 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; + } + WatchlistMeshDateValue watchlistMeshDateValue = (WatchlistMeshDateValue) o; + return Objects.equals(this.source, watchlistMeshDateValue.source) && + Objects.equals(this.value, watchlistMeshDateValue.value)&& + Objects.equals(this.additionalProperties, watchlistMeshDateValue.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(source, value, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WatchlistMeshDateValue {\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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(Arrays.asList("source", "value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 WatchlistMeshDateValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WatchlistMeshDateValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in WatchlistMeshDateValue is not found in the empty JSON string", WatchlistMeshDateValue.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) && !jsonObj.get("source").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `source` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WatchlistMeshDateValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WatchlistMeshDateValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WatchlistMeshDateValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WatchlistMeshDateValue 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 WatchlistMeshDateValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WatchlistMeshDateValue 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(Locale.ROOT, "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 WatchlistMeshDateValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of WatchlistMeshDateValue + * @throws IOException if the JSON string is invalid with respect to WatchlistMeshDateValue + */ + public static WatchlistMeshDateValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WatchlistMeshDateValue.class); + } + + /** + * Convert an instance of WatchlistMeshDateValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/WatchlistMeshField.java b/src/main/java/com/onfido/model/WatchlistMeshField.java new file mode 100644 index 0000000..62df447 --- /dev/null +++ b/src/main/java/com/onfido/model/WatchlistMeshField.java @@ -0,0 +1,358 @@ +/* + * 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 java.util.Locale; +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 org.openapitools.jackson.nullable.JsonNullable; + +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 java.util.Locale; + +import com.onfido.JSON; + +/** + * WatchlistMeshField + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0") +public class WatchlistMeshField { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + @javax.annotation.Nullable + private String tag; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private String value; + + public WatchlistMeshField() { + } + + public WatchlistMeshField name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public WatchlistMeshField tag(@javax.annotation.Nullable String tag) { + this.tag = tag; + return this; + } + + /** + * Get tag + * @return tag + */ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + public void setTag(@javax.annotation.Nullable String tag) { + this.tag = tag; + } + + + public WatchlistMeshField value(@javax.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable String value) { + this.value = value; + } + + /** + * 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 WatchlistMeshField instance itself + */ + public WatchlistMeshField 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; + } + WatchlistMeshField watchlistMeshField = (WatchlistMeshField) o; + return Objects.equals(this.name, watchlistMeshField.name) && + Objects.equals(this.tag, watchlistMeshField.tag) && + Objects.equals(this.value, watchlistMeshField.value)&& + Objects.equals(this.additionalProperties, watchlistMeshField.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, tag, value, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WatchlistMeshField {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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(Arrays.asList("name", "tag", "value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 WatchlistMeshField + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WatchlistMeshField.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in WatchlistMeshField is not found in the empty JSON string", WatchlistMeshField.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WatchlistMeshField.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WatchlistMeshField' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WatchlistMeshField.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WatchlistMeshField 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 WatchlistMeshField read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WatchlistMeshField 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(Locale.ROOT, "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 WatchlistMeshField given an JSON string + * + * @param jsonString JSON string + * @return An instance of WatchlistMeshField + * @throws IOException if the JSON string is invalid with respect to WatchlistMeshField + */ + public static WatchlistMeshField fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WatchlistMeshField.class); + } + + /** + * Convert an instance of WatchlistMeshField to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/WatchlistMeshImage.java b/src/main/java/com/onfido/model/WatchlistMeshImage.java new file mode 100644 index 0000000..9d551bc --- /dev/null +++ b/src/main/java/com/onfido/model/WatchlistMeshImage.java @@ -0,0 +1,329 @@ +/* + * 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 java.util.Locale; +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 org.openapitools.jackson.nullable.JsonNullable; + +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 java.util.Locale; + +import com.onfido.JSON; + +/** + * WatchlistMeshImage + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0") +public class WatchlistMeshImage { + public static final String SERIALIZED_NAME_SOURCE = "source"; + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nullable + private String source; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nullable + private String url; + + public WatchlistMeshImage() { + } + + public WatchlistMeshImage source(@javax.annotation.Nullable String source) { + this.source = source; + return this; + } + + /** + * Get source + * @return source + */ + @javax.annotation.Nullable + public String getSource() { + return source; + } + + public void setSource(@javax.annotation.Nullable String source) { + this.source = source; + } + + + public WatchlistMeshImage url(@javax.annotation.Nullable String url) { + this.url = url; + return this; + } + + /** + * Get url + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nullable String url) { + this.url = url; + } + + /** + * 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 WatchlistMeshImage instance itself + */ + public WatchlistMeshImage 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; + } + WatchlistMeshImage watchlistMeshImage = (WatchlistMeshImage) o; + return Objects.equals(this.source, watchlistMeshImage.source) && + Objects.equals(this.url, watchlistMeshImage.url)&& + Objects.equals(this.additionalProperties, watchlistMeshImage.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(source, url, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WatchlistMeshImage {\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).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(Arrays.asList("source", "url")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 WatchlistMeshImage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WatchlistMeshImage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in WatchlistMeshImage is not found in the empty JSON string", WatchlistMeshImage.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) && !jsonObj.get("source").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `source` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source").toString())); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WatchlistMeshImage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WatchlistMeshImage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WatchlistMeshImage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WatchlistMeshImage 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 WatchlistMeshImage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WatchlistMeshImage 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(Locale.ROOT, "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 WatchlistMeshImage given an JSON string + * + * @param jsonString JSON string + * @return An instance of WatchlistMeshImage + * @throws IOException if the JSON string is invalid with respect to WatchlistMeshImage + */ + public static WatchlistMeshImage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WatchlistMeshImage.class); + } + + /** + * Convert an instance of WatchlistMeshImage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/WatchlistMeshLists.java b/src/main/java/com/onfido/model/WatchlistMeshLists.java new file mode 100644 index 0000000..7390269 --- /dev/null +++ b/src/main/java/com/onfido/model/WatchlistMeshLists.java @@ -0,0 +1,581 @@ +/* + * 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 java.util.Locale; +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.WatchlistMeshField; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +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 java.util.Locale; + +import com.onfido.JSON; + +/** + * WatchlistMeshLists + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0") +public class WatchlistMeshLists { + public static final String SERIALIZED_NAME_AML_TYPES = "aml_types"; + @SerializedName(SERIALIZED_NAME_AML_TYPES) + @javax.annotation.Nullable + private List amlTypes; + + public static final String SERIALIZED_NAME_COUNTRY_CODES = "country_codes"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODES) + @javax.annotation.Nullable + private List countryCodes; + + public static final String SERIALIZED_NAME_FIELDS = "fields"; + @SerializedName(SERIALIZED_NAME_FIELDS) + @javax.annotation.Nullable + private List fields; + + public static final String SERIALIZED_NAME_IDENTIFIER = "identifier"; + @SerializedName(SERIALIZED_NAME_IDENTIFIER) + @javax.annotation.Nullable + private String identifier; + + public static final String SERIALIZED_NAME_LISTING_ENDED_UTC = "listing_ended_utc"; + @SerializedName(SERIALIZED_NAME_LISTING_ENDED_UTC) + @javax.annotation.Nullable + private String listingEndedUtc; + + public static final String SERIALIZED_NAME_LISTING_STARTED_UTC = "listing_started_utc"; + @SerializedName(SERIALIZED_NAME_LISTING_STARTED_UTC) + @javax.annotation.Nullable + private String listingStartedUtc; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_RELATED_URLS = "related_urls"; + @SerializedName(SERIALIZED_NAME_RELATED_URLS) + @javax.annotation.Nullable + private List relatedUrls; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nullable + private String url; + + public WatchlistMeshLists() { + } + + public WatchlistMeshLists amlTypes(@javax.annotation.Nullable List amlTypes) { + this.amlTypes = amlTypes; + return this; + } + + public WatchlistMeshLists addAmlTypesItem(String amlTypesItem) { + if (this.amlTypes == null) { + this.amlTypes = new ArrayList<>(); + } + this.amlTypes.add(amlTypesItem); + return this; + } + + /** + * Get amlTypes + * @return amlTypes + */ + @javax.annotation.Nullable + public List getAmlTypes() { + return amlTypes; + } + + public void setAmlTypes(@javax.annotation.Nullable List amlTypes) { + this.amlTypes = amlTypes; + } + + + public WatchlistMeshLists countryCodes(@javax.annotation.Nullable List countryCodes) { + this.countryCodes = countryCodes; + return this; + } + + public WatchlistMeshLists addCountryCodesItem(String countryCodesItem) { + if (this.countryCodes == null) { + this.countryCodes = new ArrayList<>(); + } + this.countryCodes.add(countryCodesItem); + return this; + } + + /** + * Get countryCodes + * @return countryCodes + */ + @javax.annotation.Nullable + public List getCountryCodes() { + return countryCodes; + } + + public void setCountryCodes(@javax.annotation.Nullable List countryCodes) { + this.countryCodes = countryCodes; + } + + + public WatchlistMeshLists fields(@javax.annotation.Nullable List fields) { + this.fields = fields; + return this; + } + + public WatchlistMeshLists addFieldsItem(WatchlistMeshField fieldsItem) { + if (this.fields == null) { + this.fields = new ArrayList<>(); + } + this.fields.add(fieldsItem); + return this; + } + + /** + * Get fields + * @return fields + */ + @javax.annotation.Nullable + public List getFields() { + return fields; + } + + public void setFields(@javax.annotation.Nullable List fields) { + this.fields = fields; + } + + + public WatchlistMeshLists identifier(@javax.annotation.Nullable String identifier) { + this.identifier = identifier; + return this; + } + + /** + * Get identifier + * @return identifier + */ + @javax.annotation.Nullable + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(@javax.annotation.Nullable String identifier) { + this.identifier = identifier; + } + + + public WatchlistMeshLists listingEndedUtc(@javax.annotation.Nullable String listingEndedUtc) { + this.listingEndedUtc = listingEndedUtc; + return this; + } + + /** + * Get listingEndedUtc + * @return listingEndedUtc + */ + @javax.annotation.Nullable + public String getListingEndedUtc() { + return listingEndedUtc; + } + + public void setListingEndedUtc(@javax.annotation.Nullable String listingEndedUtc) { + this.listingEndedUtc = listingEndedUtc; + } + + + public WatchlistMeshLists listingStartedUtc(@javax.annotation.Nullable String listingStartedUtc) { + this.listingStartedUtc = listingStartedUtc; + return this; + } + + /** + * Get listingStartedUtc + * @return listingStartedUtc + */ + @javax.annotation.Nullable + public String getListingStartedUtc() { + return listingStartedUtc; + } + + public void setListingStartedUtc(@javax.annotation.Nullable String listingStartedUtc) { + this.listingStartedUtc = listingStartedUtc; + } + + + public WatchlistMeshLists name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public WatchlistMeshLists relatedUrls(@javax.annotation.Nullable List relatedUrls) { + this.relatedUrls = relatedUrls; + return this; + } + + public WatchlistMeshLists addRelatedUrlsItem(String relatedUrlsItem) { + if (this.relatedUrls == null) { + this.relatedUrls = new ArrayList<>(); + } + this.relatedUrls.add(relatedUrlsItem); + return this; + } + + /** + * Get relatedUrls + * @return relatedUrls + */ + @javax.annotation.Nullable + public List getRelatedUrls() { + return relatedUrls; + } + + public void setRelatedUrls(@javax.annotation.Nullable List relatedUrls) { + this.relatedUrls = relatedUrls; + } + + + public WatchlistMeshLists url(@javax.annotation.Nullable String url) { + this.url = url; + return this; + } + + /** + * Get url + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nullable String url) { + this.url = url; + } + + /** + * 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 WatchlistMeshLists instance itself + */ + public WatchlistMeshLists 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; + } + WatchlistMeshLists watchlistMeshLists = (WatchlistMeshLists) o; + return Objects.equals(this.amlTypes, watchlistMeshLists.amlTypes) && + Objects.equals(this.countryCodes, watchlistMeshLists.countryCodes) && + Objects.equals(this.fields, watchlistMeshLists.fields) && + Objects.equals(this.identifier, watchlistMeshLists.identifier) && + Objects.equals(this.listingEndedUtc, watchlistMeshLists.listingEndedUtc) && + Objects.equals(this.listingStartedUtc, watchlistMeshLists.listingStartedUtc) && + Objects.equals(this.name, watchlistMeshLists.name) && + Objects.equals(this.relatedUrls, watchlistMeshLists.relatedUrls) && + Objects.equals(this.url, watchlistMeshLists.url)&& + Objects.equals(this.additionalProperties, watchlistMeshLists.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(amlTypes, countryCodes, fields, identifier, listingEndedUtc, listingStartedUtc, name, relatedUrls, url, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WatchlistMeshLists {\n"); + sb.append(" amlTypes: ").append(toIndentedString(amlTypes)).append("\n"); + sb.append(" countryCodes: ").append(toIndentedString(countryCodes)).append("\n"); + sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); + sb.append(" identifier: ").append(toIndentedString(identifier)).append("\n"); + sb.append(" listingEndedUtc: ").append(toIndentedString(listingEndedUtc)).append("\n"); + sb.append(" listingStartedUtc: ").append(toIndentedString(listingStartedUtc)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" relatedUrls: ").append(toIndentedString(relatedUrls)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).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(Arrays.asList("aml_types", "country_codes", "fields", "identifier", "listing_ended_utc", "listing_started_utc", "name", "related_urls", "url")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 WatchlistMeshLists + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WatchlistMeshLists.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in WatchlistMeshLists is not found in the empty JSON string", WatchlistMeshLists.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("aml_types") != null && !jsonObj.get("aml_types").isJsonNull() && !jsonObj.get("aml_types").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `aml_types` to be an array in the JSON string but got `%s`", jsonObj.get("aml_types").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("country_codes") != null && !jsonObj.get("country_codes").isJsonNull() && !jsonObj.get("country_codes").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `country_codes` to be an array in the JSON string but got `%s`", jsonObj.get("country_codes").toString())); + } + if (jsonObj.get("fields") != null && !jsonObj.get("fields").isJsonNull()) { + JsonArray jsonArrayfields = jsonObj.getAsJsonArray("fields"); + if (jsonArrayfields != null) { + // ensure the json data is an array + if (!jsonObj.get("fields").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `fields` to be an array in the JSON string but got `%s`", jsonObj.get("fields").toString())); + } + + // validate the optional field `fields` (array) + for (int i = 0; i < jsonArrayfields.size(); i++) { + WatchlistMeshField.validateJsonElement(jsonArrayfields.get(i)); + }; + } + } + if ((jsonObj.get("identifier") != null && !jsonObj.get("identifier").isJsonNull()) && !jsonObj.get("identifier").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `identifier` to be a primitive type in the JSON string but got `%s`", jsonObj.get("identifier").toString())); + } + if ((jsonObj.get("listing_ended_utc") != null && !jsonObj.get("listing_ended_utc").isJsonNull()) && !jsonObj.get("listing_ended_utc").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `listing_ended_utc` to be a primitive type in the JSON string but got `%s`", jsonObj.get("listing_ended_utc").toString())); + } + if ((jsonObj.get("listing_started_utc") != null && !jsonObj.get("listing_started_utc").isJsonNull()) && !jsonObj.get("listing_started_utc").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `listing_started_utc` to be a primitive type in the JSON string but got `%s`", jsonObj.get("listing_started_utc").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("related_urls") != null && !jsonObj.get("related_urls").isJsonNull() && !jsonObj.get("related_urls").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `related_urls` to be an array in the JSON string but got `%s`", jsonObj.get("related_urls").toString())); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WatchlistMeshLists.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WatchlistMeshLists' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WatchlistMeshLists.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WatchlistMeshLists 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 WatchlistMeshLists read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WatchlistMeshLists 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(Locale.ROOT, "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 WatchlistMeshLists given an JSON string + * + * @param jsonString JSON string + * @return An instance of WatchlistMeshLists + * @throws IOException if the JSON string is invalid with respect to WatchlistMeshLists + */ + public static WatchlistMeshLists fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WatchlistMeshLists.class); + } + + /** + * Convert an instance of WatchlistMeshLists to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/WatchlistMeshMedia.java b/src/main/java/com/onfido/model/WatchlistMeshMedia.java new file mode 100644 index 0000000..9bbf089 --- /dev/null +++ b/src/main/java/com/onfido/model/WatchlistMeshMedia.java @@ -0,0 +1,416 @@ +/* + * 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 java.util.Locale; +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 org.openapitools.jackson.nullable.JsonNullable; + +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 java.util.Locale; + +import com.onfido.JSON; + +/** + * WatchlistMeshMedia + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0") +public class WatchlistMeshMedia { + public static final String SERIALIZED_NAME_IDENTIFIER = "identifier"; + @SerializedName(SERIALIZED_NAME_IDENTIFIER) + @javax.annotation.Nullable + private String identifier; + + public static final String SERIALIZED_NAME_PUBLISHING_DATE = "publishing_date"; + @SerializedName(SERIALIZED_NAME_PUBLISHING_DATE) + @javax.annotation.Nullable + private String publishingDate; + + public static final String SERIALIZED_NAME_SNIPPET = "snippet"; + @SerializedName(SERIALIZED_NAME_SNIPPET) + @javax.annotation.Nullable + private String snippet; + + public static final String SERIALIZED_NAME_TITLE = "title"; + @SerializedName(SERIALIZED_NAME_TITLE) + @javax.annotation.Nullable + private String title; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nullable + private String url; + + public WatchlistMeshMedia() { + } + + public WatchlistMeshMedia identifier(@javax.annotation.Nullable String identifier) { + this.identifier = identifier; + return this; + } + + /** + * Get identifier + * @return identifier + */ + @javax.annotation.Nullable + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(@javax.annotation.Nullable String identifier) { + this.identifier = identifier; + } + + + public WatchlistMeshMedia publishingDate(@javax.annotation.Nullable String publishingDate) { + this.publishingDate = publishingDate; + return this; + } + + /** + * Get publishingDate + * @return publishingDate + */ + @javax.annotation.Nullable + public String getPublishingDate() { + return publishingDate; + } + + public void setPublishingDate(@javax.annotation.Nullable String publishingDate) { + this.publishingDate = publishingDate; + } + + + public WatchlistMeshMedia snippet(@javax.annotation.Nullable String snippet) { + this.snippet = snippet; + return this; + } + + /** + * Get snippet + * @return snippet + */ + @javax.annotation.Nullable + public String getSnippet() { + return snippet; + } + + public void setSnippet(@javax.annotation.Nullable String snippet) { + this.snippet = snippet; + } + + + public WatchlistMeshMedia title(@javax.annotation.Nullable String title) { + this.title = title; + return this; + } + + /** + * Get title + * @return title + */ + @javax.annotation.Nullable + public String getTitle() { + return title; + } + + public void setTitle(@javax.annotation.Nullable String title) { + this.title = title; + } + + + public WatchlistMeshMedia url(@javax.annotation.Nullable String url) { + this.url = url; + return this; + } + + /** + * Get url + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nullable String url) { + this.url = url; + } + + /** + * 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 WatchlistMeshMedia instance itself + */ + public WatchlistMeshMedia 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; + } + WatchlistMeshMedia watchlistMeshMedia = (WatchlistMeshMedia) o; + return Objects.equals(this.identifier, watchlistMeshMedia.identifier) && + Objects.equals(this.publishingDate, watchlistMeshMedia.publishingDate) && + Objects.equals(this.snippet, watchlistMeshMedia.snippet) && + Objects.equals(this.title, watchlistMeshMedia.title) && + Objects.equals(this.url, watchlistMeshMedia.url)&& + Objects.equals(this.additionalProperties, watchlistMeshMedia.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(identifier, publishingDate, snippet, title, url, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WatchlistMeshMedia {\n"); + sb.append(" identifier: ").append(toIndentedString(identifier)).append("\n"); + sb.append(" publishingDate: ").append(toIndentedString(publishingDate)).append("\n"); + sb.append(" snippet: ").append(toIndentedString(snippet)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).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(Arrays.asList("identifier", "publishing_date", "snippet", "title", "url")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 WatchlistMeshMedia + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WatchlistMeshMedia.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in WatchlistMeshMedia is not found in the empty JSON string", WatchlistMeshMedia.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("identifier") != null && !jsonObj.get("identifier").isJsonNull()) && !jsonObj.get("identifier").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `identifier` to be a primitive type in the JSON string but got `%s`", jsonObj.get("identifier").toString())); + } + if ((jsonObj.get("publishing_date") != null && !jsonObj.get("publishing_date").isJsonNull()) && !jsonObj.get("publishing_date").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `publishing_date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("publishing_date").toString())); + } + if ((jsonObj.get("snippet") != null && !jsonObj.get("snippet").isJsonNull()) && !jsonObj.get("snippet").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `snippet` to be a primitive type in the JSON string but got `%s`", jsonObj.get("snippet").toString())); + } + if ((jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) && !jsonObj.get("title").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `title` to be a primitive type in the JSON string but got `%s`", jsonObj.get("title").toString())); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WatchlistMeshMedia.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WatchlistMeshMedia' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WatchlistMeshMedia.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WatchlistMeshMedia 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 WatchlistMeshMedia read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WatchlistMeshMedia 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(Locale.ROOT, "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 WatchlistMeshMedia given an JSON string + * + * @param jsonString JSON string + * @return An instance of WatchlistMeshMedia + * @throws IOException if the JSON string is invalid with respect to WatchlistMeshMedia + */ + public static WatchlistMeshMedia fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WatchlistMeshMedia.class); + } + + /** + * Convert an instance of WatchlistMeshMedia to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/WatchlistMeshName.java b/src/main/java/com/onfido/model/WatchlistMeshName.java new file mode 100644 index 0000000..7e2971c --- /dev/null +++ b/src/main/java/com/onfido/model/WatchlistMeshName.java @@ -0,0 +1,329 @@ +/* + * 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 java.util.Locale; +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 org.openapitools.jackson.nullable.JsonNullable; + +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 java.util.Locale; + +import com.onfido.JSON; + +/** + * WatchlistMeshName + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0") +public class WatchlistMeshName { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public WatchlistMeshName() { + } + + public WatchlistMeshName name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public WatchlistMeshName type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + /** + * 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 WatchlistMeshName instance itself + */ + public WatchlistMeshName 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; + } + WatchlistMeshName watchlistMeshName = (WatchlistMeshName) o; + return Objects.equals(this.name, watchlistMeshName.name) && + Objects.equals(this.type, watchlistMeshName.type)&& + Objects.equals(this.additionalProperties, watchlistMeshName.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, type, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WatchlistMeshName {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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(Arrays.asList("name", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 WatchlistMeshName + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WatchlistMeshName.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in WatchlistMeshName is not found in the empty JSON string", WatchlistMeshName.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WatchlistMeshName.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WatchlistMeshName' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WatchlistMeshName.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WatchlistMeshName 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 WatchlistMeshName read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WatchlistMeshName 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(Locale.ROOT, "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 WatchlistMeshName given an JSON string + * + * @param jsonString JSON string + * @return An instance of WatchlistMeshName + * @throws IOException if the JSON string is invalid with respect to WatchlistMeshName + */ + public static WatchlistMeshName fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WatchlistMeshName.class); + } + + /** + * Convert an instance of WatchlistMeshName to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/WatchlistMeshPep.java b/src/main/java/com/onfido/model/WatchlistMeshPep.java new file mode 100644 index 0000000..069e325 --- /dev/null +++ b/src/main/java/com/onfido/model/WatchlistMeshPep.java @@ -0,0 +1,771 @@ +/* + * 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 java.util.Locale; +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.WatchlistMeshField; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +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 java.util.Locale; + +import com.onfido.JSON; + +/** + * WatchlistMeshPep + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0") +public class WatchlistMeshPep { + public static final String SERIALIZED_NAME_AML_TYPES = "aml_types"; + @SerializedName(SERIALIZED_NAME_AML_TYPES) + @javax.annotation.Nullable + private List amlTypes; + + public static final String SERIALIZED_NAME_ACTIVE_END_DATES = "active_end_dates"; + @SerializedName(SERIALIZED_NAME_ACTIVE_END_DATES) + @javax.annotation.Nullable + private List activeEndDates; + + public static final String SERIALIZED_NAME_ACTIVE_START_DATES = "active_start_dates"; + @SerializedName(SERIALIZED_NAME_ACTIVE_START_DATES) + @javax.annotation.Nullable + private List activeStartDates; + + public static final String SERIALIZED_NAME_COUNTRY_CODES = "country_codes"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODES) + @javax.annotation.Nullable + private List countryCodes; + + public static final String SERIALIZED_NAME_FIELDS = "fields"; + @SerializedName(SERIALIZED_NAME_FIELDS) + @javax.annotation.Nullable + private List fields; + + public static final String SERIALIZED_NAME_IDENTIFIER = "identifier"; + @SerializedName(SERIALIZED_NAME_IDENTIFIER) + @javax.annotation.Nullable + private String identifier; + + public static final String SERIALIZED_NAME_LISTING_ENDED_UTC = "listing_ended_utc"; + @SerializedName(SERIALIZED_NAME_LISTING_ENDED_UTC) + @javax.annotation.Nullable + private String listingEndedUtc; + + public static final String SERIALIZED_NAME_LISTING_STARTED_UTC = "listing_started_utc"; + @SerializedName(SERIALIZED_NAME_LISTING_STARTED_UTC) + @javax.annotation.Nullable + private String listingStartedUtc; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_POLITICAL_PARTIES = "political_parties"; + @SerializedName(SERIALIZED_NAME_POLITICAL_PARTIES) + @javax.annotation.Nullable + private List politicalParties; + + public static final String SERIALIZED_NAME_POLITICAL_POSITIONS = "political_positions"; + @SerializedName(SERIALIZED_NAME_POLITICAL_POSITIONS) + @javax.annotation.Nullable + private List politicalPositions; + + public static final String SERIALIZED_NAME_POLITICAL_REGIONS = "political_regions"; + @SerializedName(SERIALIZED_NAME_POLITICAL_REGIONS) + @javax.annotation.Nullable + private List politicalRegions; + + public static final String SERIALIZED_NAME_RELATED_URLS = "related_urls"; + @SerializedName(SERIALIZED_NAME_RELATED_URLS) + @javax.annotation.Nullable + private List relatedUrls; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nullable + private String url; + + public WatchlistMeshPep() { + } + + public WatchlistMeshPep amlTypes(@javax.annotation.Nullable List amlTypes) { + this.amlTypes = amlTypes; + return this; + } + + public WatchlistMeshPep addAmlTypesItem(String amlTypesItem) { + if (this.amlTypes == null) { + this.amlTypes = new ArrayList<>(); + } + this.amlTypes.add(amlTypesItem); + return this; + } + + /** + * Get amlTypes + * @return amlTypes + */ + @javax.annotation.Nullable + public List getAmlTypes() { + return amlTypes; + } + + public void setAmlTypes(@javax.annotation.Nullable List amlTypes) { + this.amlTypes = amlTypes; + } + + + public WatchlistMeshPep activeEndDates(@javax.annotation.Nullable List activeEndDates) { + this.activeEndDates = activeEndDates; + return this; + } + + public WatchlistMeshPep addActiveEndDatesItem(String activeEndDatesItem) { + if (this.activeEndDates == null) { + this.activeEndDates = new ArrayList<>(); + } + this.activeEndDates.add(activeEndDatesItem); + return this; + } + + /** + * Get activeEndDates + * @return activeEndDates + */ + @javax.annotation.Nullable + public List getActiveEndDates() { + return activeEndDates; + } + + public void setActiveEndDates(@javax.annotation.Nullable List activeEndDates) { + this.activeEndDates = activeEndDates; + } + + + public WatchlistMeshPep activeStartDates(@javax.annotation.Nullable List activeStartDates) { + this.activeStartDates = activeStartDates; + return this; + } + + public WatchlistMeshPep addActiveStartDatesItem(String activeStartDatesItem) { + if (this.activeStartDates == null) { + this.activeStartDates = new ArrayList<>(); + } + this.activeStartDates.add(activeStartDatesItem); + return this; + } + + /** + * Get activeStartDates + * @return activeStartDates + */ + @javax.annotation.Nullable + public List getActiveStartDates() { + return activeStartDates; + } + + public void setActiveStartDates(@javax.annotation.Nullable List activeStartDates) { + this.activeStartDates = activeStartDates; + } + + + public WatchlistMeshPep countryCodes(@javax.annotation.Nullable List countryCodes) { + this.countryCodes = countryCodes; + return this; + } + + public WatchlistMeshPep addCountryCodesItem(String countryCodesItem) { + if (this.countryCodes == null) { + this.countryCodes = new ArrayList<>(); + } + this.countryCodes.add(countryCodesItem); + return this; + } + + /** + * Get countryCodes + * @return countryCodes + */ + @javax.annotation.Nullable + public List getCountryCodes() { + return countryCodes; + } + + public void setCountryCodes(@javax.annotation.Nullable List countryCodes) { + this.countryCodes = countryCodes; + } + + + public WatchlistMeshPep fields(@javax.annotation.Nullable List fields) { + this.fields = fields; + return this; + } + + public WatchlistMeshPep addFieldsItem(WatchlistMeshField fieldsItem) { + if (this.fields == null) { + this.fields = new ArrayList<>(); + } + this.fields.add(fieldsItem); + return this; + } + + /** + * Get fields + * @return fields + */ + @javax.annotation.Nullable + public List getFields() { + return fields; + } + + public void setFields(@javax.annotation.Nullable List fields) { + this.fields = fields; + } + + + public WatchlistMeshPep identifier(@javax.annotation.Nullable String identifier) { + this.identifier = identifier; + return this; + } + + /** + * Get identifier + * @return identifier + */ + @javax.annotation.Nullable + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(@javax.annotation.Nullable String identifier) { + this.identifier = identifier; + } + + + public WatchlistMeshPep listingEndedUtc(@javax.annotation.Nullable String listingEndedUtc) { + this.listingEndedUtc = listingEndedUtc; + return this; + } + + /** + * Get listingEndedUtc + * @return listingEndedUtc + */ + @javax.annotation.Nullable + public String getListingEndedUtc() { + return listingEndedUtc; + } + + public void setListingEndedUtc(@javax.annotation.Nullable String listingEndedUtc) { + this.listingEndedUtc = listingEndedUtc; + } + + + public WatchlistMeshPep listingStartedUtc(@javax.annotation.Nullable String listingStartedUtc) { + this.listingStartedUtc = listingStartedUtc; + return this; + } + + /** + * Get listingStartedUtc + * @return listingStartedUtc + */ + @javax.annotation.Nullable + public String getListingStartedUtc() { + return listingStartedUtc; + } + + public void setListingStartedUtc(@javax.annotation.Nullable String listingStartedUtc) { + this.listingStartedUtc = listingStartedUtc; + } + + + public WatchlistMeshPep name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public WatchlistMeshPep politicalParties(@javax.annotation.Nullable List politicalParties) { + this.politicalParties = politicalParties; + return this; + } + + public WatchlistMeshPep addPoliticalPartiesItem(String politicalPartiesItem) { + if (this.politicalParties == null) { + this.politicalParties = new ArrayList<>(); + } + this.politicalParties.add(politicalPartiesItem); + return this; + } + + /** + * Get politicalParties + * @return politicalParties + */ + @javax.annotation.Nullable + public List getPoliticalParties() { + return politicalParties; + } + + public void setPoliticalParties(@javax.annotation.Nullable List politicalParties) { + this.politicalParties = politicalParties; + } + + + public WatchlistMeshPep politicalPositions(@javax.annotation.Nullable List politicalPositions) { + this.politicalPositions = politicalPositions; + return this; + } + + public WatchlistMeshPep addPoliticalPositionsItem(String politicalPositionsItem) { + if (this.politicalPositions == null) { + this.politicalPositions = new ArrayList<>(); + } + this.politicalPositions.add(politicalPositionsItem); + return this; + } + + /** + * Get politicalPositions + * @return politicalPositions + */ + @javax.annotation.Nullable + public List getPoliticalPositions() { + return politicalPositions; + } + + public void setPoliticalPositions(@javax.annotation.Nullable List politicalPositions) { + this.politicalPositions = politicalPositions; + } + + + public WatchlistMeshPep politicalRegions(@javax.annotation.Nullable List politicalRegions) { + this.politicalRegions = politicalRegions; + return this; + } + + public WatchlistMeshPep addPoliticalRegionsItem(String politicalRegionsItem) { + if (this.politicalRegions == null) { + this.politicalRegions = new ArrayList<>(); + } + this.politicalRegions.add(politicalRegionsItem); + return this; + } + + /** + * Get politicalRegions + * @return politicalRegions + */ + @javax.annotation.Nullable + public List getPoliticalRegions() { + return politicalRegions; + } + + public void setPoliticalRegions(@javax.annotation.Nullable List politicalRegions) { + this.politicalRegions = politicalRegions; + } + + + public WatchlistMeshPep relatedUrls(@javax.annotation.Nullable List relatedUrls) { + this.relatedUrls = relatedUrls; + return this; + } + + public WatchlistMeshPep addRelatedUrlsItem(String relatedUrlsItem) { + if (this.relatedUrls == null) { + this.relatedUrls = new ArrayList<>(); + } + this.relatedUrls.add(relatedUrlsItem); + return this; + } + + /** + * Get relatedUrls + * @return relatedUrls + */ + @javax.annotation.Nullable + public List getRelatedUrls() { + return relatedUrls; + } + + public void setRelatedUrls(@javax.annotation.Nullable List relatedUrls) { + this.relatedUrls = relatedUrls; + } + + + public WatchlistMeshPep url(@javax.annotation.Nullable String url) { + this.url = url; + return this; + } + + /** + * Get url + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nullable String url) { + this.url = url; + } + + /** + * 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 WatchlistMeshPep instance itself + */ + public WatchlistMeshPep 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; + } + WatchlistMeshPep watchlistMeshPep = (WatchlistMeshPep) o; + return Objects.equals(this.amlTypes, watchlistMeshPep.amlTypes) && + Objects.equals(this.activeEndDates, watchlistMeshPep.activeEndDates) && + Objects.equals(this.activeStartDates, watchlistMeshPep.activeStartDates) && + Objects.equals(this.countryCodes, watchlistMeshPep.countryCodes) && + Objects.equals(this.fields, watchlistMeshPep.fields) && + Objects.equals(this.identifier, watchlistMeshPep.identifier) && + Objects.equals(this.listingEndedUtc, watchlistMeshPep.listingEndedUtc) && + Objects.equals(this.listingStartedUtc, watchlistMeshPep.listingStartedUtc) && + Objects.equals(this.name, watchlistMeshPep.name) && + Objects.equals(this.politicalParties, watchlistMeshPep.politicalParties) && + Objects.equals(this.politicalPositions, watchlistMeshPep.politicalPositions) && + Objects.equals(this.politicalRegions, watchlistMeshPep.politicalRegions) && + Objects.equals(this.relatedUrls, watchlistMeshPep.relatedUrls) && + Objects.equals(this.url, watchlistMeshPep.url)&& + Objects.equals(this.additionalProperties, watchlistMeshPep.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(amlTypes, activeEndDates, activeStartDates, countryCodes, fields, identifier, listingEndedUtc, listingStartedUtc, name, politicalParties, politicalPositions, politicalRegions, relatedUrls, url, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WatchlistMeshPep {\n"); + sb.append(" amlTypes: ").append(toIndentedString(amlTypes)).append("\n"); + sb.append(" activeEndDates: ").append(toIndentedString(activeEndDates)).append("\n"); + sb.append(" activeStartDates: ").append(toIndentedString(activeStartDates)).append("\n"); + sb.append(" countryCodes: ").append(toIndentedString(countryCodes)).append("\n"); + sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); + sb.append(" identifier: ").append(toIndentedString(identifier)).append("\n"); + sb.append(" listingEndedUtc: ").append(toIndentedString(listingEndedUtc)).append("\n"); + sb.append(" listingStartedUtc: ").append(toIndentedString(listingStartedUtc)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" politicalParties: ").append(toIndentedString(politicalParties)).append("\n"); + sb.append(" politicalPositions: ").append(toIndentedString(politicalPositions)).append("\n"); + sb.append(" politicalRegions: ").append(toIndentedString(politicalRegions)).append("\n"); + sb.append(" relatedUrls: ").append(toIndentedString(relatedUrls)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).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(Arrays.asList("aml_types", "active_end_dates", "active_start_dates", "country_codes", "fields", "identifier", "listing_ended_utc", "listing_started_utc", "name", "political_parties", "political_positions", "political_regions", "related_urls", "url")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 WatchlistMeshPep + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WatchlistMeshPep.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in WatchlistMeshPep is not found in the empty JSON string", WatchlistMeshPep.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("aml_types") != null && !jsonObj.get("aml_types").isJsonNull() && !jsonObj.get("aml_types").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `aml_types` to be an array in the JSON string but got `%s`", jsonObj.get("aml_types").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("active_end_dates") != null && !jsonObj.get("active_end_dates").isJsonNull() && !jsonObj.get("active_end_dates").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `active_end_dates` to be an array in the JSON string but got `%s`", jsonObj.get("active_end_dates").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("active_start_dates") != null && !jsonObj.get("active_start_dates").isJsonNull() && !jsonObj.get("active_start_dates").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `active_start_dates` to be an array in the JSON string but got `%s`", jsonObj.get("active_start_dates").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("country_codes") != null && !jsonObj.get("country_codes").isJsonNull() && !jsonObj.get("country_codes").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `country_codes` to be an array in the JSON string but got `%s`", jsonObj.get("country_codes").toString())); + } + if (jsonObj.get("fields") != null && !jsonObj.get("fields").isJsonNull()) { + JsonArray jsonArrayfields = jsonObj.getAsJsonArray("fields"); + if (jsonArrayfields != null) { + // ensure the json data is an array + if (!jsonObj.get("fields").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `fields` to be an array in the JSON string but got `%s`", jsonObj.get("fields").toString())); + } + + // validate the optional field `fields` (array) + for (int i = 0; i < jsonArrayfields.size(); i++) { + WatchlistMeshField.validateJsonElement(jsonArrayfields.get(i)); + }; + } + } + if ((jsonObj.get("identifier") != null && !jsonObj.get("identifier").isJsonNull()) && !jsonObj.get("identifier").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `identifier` to be a primitive type in the JSON string but got `%s`", jsonObj.get("identifier").toString())); + } + if ((jsonObj.get("listing_ended_utc") != null && !jsonObj.get("listing_ended_utc").isJsonNull()) && !jsonObj.get("listing_ended_utc").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `listing_ended_utc` to be a primitive type in the JSON string but got `%s`", jsonObj.get("listing_ended_utc").toString())); + } + if ((jsonObj.get("listing_started_utc") != null && !jsonObj.get("listing_started_utc").isJsonNull()) && !jsonObj.get("listing_started_utc").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `listing_started_utc` to be a primitive type in the JSON string but got `%s`", jsonObj.get("listing_started_utc").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("political_parties") != null && !jsonObj.get("political_parties").isJsonNull() && !jsonObj.get("political_parties").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `political_parties` to be an array in the JSON string but got `%s`", jsonObj.get("political_parties").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("political_positions") != null && !jsonObj.get("political_positions").isJsonNull() && !jsonObj.get("political_positions").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `political_positions` to be an array in the JSON string but got `%s`", jsonObj.get("political_positions").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("political_regions") != null && !jsonObj.get("political_regions").isJsonNull() && !jsonObj.get("political_regions").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `political_regions` to be an array in the JSON string but got `%s`", jsonObj.get("political_regions").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("related_urls") != null && !jsonObj.get("related_urls").isJsonNull() && !jsonObj.get("related_urls").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `related_urls` to be an array in the JSON string but got `%s`", jsonObj.get("related_urls").toString())); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WatchlistMeshPep.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WatchlistMeshPep' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WatchlistMeshPep.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WatchlistMeshPep 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 WatchlistMeshPep read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WatchlistMeshPep 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(Locale.ROOT, "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 WatchlistMeshPep given an JSON string + * + * @param jsonString JSON string + * @return An instance of WatchlistMeshPep + * @throws IOException if the JSON string is invalid with respect to WatchlistMeshPep + */ + public static WatchlistMeshPep fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WatchlistMeshPep.class); + } + + /** + * Convert an instance of WatchlistMeshPep to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/WatchlistMeshPerson.java b/src/main/java/com/onfido/model/WatchlistMeshPerson.java new file mode 100644 index 0000000..887e6ae --- /dev/null +++ b/src/main/java/com/onfido/model/WatchlistMeshPerson.java @@ -0,0 +1,555 @@ +/* + * 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 java.util.Locale; +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.WatchlistMeshAssociate; +import com.onfido.model.WatchlistMeshDateValue; +import com.onfido.model.WatchlistMeshImage; +import com.onfido.model.WatchlistMeshName; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +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 java.util.Locale; + +import com.onfido.JSON; + +/** + * WatchlistMeshPerson + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0") +public class WatchlistMeshPerson { + public static final String SERIALIZED_NAME_ASSOCIATES = "associates"; + @SerializedName(SERIALIZED_NAME_ASSOCIATES) + @javax.annotation.Nullable + private List associates; + + public static final String SERIALIZED_NAME_DATES_OF_BIRTH = "dates_of_birth"; + @SerializedName(SERIALIZED_NAME_DATES_OF_BIRTH) + @javax.annotation.Nullable + private List datesOfBirth; + + public static final String SERIALIZED_NAME_DATES_OF_DEATH = "dates_of_death"; + @SerializedName(SERIALIZED_NAME_DATES_OF_DEATH) + @javax.annotation.Nullable + private List datesOfDeath; + + public static final String SERIALIZED_NAME_IMAGES = "images"; + @SerializedName(SERIALIZED_NAME_IMAGES) + @javax.annotation.Nullable + private List images; + + public static final String SERIALIZED_NAME_NAMES = "names"; + @SerializedName(SERIALIZED_NAME_NAMES) + @javax.annotation.Nullable + private List names; + + public static final String SERIALIZED_NAME_PLACES_OF_BIRTH = "places_of_birth"; + @SerializedName(SERIALIZED_NAME_PLACES_OF_BIRTH) + @javax.annotation.Nullable + private List placesOfBirth; + + public WatchlistMeshPerson() { + } + + public WatchlistMeshPerson associates(@javax.annotation.Nullable List associates) { + this.associates = associates; + return this; + } + + public WatchlistMeshPerson addAssociatesItem(WatchlistMeshAssociate associatesItem) { + if (this.associates == null) { + this.associates = new ArrayList<>(); + } + this.associates.add(associatesItem); + return this; + } + + /** + * Get associates + * @return associates + */ + @javax.annotation.Nullable + public List getAssociates() { + return associates; + } + + public void setAssociates(@javax.annotation.Nullable List associates) { + this.associates = associates; + } + + + public WatchlistMeshPerson datesOfBirth(@javax.annotation.Nullable List datesOfBirth) { + this.datesOfBirth = datesOfBirth; + return this; + } + + public WatchlistMeshPerson addDatesOfBirthItem(WatchlistMeshDateValue datesOfBirthItem) { + if (this.datesOfBirth == null) { + this.datesOfBirth = new ArrayList<>(); + } + this.datesOfBirth.add(datesOfBirthItem); + return this; + } + + /** + * Get datesOfBirth + * @return datesOfBirth + */ + @javax.annotation.Nullable + public List getDatesOfBirth() { + return datesOfBirth; + } + + public void setDatesOfBirth(@javax.annotation.Nullable List datesOfBirth) { + this.datesOfBirth = datesOfBirth; + } + + + public WatchlistMeshPerson datesOfDeath(@javax.annotation.Nullable List datesOfDeath) { + this.datesOfDeath = datesOfDeath; + return this; + } + + public WatchlistMeshPerson addDatesOfDeathItem(WatchlistMeshDateValue datesOfDeathItem) { + if (this.datesOfDeath == null) { + this.datesOfDeath = new ArrayList<>(); + } + this.datesOfDeath.add(datesOfDeathItem); + return this; + } + + /** + * Get datesOfDeath + * @return datesOfDeath + */ + @javax.annotation.Nullable + public List getDatesOfDeath() { + return datesOfDeath; + } + + public void setDatesOfDeath(@javax.annotation.Nullable List datesOfDeath) { + this.datesOfDeath = datesOfDeath; + } + + + public WatchlistMeshPerson images(@javax.annotation.Nullable List images) { + this.images = images; + return this; + } + + public WatchlistMeshPerson addImagesItem(WatchlistMeshImage imagesItem) { + if (this.images == null) { + this.images = new ArrayList<>(); + } + this.images.add(imagesItem); + return this; + } + + /** + * Get images + * @return images + */ + @javax.annotation.Nullable + public List getImages() { + return images; + } + + public void setImages(@javax.annotation.Nullable List images) { + this.images = images; + } + + + public WatchlistMeshPerson names(@javax.annotation.Nullable List names) { + this.names = names; + return this; + } + + public WatchlistMeshPerson addNamesItem(WatchlistMeshName namesItem) { + if (this.names == null) { + this.names = new ArrayList<>(); + } + this.names.add(namesItem); + return this; + } + + /** + * Get names + * @return names + */ + @javax.annotation.Nullable + public List getNames() { + return names; + } + + public void setNames(@javax.annotation.Nullable List names) { + this.names = names; + } + + + public WatchlistMeshPerson placesOfBirth(@javax.annotation.Nullable List placesOfBirth) { + this.placesOfBirth = placesOfBirth; + return this; + } + + public WatchlistMeshPerson addPlacesOfBirthItem(String placesOfBirthItem) { + if (this.placesOfBirth == null) { + this.placesOfBirth = new ArrayList<>(); + } + this.placesOfBirth.add(placesOfBirthItem); + return this; + } + + /** + * Get placesOfBirth + * @return placesOfBirth + */ + @javax.annotation.Nullable + public List getPlacesOfBirth() { + return placesOfBirth; + } + + public void setPlacesOfBirth(@javax.annotation.Nullable List placesOfBirth) { + this.placesOfBirth = placesOfBirth; + } + + /** + * 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 WatchlistMeshPerson instance itself + */ + public WatchlistMeshPerson 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; + } + WatchlistMeshPerson watchlistMeshPerson = (WatchlistMeshPerson) o; + return Objects.equals(this.associates, watchlistMeshPerson.associates) && + Objects.equals(this.datesOfBirth, watchlistMeshPerson.datesOfBirth) && + Objects.equals(this.datesOfDeath, watchlistMeshPerson.datesOfDeath) && + Objects.equals(this.images, watchlistMeshPerson.images) && + Objects.equals(this.names, watchlistMeshPerson.names) && + Objects.equals(this.placesOfBirth, watchlistMeshPerson.placesOfBirth)&& + Objects.equals(this.additionalProperties, watchlistMeshPerson.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(associates, datesOfBirth, datesOfDeath, images, names, placesOfBirth, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WatchlistMeshPerson {\n"); + sb.append(" associates: ").append(toIndentedString(associates)).append("\n"); + sb.append(" datesOfBirth: ").append(toIndentedString(datesOfBirth)).append("\n"); + sb.append(" datesOfDeath: ").append(toIndentedString(datesOfDeath)).append("\n"); + sb.append(" images: ").append(toIndentedString(images)).append("\n"); + sb.append(" names: ").append(toIndentedString(names)).append("\n"); + sb.append(" placesOfBirth: ").append(toIndentedString(placesOfBirth)).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(Arrays.asList("associates", "dates_of_birth", "dates_of_death", "images", "names", "places_of_birth")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 WatchlistMeshPerson + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WatchlistMeshPerson.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in WatchlistMeshPerson is not found in the empty JSON string", WatchlistMeshPerson.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("associates") != null && !jsonObj.get("associates").isJsonNull()) { + JsonArray jsonArrayassociates = jsonObj.getAsJsonArray("associates"); + if (jsonArrayassociates != null) { + // ensure the json data is an array + if (!jsonObj.get("associates").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `associates` to be an array in the JSON string but got `%s`", jsonObj.get("associates").toString())); + } + + // validate the optional field `associates` (array) + for (int i = 0; i < jsonArrayassociates.size(); i++) { + WatchlistMeshAssociate.validateJsonElement(jsonArrayassociates.get(i)); + }; + } + } + if (jsonObj.get("dates_of_birth") != null && !jsonObj.get("dates_of_birth").isJsonNull()) { + JsonArray jsonArraydatesOfBirth = jsonObj.getAsJsonArray("dates_of_birth"); + if (jsonArraydatesOfBirth != null) { + // ensure the json data is an array + if (!jsonObj.get("dates_of_birth").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `dates_of_birth` to be an array in the JSON string but got `%s`", jsonObj.get("dates_of_birth").toString())); + } + + // validate the optional field `dates_of_birth` (array) + for (int i = 0; i < jsonArraydatesOfBirth.size(); i++) { + WatchlistMeshDateValue.validateJsonElement(jsonArraydatesOfBirth.get(i)); + }; + } + } + if (jsonObj.get("dates_of_death") != null && !jsonObj.get("dates_of_death").isJsonNull()) { + JsonArray jsonArraydatesOfDeath = jsonObj.getAsJsonArray("dates_of_death"); + if (jsonArraydatesOfDeath != null) { + // ensure the json data is an array + if (!jsonObj.get("dates_of_death").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `dates_of_death` to be an array in the JSON string but got `%s`", jsonObj.get("dates_of_death").toString())); + } + + // validate the optional field `dates_of_death` (array) + for (int i = 0; i < jsonArraydatesOfDeath.size(); i++) { + WatchlistMeshDateValue.validateJsonElement(jsonArraydatesOfDeath.get(i)); + }; + } + } + if (jsonObj.get("images") != null && !jsonObj.get("images").isJsonNull()) { + JsonArray jsonArrayimages = jsonObj.getAsJsonArray("images"); + if (jsonArrayimages != null) { + // ensure the json data is an array + if (!jsonObj.get("images").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `images` to be an array in the JSON string but got `%s`", jsonObj.get("images").toString())); + } + + // validate the optional field `images` (array) + for (int i = 0; i < jsonArrayimages.size(); i++) { + WatchlistMeshImage.validateJsonElement(jsonArrayimages.get(i)); + }; + } + } + if (jsonObj.get("names") != null && !jsonObj.get("names").isJsonNull()) { + JsonArray jsonArraynames = jsonObj.getAsJsonArray("names"); + if (jsonArraynames != null) { + // ensure the json data is an array + if (!jsonObj.get("names").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `names` to be an array in the JSON string but got `%s`", jsonObj.get("names").toString())); + } + + // validate the optional field `names` (array) + for (int i = 0; i < jsonArraynames.size(); i++) { + WatchlistMeshName.validateJsonElement(jsonArraynames.get(i)); + }; + } + } + // ensure the optional json data is an array if present + if (jsonObj.get("places_of_birth") != null && !jsonObj.get("places_of_birth").isJsonNull() && !jsonObj.get("places_of_birth").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `places_of_birth` to be an array in the JSON string but got `%s`", jsonObj.get("places_of_birth").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WatchlistMeshPerson.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WatchlistMeshPerson' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WatchlistMeshPerson.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WatchlistMeshPerson 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 WatchlistMeshPerson read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WatchlistMeshPerson 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(Locale.ROOT, "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 WatchlistMeshPerson given an JSON string + * + * @param jsonString JSON string + * @return An instance of WatchlistMeshPerson + * @throws IOException if the JSON string is invalid with respect to WatchlistMeshPerson + */ + public static WatchlistMeshPerson fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WatchlistMeshPerson.class); + } + + /** + * Convert an instance of WatchlistMeshPerson to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/WatchlistMeshProfile.java b/src/main/java/com/onfido/model/WatchlistMeshProfile.java new file mode 100644 index 0000000..3945e08 --- /dev/null +++ b/src/main/java/com/onfido/model/WatchlistMeshProfile.java @@ -0,0 +1,458 @@ +/* + * 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 java.util.Locale; +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.WatchlistMeshPerson; +import com.onfido.model.WatchlistMeshRiskIndicators; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +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 java.util.Locale; + +import com.onfido.JSON; + +/** + * WatchlistMeshProfile + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0") +public class WatchlistMeshProfile { + public static final String SERIALIZED_NAME_IDENTIFIER = "identifier"; + @SerializedName(SERIALIZED_NAME_IDENTIFIER) + @javax.annotation.Nullable + private String identifier; + + public static final String SERIALIZED_NAME_MATCH_TYPES = "match_types"; + @SerializedName(SERIALIZED_NAME_MATCH_TYPES) + @javax.annotation.Nullable + private List matchTypes; + + public static final String SERIALIZED_NAME_MATCH_SCORE = "match_score"; + @SerializedName(SERIALIZED_NAME_MATCH_SCORE) + @javax.annotation.Nullable + private BigDecimal matchScore; + + public static final String SERIALIZED_NAME_MATCHING_NAME = "matching_name"; + @SerializedName(SERIALIZED_NAME_MATCHING_NAME) + @javax.annotation.Nullable + private String matchingName; + + public static final String SERIALIZED_NAME_PERSON = "person"; + @SerializedName(SERIALIZED_NAME_PERSON) + @javax.annotation.Nullable + private WatchlistMeshPerson person; + + public static final String SERIALIZED_NAME_RISK_INDICATORS = "risk_indicators"; + @SerializedName(SERIALIZED_NAME_RISK_INDICATORS) + @javax.annotation.Nullable + private WatchlistMeshRiskIndicators riskIndicators; + + public WatchlistMeshProfile() { + } + + public WatchlistMeshProfile identifier(@javax.annotation.Nullable String identifier) { + this.identifier = identifier; + return this; + } + + /** + * Get identifier + * @return identifier + */ + @javax.annotation.Nullable + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(@javax.annotation.Nullable String identifier) { + this.identifier = identifier; + } + + + public WatchlistMeshProfile matchTypes(@javax.annotation.Nullable List matchTypes) { + this.matchTypes = matchTypes; + return this; + } + + public WatchlistMeshProfile addMatchTypesItem(String matchTypesItem) { + if (this.matchTypes == null) { + this.matchTypes = new ArrayList<>(); + } + this.matchTypes.add(matchTypesItem); + return this; + } + + /** + * Get matchTypes + * @return matchTypes + */ + @javax.annotation.Nullable + public List getMatchTypes() { + return matchTypes; + } + + public void setMatchTypes(@javax.annotation.Nullable List matchTypes) { + this.matchTypes = matchTypes; + } + + + public WatchlistMeshProfile matchScore(@javax.annotation.Nullable BigDecimal matchScore) { + this.matchScore = matchScore; + return this; + } + + /** + * The match score assigned to the profile. + * @return matchScore + */ + @javax.annotation.Nullable + public BigDecimal getMatchScore() { + return matchScore; + } + + public void setMatchScore(@javax.annotation.Nullable BigDecimal matchScore) { + this.matchScore = matchScore; + } + + + public WatchlistMeshProfile matchingName(@javax.annotation.Nullable String matchingName) { + this.matchingName = matchingName; + return this; + } + + /** + * Get matchingName + * @return matchingName + */ + @javax.annotation.Nullable + public String getMatchingName() { + return matchingName; + } + + public void setMatchingName(@javax.annotation.Nullable String matchingName) { + this.matchingName = matchingName; + } + + + public WatchlistMeshProfile person(@javax.annotation.Nullable WatchlistMeshPerson person) { + this.person = person; + return this; + } + + /** + * Get person + * @return person + */ + @javax.annotation.Nullable + public WatchlistMeshPerson getPerson() { + return person; + } + + public void setPerson(@javax.annotation.Nullable WatchlistMeshPerson person) { + this.person = person; + } + + + public WatchlistMeshProfile riskIndicators(@javax.annotation.Nullable WatchlistMeshRiskIndicators riskIndicators) { + this.riskIndicators = riskIndicators; + return this; + } + + /** + * Get riskIndicators + * @return riskIndicators + */ + @javax.annotation.Nullable + public WatchlistMeshRiskIndicators getRiskIndicators() { + return riskIndicators; + } + + public void setRiskIndicators(@javax.annotation.Nullable WatchlistMeshRiskIndicators riskIndicators) { + this.riskIndicators = riskIndicators; + } + + /** + * 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 WatchlistMeshProfile instance itself + */ + public WatchlistMeshProfile 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; + } + WatchlistMeshProfile watchlistMeshProfile = (WatchlistMeshProfile) o; + return Objects.equals(this.identifier, watchlistMeshProfile.identifier) && + Objects.equals(this.matchTypes, watchlistMeshProfile.matchTypes) && + Objects.equals(this.matchScore, watchlistMeshProfile.matchScore) && + Objects.equals(this.matchingName, watchlistMeshProfile.matchingName) && + Objects.equals(this.person, watchlistMeshProfile.person) && + Objects.equals(this.riskIndicators, watchlistMeshProfile.riskIndicators)&& + Objects.equals(this.additionalProperties, watchlistMeshProfile.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(identifier, matchTypes, matchScore, matchingName, person, riskIndicators, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WatchlistMeshProfile {\n"); + sb.append(" identifier: ").append(toIndentedString(identifier)).append("\n"); + sb.append(" matchTypes: ").append(toIndentedString(matchTypes)).append("\n"); + sb.append(" matchScore: ").append(toIndentedString(matchScore)).append("\n"); + sb.append(" matchingName: ").append(toIndentedString(matchingName)).append("\n"); + sb.append(" person: ").append(toIndentedString(person)).append("\n"); + sb.append(" riskIndicators: ").append(toIndentedString(riskIndicators)).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(Arrays.asList("identifier", "match_types", "match_score", "matching_name", "person", "risk_indicators")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 WatchlistMeshProfile + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WatchlistMeshProfile.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in WatchlistMeshProfile is not found in the empty JSON string", WatchlistMeshProfile.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("identifier") != null && !jsonObj.get("identifier").isJsonNull()) && !jsonObj.get("identifier").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `identifier` to be a primitive type in the JSON string but got `%s`", jsonObj.get("identifier").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("match_types") != null && !jsonObj.get("match_types").isJsonNull() && !jsonObj.get("match_types").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `match_types` to be an array in the JSON string but got `%s`", jsonObj.get("match_types").toString())); + } + if ((jsonObj.get("matching_name") != null && !jsonObj.get("matching_name").isJsonNull()) && !jsonObj.get("matching_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `matching_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("matching_name").toString())); + } + // validate the optional field `person` + if (jsonObj.get("person") != null && !jsonObj.get("person").isJsonNull()) { + WatchlistMeshPerson.validateJsonElement(jsonObj.get("person")); + } + // validate the optional field `risk_indicators` + if (jsonObj.get("risk_indicators") != null && !jsonObj.get("risk_indicators").isJsonNull()) { + WatchlistMeshRiskIndicators.validateJsonElement(jsonObj.get("risk_indicators")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WatchlistMeshProfile.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WatchlistMeshProfile' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WatchlistMeshProfile.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WatchlistMeshProfile 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 WatchlistMeshProfile read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WatchlistMeshProfile 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(Locale.ROOT, "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 WatchlistMeshProfile given an JSON string + * + * @param jsonString JSON string + * @return An instance of WatchlistMeshProfile + * @throws IOException if the JSON string is invalid with respect to WatchlistMeshProfile + */ + public static WatchlistMeshProfile fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WatchlistMeshProfile.class); + } + + /** + * Convert an instance of WatchlistMeshProfile to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/WatchlistMeshRiskDecision.java b/src/main/java/com/onfido/model/WatchlistMeshRiskDecision.java new file mode 100644 index 0000000..96a843b --- /dev/null +++ b/src/main/java/com/onfido/model/WatchlistMeshRiskDecision.java @@ -0,0 +1,86 @@ +/* + * 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 java.util.Locale; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets watchlist_mesh_risk_decision + */ +@JsonAdapter(WatchlistMeshRiskDecision.Adapter.class) +public enum WatchlistMeshRiskDecision { + + NOT_REVIEWED("NOT_REVIEWED"), + + IN_REVIEW("IN_REVIEW"), + + FALSE_POSITIVE("FALSE_POSITIVE"), + + TRUE_POSITIVE("TRUE_POSITIVE"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + WatchlistMeshRiskDecision(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static WatchlistMeshRiskDecision fromValue(String value) { + for (WatchlistMeshRiskDecision b : WatchlistMeshRiskDecision.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 WatchlistMeshRiskDecision enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public WatchlistMeshRiskDecision read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return WatchlistMeshRiskDecision.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + WatchlistMeshRiskDecision.fromValue(value); + } +} + diff --git a/src/main/java/com/onfido/model/WatchlistMeshRiskDetail.java b/src/main/java/com/onfido/model/WatchlistMeshRiskDetail.java new file mode 100644 index 0000000..692e026 --- /dev/null +++ b/src/main/java/com/onfido/model/WatchlistMeshRiskDetail.java @@ -0,0 +1,392 @@ +/* + * 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 java.util.Locale; +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.WatchlistMeshAddedMentions; +import com.onfido.model.WatchlistMeshProfile; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +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 java.util.Locale; + +import com.onfido.JSON; + +/** + * WatchlistMeshRiskDetail + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0") +public class WatchlistMeshRiskDetail { + public static final String SERIALIZED_NAME_CHANGE_TYPE = "change_type"; + @SerializedName(SERIALIZED_NAME_CHANGE_TYPE) + @javax.annotation.Nullable + private String changeType; + + public static final String SERIALIZED_NAME_CONFIGURATION_IDENTIFIER = "configuration_identifier"; + @SerializedName(SERIALIZED_NAME_CONFIGURATION_IDENTIFIER) + @javax.annotation.Nullable + private UUID configurationIdentifier; + + public static final String SERIALIZED_NAME_PROFILE = "profile"; + @SerializedName(SERIALIZED_NAME_PROFILE) + @javax.annotation.Nullable + private WatchlistMeshProfile profile; + + public static final String SERIALIZED_NAME_ADDED_MENTIONS = "added_mentions"; + @SerializedName(SERIALIZED_NAME_ADDED_MENTIONS) + @javax.annotation.Nullable + private WatchlistMeshAddedMentions addedMentions; + + public WatchlistMeshRiskDetail() { + } + + public WatchlistMeshRiskDetail changeType(@javax.annotation.Nullable String changeType) { + this.changeType = changeType; + return this; + } + + /** + * The type of change that triggered the risk, if available. + * @return changeType + */ + @javax.annotation.Nullable + public String getChangeType() { + return changeType; + } + + public void setChangeType(@javax.annotation.Nullable String changeType) { + this.changeType = changeType; + } + + + public WatchlistMeshRiskDetail configurationIdentifier(@javax.annotation.Nullable UUID configurationIdentifier) { + this.configurationIdentifier = configurationIdentifier; + return this; + } + + /** + * The identifier of the screening configuration associated with the risk. + * @return configurationIdentifier + */ + @javax.annotation.Nullable + public UUID getConfigurationIdentifier() { + return configurationIdentifier; + } + + public void setConfigurationIdentifier(@javax.annotation.Nullable UUID configurationIdentifier) { + this.configurationIdentifier = configurationIdentifier; + } + + + public WatchlistMeshRiskDetail profile(@javax.annotation.Nullable WatchlistMeshProfile profile) { + this.profile = profile; + return this; + } + + /** + * The matched profile associated with the risk. + * @return profile + */ + @javax.annotation.Nullable + public WatchlistMeshProfile getProfile() { + return profile; + } + + public void setProfile(@javax.annotation.Nullable WatchlistMeshProfile profile) { + this.profile = profile; + } + + + public WatchlistMeshRiskDetail addedMentions(@javax.annotation.Nullable WatchlistMeshAddedMentions addedMentions) { + this.addedMentions = addedMentions; + return this; + } + + /** + * Newly added mentions associated with the risk. + * @return addedMentions + */ + @javax.annotation.Nullable + public WatchlistMeshAddedMentions getAddedMentions() { + return addedMentions; + } + + public void setAddedMentions(@javax.annotation.Nullable WatchlistMeshAddedMentions addedMentions) { + this.addedMentions = addedMentions; + } + + /** + * 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 WatchlistMeshRiskDetail instance itself + */ + public WatchlistMeshRiskDetail 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; + } + WatchlistMeshRiskDetail watchlistMeshRiskDetail = (WatchlistMeshRiskDetail) o; + return Objects.equals(this.changeType, watchlistMeshRiskDetail.changeType) && + Objects.equals(this.configurationIdentifier, watchlistMeshRiskDetail.configurationIdentifier) && + Objects.equals(this.profile, watchlistMeshRiskDetail.profile) && + Objects.equals(this.addedMentions, watchlistMeshRiskDetail.addedMentions)&& + Objects.equals(this.additionalProperties, watchlistMeshRiskDetail.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(changeType, configurationIdentifier, profile, addedMentions, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WatchlistMeshRiskDetail {\n"); + sb.append(" changeType: ").append(toIndentedString(changeType)).append("\n"); + sb.append(" configurationIdentifier: ").append(toIndentedString(configurationIdentifier)).append("\n"); + sb.append(" profile: ").append(toIndentedString(profile)).append("\n"); + sb.append(" addedMentions: ").append(toIndentedString(addedMentions)).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(Arrays.asList("change_type", "configuration_identifier", "profile", "added_mentions")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 WatchlistMeshRiskDetail + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WatchlistMeshRiskDetail.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in WatchlistMeshRiskDetail is not found in the empty JSON string", WatchlistMeshRiskDetail.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("change_type") != null && !jsonObj.get("change_type").isJsonNull()) && !jsonObj.get("change_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `change_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("change_type").toString())); + } + if ((jsonObj.get("configuration_identifier") != null && !jsonObj.get("configuration_identifier").isJsonNull()) && !jsonObj.get("configuration_identifier").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `configuration_identifier` to be a primitive type in the JSON string but got `%s`", jsonObj.get("configuration_identifier").toString())); + } + // validate the optional field `profile` + if (jsonObj.get("profile") != null && !jsonObj.get("profile").isJsonNull()) { + WatchlistMeshProfile.validateJsonElement(jsonObj.get("profile")); + } + // validate the optional field `added_mentions` + if (jsonObj.get("added_mentions") != null && !jsonObj.get("added_mentions").isJsonNull()) { + WatchlistMeshAddedMentions.validateJsonElement(jsonObj.get("added_mentions")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WatchlistMeshRiskDetail.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WatchlistMeshRiskDetail' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WatchlistMeshRiskDetail.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WatchlistMeshRiskDetail 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 WatchlistMeshRiskDetail read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WatchlistMeshRiskDetail 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(Locale.ROOT, "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 WatchlistMeshRiskDetail given an JSON string + * + * @param jsonString JSON string + * @return An instance of WatchlistMeshRiskDetail + * @throws IOException if the JSON string is invalid with respect to WatchlistMeshRiskDetail + */ + public static WatchlistMeshRiskDetail fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WatchlistMeshRiskDetail.class); + } + + /** + * Convert an instance of WatchlistMeshRiskDetail to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/WatchlistMeshRiskIndicators.java b/src/main/java/com/onfido/model/WatchlistMeshRiskIndicators.java new file mode 100644 index 0000000..9f69c0b --- /dev/null +++ b/src/main/java/com/onfido/model/WatchlistMeshRiskIndicators.java @@ -0,0 +1,507 @@ +/* + * 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 java.util.Locale; +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.WatchlistMeshLists; +import com.onfido.model.WatchlistMeshMedia; +import com.onfido.model.WatchlistMeshPep; +import com.onfido.model.WatchlistMeshSanctions; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +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 java.util.Locale; + +import com.onfido.JSON; + +/** + * WatchlistMeshRiskIndicators + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0") +public class WatchlistMeshRiskIndicators { + public static final String SERIALIZED_NAME_AML_TYPES = "aml_types"; + @SerializedName(SERIALIZED_NAME_AML_TYPES) + @javax.annotation.Nullable + private List amlTypes; + + public static final String SERIALIZED_NAME_LISTS = "lists"; + @SerializedName(SERIALIZED_NAME_LISTS) + @javax.annotation.Nullable + private List lists; + + public static final String SERIALIZED_NAME_MEDIA = "media"; + @SerializedName(SERIALIZED_NAME_MEDIA) + @javax.annotation.Nullable + private List media; + + public static final String SERIALIZED_NAME_PEPS = "peps"; + @SerializedName(SERIALIZED_NAME_PEPS) + @javax.annotation.Nullable + private List peps; + + public static final String SERIALIZED_NAME_SANCTIONS = "sanctions"; + @SerializedName(SERIALIZED_NAME_SANCTIONS) + @javax.annotation.Nullable + private List sanctions; + + public WatchlistMeshRiskIndicators() { + } + + public WatchlistMeshRiskIndicators amlTypes(@javax.annotation.Nullable List amlTypes) { + this.amlTypes = amlTypes; + return this; + } + + public WatchlistMeshRiskIndicators addAmlTypesItem(String amlTypesItem) { + if (this.amlTypes == null) { + this.amlTypes = new ArrayList<>(); + } + this.amlTypes.add(amlTypesItem); + return this; + } + + /** + * Get amlTypes + * @return amlTypes + */ + @javax.annotation.Nullable + public List getAmlTypes() { + return amlTypes; + } + + public void setAmlTypes(@javax.annotation.Nullable List amlTypes) { + this.amlTypes = amlTypes; + } + + + public WatchlistMeshRiskIndicators lists(@javax.annotation.Nullable List lists) { + this.lists = lists; + return this; + } + + public WatchlistMeshRiskIndicators addListsItem(WatchlistMeshLists listsItem) { + if (this.lists == null) { + this.lists = new ArrayList<>(); + } + this.lists.add(listsItem); + return this; + } + + /** + * Get lists + * @return lists + */ + @javax.annotation.Nullable + public List getLists() { + return lists; + } + + public void setLists(@javax.annotation.Nullable List lists) { + this.lists = lists; + } + + + public WatchlistMeshRiskIndicators media(@javax.annotation.Nullable List media) { + this.media = media; + return this; + } + + public WatchlistMeshRiskIndicators addMediaItem(WatchlistMeshMedia mediaItem) { + if (this.media == null) { + this.media = new ArrayList<>(); + } + this.media.add(mediaItem); + return this; + } + + /** + * Get media + * @return media + */ + @javax.annotation.Nullable + public List getMedia() { + return media; + } + + public void setMedia(@javax.annotation.Nullable List media) { + this.media = media; + } + + + public WatchlistMeshRiskIndicators peps(@javax.annotation.Nullable List peps) { + this.peps = peps; + return this; + } + + public WatchlistMeshRiskIndicators addPepsItem(WatchlistMeshPep pepsItem) { + if (this.peps == null) { + this.peps = new ArrayList<>(); + } + this.peps.add(pepsItem); + return this; + } + + /** + * Get peps + * @return peps + */ + @javax.annotation.Nullable + public List getPeps() { + return peps; + } + + public void setPeps(@javax.annotation.Nullable List peps) { + this.peps = peps; + } + + + public WatchlistMeshRiskIndicators sanctions(@javax.annotation.Nullable List sanctions) { + this.sanctions = sanctions; + return this; + } + + public WatchlistMeshRiskIndicators addSanctionsItem(WatchlistMeshSanctions sanctionsItem) { + if (this.sanctions == null) { + this.sanctions = new ArrayList<>(); + } + this.sanctions.add(sanctionsItem); + return this; + } + + /** + * Get sanctions + * @return sanctions + */ + @javax.annotation.Nullable + public List getSanctions() { + return sanctions; + } + + public void setSanctions(@javax.annotation.Nullable List sanctions) { + this.sanctions = sanctions; + } + + /** + * 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 WatchlistMeshRiskIndicators instance itself + */ + public WatchlistMeshRiskIndicators 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; + } + WatchlistMeshRiskIndicators watchlistMeshRiskIndicators = (WatchlistMeshRiskIndicators) o; + return Objects.equals(this.amlTypes, watchlistMeshRiskIndicators.amlTypes) && + Objects.equals(this.lists, watchlistMeshRiskIndicators.lists) && + Objects.equals(this.media, watchlistMeshRiskIndicators.media) && + Objects.equals(this.peps, watchlistMeshRiskIndicators.peps) && + Objects.equals(this.sanctions, watchlistMeshRiskIndicators.sanctions)&& + Objects.equals(this.additionalProperties, watchlistMeshRiskIndicators.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(amlTypes, lists, media, peps, sanctions, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WatchlistMeshRiskIndicators {\n"); + sb.append(" amlTypes: ").append(toIndentedString(amlTypes)).append("\n"); + sb.append(" lists: ").append(toIndentedString(lists)).append("\n"); + sb.append(" media: ").append(toIndentedString(media)).append("\n"); + sb.append(" peps: ").append(toIndentedString(peps)).append("\n"); + sb.append(" sanctions: ").append(toIndentedString(sanctions)).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(Arrays.asList("aml_types", "lists", "media", "peps", "sanctions")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 WatchlistMeshRiskIndicators + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WatchlistMeshRiskIndicators.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in WatchlistMeshRiskIndicators is not found in the empty JSON string", WatchlistMeshRiskIndicators.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("aml_types") != null && !jsonObj.get("aml_types").isJsonNull() && !jsonObj.get("aml_types").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `aml_types` to be an array in the JSON string but got `%s`", jsonObj.get("aml_types").toString())); + } + if (jsonObj.get("lists") != null && !jsonObj.get("lists").isJsonNull()) { + JsonArray jsonArraylists = jsonObj.getAsJsonArray("lists"); + if (jsonArraylists != null) { + // ensure the json data is an array + if (!jsonObj.get("lists").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `lists` to be an array in the JSON string but got `%s`", jsonObj.get("lists").toString())); + } + + // validate the optional field `lists` (array) + for (int i = 0; i < jsonArraylists.size(); i++) { + WatchlistMeshLists.validateJsonElement(jsonArraylists.get(i)); + }; + } + } + if (jsonObj.get("media") != null && !jsonObj.get("media").isJsonNull()) { + JsonArray jsonArraymedia = jsonObj.getAsJsonArray("media"); + if (jsonArraymedia != null) { + // ensure the json data is an array + if (!jsonObj.get("media").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `media` to be an array in the JSON string but got `%s`", jsonObj.get("media").toString())); + } + + // validate the optional field `media` (array) + for (int i = 0; i < jsonArraymedia.size(); i++) { + WatchlistMeshMedia.validateJsonElement(jsonArraymedia.get(i)); + }; + } + } + if (jsonObj.get("peps") != null && !jsonObj.get("peps").isJsonNull()) { + JsonArray jsonArraypeps = jsonObj.getAsJsonArray("peps"); + if (jsonArraypeps != null) { + // ensure the json data is an array + if (!jsonObj.get("peps").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `peps` to be an array in the JSON string but got `%s`", jsonObj.get("peps").toString())); + } + + // validate the optional field `peps` (array) + for (int i = 0; i < jsonArraypeps.size(); i++) { + WatchlistMeshPep.validateJsonElement(jsonArraypeps.get(i)); + }; + } + } + if (jsonObj.get("sanctions") != null && !jsonObj.get("sanctions").isJsonNull()) { + JsonArray jsonArraysanctions = jsonObj.getAsJsonArray("sanctions"); + if (jsonArraysanctions != null) { + // ensure the json data is an array + if (!jsonObj.get("sanctions").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `sanctions` to be an array in the JSON string but got `%s`", jsonObj.get("sanctions").toString())); + } + + // validate the optional field `sanctions` (array) + for (int i = 0; i < jsonArraysanctions.size(); i++) { + WatchlistMeshSanctions.validateJsonElement(jsonArraysanctions.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WatchlistMeshRiskIndicators.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WatchlistMeshRiskIndicators' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WatchlistMeshRiskIndicators.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WatchlistMeshRiskIndicators 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 WatchlistMeshRiskIndicators read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WatchlistMeshRiskIndicators 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(Locale.ROOT, "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 WatchlistMeshRiskIndicators given an JSON string + * + * @param jsonString JSON string + * @return An instance of WatchlistMeshRiskIndicators + * @throws IOException if the JSON string is invalid with respect to WatchlistMeshRiskIndicators + */ + public static WatchlistMeshRiskIndicators fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WatchlistMeshRiskIndicators.class); + } + + /** + * Convert an instance of WatchlistMeshRiskIndicators to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onfido/model/WatchlistMeshSanctions.java b/src/main/java/com/onfido/model/WatchlistMeshSanctions.java new file mode 100644 index 0000000..6bc1881 --- /dev/null +++ b/src/main/java/com/onfido/model/WatchlistMeshSanctions.java @@ -0,0 +1,581 @@ +/* + * 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 java.util.Locale; +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.WatchlistMeshField; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +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 java.util.Locale; + +import com.onfido.JSON; + +/** + * WatchlistMeshSanctions + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0") +public class WatchlistMeshSanctions { + public static final String SERIALIZED_NAME_AML_TYPES = "aml_types"; + @SerializedName(SERIALIZED_NAME_AML_TYPES) + @javax.annotation.Nullable + private List amlTypes; + + public static final String SERIALIZED_NAME_COUNTRY_CODES = "country_codes"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODES) + @javax.annotation.Nullable + private List countryCodes; + + public static final String SERIALIZED_NAME_FIELDS = "fields"; + @SerializedName(SERIALIZED_NAME_FIELDS) + @javax.annotation.Nullable + private List fields; + + public static final String SERIALIZED_NAME_IDENTIFIER = "identifier"; + @SerializedName(SERIALIZED_NAME_IDENTIFIER) + @javax.annotation.Nullable + private String identifier; + + public static final String SERIALIZED_NAME_LISTING_ENDED_UTC = "listing_ended_utc"; + @SerializedName(SERIALIZED_NAME_LISTING_ENDED_UTC) + @javax.annotation.Nullable + private String listingEndedUtc; + + public static final String SERIALIZED_NAME_LISTING_STARTED_UTC = "listing_started_utc"; + @SerializedName(SERIALIZED_NAME_LISTING_STARTED_UTC) + @javax.annotation.Nullable + private String listingStartedUtc; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_RELATED_URLS = "related_urls"; + @SerializedName(SERIALIZED_NAME_RELATED_URLS) + @javax.annotation.Nullable + private List relatedUrls; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nullable + private String url; + + public WatchlistMeshSanctions() { + } + + public WatchlistMeshSanctions amlTypes(@javax.annotation.Nullable List amlTypes) { + this.amlTypes = amlTypes; + return this; + } + + public WatchlistMeshSanctions addAmlTypesItem(String amlTypesItem) { + if (this.amlTypes == null) { + this.amlTypes = new ArrayList<>(); + } + this.amlTypes.add(amlTypesItem); + return this; + } + + /** + * Get amlTypes + * @return amlTypes + */ + @javax.annotation.Nullable + public List getAmlTypes() { + return amlTypes; + } + + public void setAmlTypes(@javax.annotation.Nullable List amlTypes) { + this.amlTypes = amlTypes; + } + + + public WatchlistMeshSanctions countryCodes(@javax.annotation.Nullable List countryCodes) { + this.countryCodes = countryCodes; + return this; + } + + public WatchlistMeshSanctions addCountryCodesItem(String countryCodesItem) { + if (this.countryCodes == null) { + this.countryCodes = new ArrayList<>(); + } + this.countryCodes.add(countryCodesItem); + return this; + } + + /** + * Get countryCodes + * @return countryCodes + */ + @javax.annotation.Nullable + public List getCountryCodes() { + return countryCodes; + } + + public void setCountryCodes(@javax.annotation.Nullable List countryCodes) { + this.countryCodes = countryCodes; + } + + + public WatchlistMeshSanctions fields(@javax.annotation.Nullable List fields) { + this.fields = fields; + return this; + } + + public WatchlistMeshSanctions addFieldsItem(WatchlistMeshField fieldsItem) { + if (this.fields == null) { + this.fields = new ArrayList<>(); + } + this.fields.add(fieldsItem); + return this; + } + + /** + * Get fields + * @return fields + */ + @javax.annotation.Nullable + public List getFields() { + return fields; + } + + public void setFields(@javax.annotation.Nullable List fields) { + this.fields = fields; + } + + + public WatchlistMeshSanctions identifier(@javax.annotation.Nullable String identifier) { + this.identifier = identifier; + return this; + } + + /** + * Get identifier + * @return identifier + */ + @javax.annotation.Nullable + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(@javax.annotation.Nullable String identifier) { + this.identifier = identifier; + } + + + public WatchlistMeshSanctions listingEndedUtc(@javax.annotation.Nullable String listingEndedUtc) { + this.listingEndedUtc = listingEndedUtc; + return this; + } + + /** + * Get listingEndedUtc + * @return listingEndedUtc + */ + @javax.annotation.Nullable + public String getListingEndedUtc() { + return listingEndedUtc; + } + + public void setListingEndedUtc(@javax.annotation.Nullable String listingEndedUtc) { + this.listingEndedUtc = listingEndedUtc; + } + + + public WatchlistMeshSanctions listingStartedUtc(@javax.annotation.Nullable String listingStartedUtc) { + this.listingStartedUtc = listingStartedUtc; + return this; + } + + /** + * Get listingStartedUtc + * @return listingStartedUtc + */ + @javax.annotation.Nullable + public String getListingStartedUtc() { + return listingStartedUtc; + } + + public void setListingStartedUtc(@javax.annotation.Nullable String listingStartedUtc) { + this.listingStartedUtc = listingStartedUtc; + } + + + public WatchlistMeshSanctions name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public WatchlistMeshSanctions relatedUrls(@javax.annotation.Nullable List relatedUrls) { + this.relatedUrls = relatedUrls; + return this; + } + + public WatchlistMeshSanctions addRelatedUrlsItem(String relatedUrlsItem) { + if (this.relatedUrls == null) { + this.relatedUrls = new ArrayList<>(); + } + this.relatedUrls.add(relatedUrlsItem); + return this; + } + + /** + * Get relatedUrls + * @return relatedUrls + */ + @javax.annotation.Nullable + public List getRelatedUrls() { + return relatedUrls; + } + + public void setRelatedUrls(@javax.annotation.Nullable List relatedUrls) { + this.relatedUrls = relatedUrls; + } + + + public WatchlistMeshSanctions url(@javax.annotation.Nullable String url) { + this.url = url; + return this; + } + + /** + * Get url + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nullable String url) { + this.url = url; + } + + /** + * 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 WatchlistMeshSanctions instance itself + */ + public WatchlistMeshSanctions 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; + } + WatchlistMeshSanctions watchlistMeshSanctions = (WatchlistMeshSanctions) o; + return Objects.equals(this.amlTypes, watchlistMeshSanctions.amlTypes) && + Objects.equals(this.countryCodes, watchlistMeshSanctions.countryCodes) && + Objects.equals(this.fields, watchlistMeshSanctions.fields) && + Objects.equals(this.identifier, watchlistMeshSanctions.identifier) && + Objects.equals(this.listingEndedUtc, watchlistMeshSanctions.listingEndedUtc) && + Objects.equals(this.listingStartedUtc, watchlistMeshSanctions.listingStartedUtc) && + Objects.equals(this.name, watchlistMeshSanctions.name) && + Objects.equals(this.relatedUrls, watchlistMeshSanctions.relatedUrls) && + Objects.equals(this.url, watchlistMeshSanctions.url)&& + Objects.equals(this.additionalProperties, watchlistMeshSanctions.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(amlTypes, countryCodes, fields, identifier, listingEndedUtc, listingStartedUtc, name, relatedUrls, url, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WatchlistMeshSanctions {\n"); + sb.append(" amlTypes: ").append(toIndentedString(amlTypes)).append("\n"); + sb.append(" countryCodes: ").append(toIndentedString(countryCodes)).append("\n"); + sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); + sb.append(" identifier: ").append(toIndentedString(identifier)).append("\n"); + sb.append(" listingEndedUtc: ").append(toIndentedString(listingEndedUtc)).append("\n"); + sb.append(" listingStartedUtc: ").append(toIndentedString(listingStartedUtc)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" relatedUrls: ").append(toIndentedString(relatedUrls)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).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(Arrays.asList("aml_types", "country_codes", "fields", "identifier", "listing_ended_utc", "listing_started_utc", "name", "related_urls", "url")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 WatchlistMeshSanctions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WatchlistMeshSanctions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in WatchlistMeshSanctions is not found in the empty JSON string", WatchlistMeshSanctions.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("aml_types") != null && !jsonObj.get("aml_types").isJsonNull() && !jsonObj.get("aml_types").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `aml_types` to be an array in the JSON string but got `%s`", jsonObj.get("aml_types").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("country_codes") != null && !jsonObj.get("country_codes").isJsonNull() && !jsonObj.get("country_codes").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `country_codes` to be an array in the JSON string but got `%s`", jsonObj.get("country_codes").toString())); + } + if (jsonObj.get("fields") != null && !jsonObj.get("fields").isJsonNull()) { + JsonArray jsonArrayfields = jsonObj.getAsJsonArray("fields"); + if (jsonArrayfields != null) { + // ensure the json data is an array + if (!jsonObj.get("fields").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `fields` to be an array in the JSON string but got `%s`", jsonObj.get("fields").toString())); + } + + // validate the optional field `fields` (array) + for (int i = 0; i < jsonArrayfields.size(); i++) { + WatchlistMeshField.validateJsonElement(jsonArrayfields.get(i)); + }; + } + } + if ((jsonObj.get("identifier") != null && !jsonObj.get("identifier").isJsonNull()) && !jsonObj.get("identifier").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `identifier` to be a primitive type in the JSON string but got `%s`", jsonObj.get("identifier").toString())); + } + if ((jsonObj.get("listing_ended_utc") != null && !jsonObj.get("listing_ended_utc").isJsonNull()) && !jsonObj.get("listing_ended_utc").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `listing_ended_utc` to be a primitive type in the JSON string but got `%s`", jsonObj.get("listing_ended_utc").toString())); + } + if ((jsonObj.get("listing_started_utc") != null && !jsonObj.get("listing_started_utc").isJsonNull()) && !jsonObj.get("listing_started_utc").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `listing_started_utc` to be a primitive type in the JSON string but got `%s`", jsonObj.get("listing_started_utc").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("related_urls") != null && !jsonObj.get("related_urls").isJsonNull() && !jsonObj.get("related_urls").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `related_urls` to be an array in the JSON string but got `%s`", jsonObj.get("related_urls").toString())); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WatchlistMeshSanctions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WatchlistMeshSanctions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WatchlistMeshSanctions.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WatchlistMeshSanctions 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 WatchlistMeshSanctions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WatchlistMeshSanctions 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(Locale.ROOT, "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 WatchlistMeshSanctions given an JSON string + * + * @param jsonString JSON string + * @return An instance of WatchlistMeshSanctions + * @throws IOException if the JSON string is invalid with respect to WatchlistMeshSanctions + */ + public static WatchlistMeshSanctions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WatchlistMeshSanctions.class); + } + + /** + * Convert an instance of WatchlistMeshSanctions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +