diff --git a/client/.openapi-generator/FILES b/client/.openapi-generator/FILES index 8facdc4..25acae2 100755 --- a/client/.openapi-generator/FILES +++ b/client/.openapi-generator/FILES @@ -52,6 +52,7 @@ src/main/generated/com/regula/documentreader/webclient/model/CrossSourceValueCom src/main/generated/com/regula/documentreader/webclient/model/DataModule.java src/main/generated/com/regula/documentreader/webclient/model/DatabaseDocument.java src/main/generated/com/regula/documentreader/webclient/model/DatabaseDocumentList.java +src/main/generated/com/regula/documentreader/webclient/model/DetailsAge.java src/main/generated/com/regula/documentreader/webclient/model/DetailsOptical.java src/main/generated/com/regula/documentreader/webclient/model/DetailsRFID.java src/main/generated/com/regula/documentreader/webclient/model/DeviceInfo.java @@ -59,6 +60,7 @@ src/main/generated/com/regula/documentreader/webclient/model/DeviceInfoDocuments src/main/generated/com/regula/documentreader/webclient/model/DocBarCodeInfo.java src/main/generated/com/regula/documentreader/webclient/model/DocBarCodeInfoFieldsList.java src/main/generated/com/regula/documentreader/webclient/model/DocBarCodeInfoItem.java +src/main/generated/com/regula/documentreader/webclient/model/DocFeature.java src/main/generated/com/regula/documentreader/webclient/model/DocGraphicsInfoItem.java src/main/generated/com/regula/documentreader/webclient/model/DocVisualExtendedField.java src/main/generated/com/regula/documentreader/webclient/model/DocVisualExtendedFieldItem.java @@ -131,6 +133,9 @@ src/main/generated/com/regula/documentreader/webclient/model/ListVerifiedFields. src/main/generated/com/regula/documentreader/webclient/model/ListVerifiedFieldsItem.java src/main/generated/com/regula/documentreader/webclient/model/LivenessParams.java src/main/generated/com/regula/documentreader/webclient/model/LogLevel.java +src/main/generated/com/regula/documentreader/webclient/model/MDLDeviceEngagement.java +src/main/generated/com/regula/documentreader/webclient/model/MDLDeviceRetrieval.java +src/main/generated/com/regula/documentreader/webclient/model/MDLServerRetrieval.java src/main/generated/com/regula/documentreader/webclient/model/MRZDetectorResult.java src/main/generated/com/regula/documentreader/webclient/model/MRZFormat.java src/main/generated/com/regula/documentreader/webclient/model/MRZPositionResult.java @@ -139,6 +144,7 @@ src/main/generated/com/regula/documentreader/webclient/model/MRZTestQuality.java src/main/generated/com/regula/documentreader/webclient/model/MRZTestQualityItem.java src/main/generated/com/regula/documentreader/webclient/model/MRZTestQualityResult.java src/main/generated/com/regula/documentreader/webclient/model/MeasureSystem.java +src/main/generated/com/regula/documentreader/webclient/model/Message.java src/main/generated/com/regula/documentreader/webclient/model/MrzDetectModeEnum.java src/main/generated/com/regula/documentreader/webclient/model/MrzPositionItem.java src/main/generated/com/regula/documentreader/webclient/model/OCRSecurityTextItem.java @@ -149,6 +155,7 @@ src/main/generated/com/regula/documentreader/webclient/model/OriginalSymbol.java src/main/generated/com/regula/documentreader/webclient/model/OutData.java src/main/generated/com/regula/documentreader/webclient/model/OutDataTransactionImagesFieldValue.java src/main/generated/com/regula/documentreader/webclient/model/PArrayField.java +src/main/generated/com/regula/documentreader/webclient/model/PID.java src/main/generated/com/regula/documentreader/webclient/model/ParsedData.java src/main/generated/com/regula/documentreader/webclient/model/ParsingErrorCodes.java src/main/generated/com/regula/documentreader/webclient/model/ParsingNotificationCodes.java @@ -246,6 +253,14 @@ src/main/generated/com/regula/documentreader/webclient/model/TransactionProcessR src/main/generated/com/regula/documentreader/webclient/model/TransactionProcessResult.java src/main/generated/com/regula/documentreader/webclient/model/TrfFtBytes.java src/main/generated/com/regula/documentreader/webclient/model/TrfFtString.java +src/main/generated/com/regula/documentreader/webclient/model/VDItem.java +src/main/generated/com/regula/documentreader/webclient/model/VDSData.java +src/main/generated/com/regula/documentreader/webclient/model/VDSDataItem.java +src/main/generated/com/regula/documentreader/webclient/model/VDSDataResult.java +src/main/generated/com/regula/documentreader/webclient/model/VDSNCData.java +src/main/generated/com/regula/documentreader/webclient/model/VDSNCDataItem.java +src/main/generated/com/regula/documentreader/webclient/model/VDSNCDataResult.java +src/main/generated/com/regula/documentreader/webclient/model/VEItem.java src/main/generated/com/regula/documentreader/webclient/model/VerificationResult.java src/main/generated/com/regula/documentreader/webclient/model/VerifiedFieldMap.java src/main/generated/com/regula/documentreader/webclient/model/Visibility.java diff --git a/client/src/main/generated/com/regula/documentreader/webclient/JSON.java b/client/src/main/generated/com/regula/documentreader/webclient/JSON.java index 09f5253..02dd7b3 100755 --- a/client/src/main/generated/com/regula/documentreader/webclient/JSON.java +++ b/client/src/main/generated/com/regula/documentreader/webclient/JSON.java @@ -331,6 +331,10 @@ public static GsonBuilder createGson() { com.regula.documentreader.webclient.model.RFIDGraphicsInfoResult.class); classByDiscriminatorValue.put( "109", com.regula.documentreader.webclient.model.ByteArrayResult.class); + classByDiscriminatorValue.put( + "124", com.regula.documentreader.webclient.model.VDSNCDataResult.class); + classByDiscriminatorValue.put( + "125", com.regula.documentreader.webclient.model.VDSDataResult.class); classByDiscriminatorValue.put( "15", com.regula.documentreader.webclient.model.LexicalAnalysisResult.class); @@ -762,6 +766,10 @@ public static GsonBuilder createGson() { com.regula.documentreader.webclient.model.RFIDGraphicsInfoResult.class); classByDiscriminatorValue.put( "109", com.regula.documentreader.webclient.model.ByteArrayResult.class); + classByDiscriminatorValue.put( + "124", com.regula.documentreader.webclient.model.VDSNCDataResult.class); + classByDiscriminatorValue.put( + "125", com.regula.documentreader.webclient.model.VDSDataResult.class); classByDiscriminatorValue.put( "15", com.regula.documentreader.webclient.model.LexicalAnalysisResult.class); @@ -892,6 +900,36 @@ public static GsonBuilder createGson() { classByDiscriminatorValue, getDiscriminatorValue(readElement, "result_type")); } + }) + .registerTypeSelector( + com.regula.documentreader.webclient.model.VDSDataResult.class, + new TypeSelector() { + @Override + public Class + getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put( + "VDSDataResult", + com.regula.documentreader.webclient.model.VDSDataResult.class); + return getClassByDiscriminator( + classByDiscriminatorValue, + getDiscriminatorValue(readElement, "result_type")); + } + }) + .registerTypeSelector( + com.regula.documentreader.webclient.model.VDSNCDataResult.class, + new TypeSelector() { + @Override + public Class + getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put( + "VDSNCDataResult", + com.regula.documentreader.webclient.model.VDSNCDataResult.class); + return getClassByDiscriminator( + classByDiscriminatorValue, + getDiscriminatorValue(readElement, "result_type")); + } }); GsonBuilder builder = fireBuilder.createGsonBuilder(); return builder; @@ -995,6 +1033,8 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.regula.documentreader.webclient.model.DatabaseDocumentList .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.regula.documentreader.webclient.model.DetailsAge.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.regula.documentreader.webclient.model.DetailsOptical.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( @@ -1012,6 +1052,8 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.regula.documentreader.webclient.model.DocBarCodeInfoItem .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.regula.documentreader.webclient.model.DocFeature.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.regula.documentreader.webclient.model.DocGraphicsInfoItem .CustomTypeAdapterFactory()); @@ -1176,6 +1218,8 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new com.regula.documentreader.webclient.model.MRZTestQualityResult .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.regula.documentreader.webclient.model.Message.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.regula.documentreader.webclient.model.MrzPositionItem.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( @@ -1197,6 +1241,8 @@ private static Class getClassByDiscriminator( .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.regula.documentreader.webclient.model.PArrayField.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.regula.documentreader.webclient.model.PID.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.regula.documentreader.webclient.model.ParsedData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( @@ -1371,6 +1417,22 @@ private static Class getClassByDiscriminator( new com.regula.documentreader.webclient.model.TrfFtBytes.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.regula.documentreader.webclient.model.TrfFtString.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.regula.documentreader.webclient.model.VDItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.regula.documentreader.webclient.model.VDSData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.regula.documentreader.webclient.model.VDSDataItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.regula.documentreader.webclient.model.VDSDataResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.regula.documentreader.webclient.model.VDSNCData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.regula.documentreader.webclient.model.VDSNCDataItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.regula.documentreader.webclient.model.VDSNCDataResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new com.regula.documentreader.webclient.model.VEItem.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new com.regula.documentreader.webclient.model.VerifiedFieldMap.CustomTypeAdapterFactory()); gson = gsonBuilder.create(); diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/ContainerListListInner.java b/client/src/main/generated/com/regula/documentreader/webclient/model/ContainerListListInner.java index 6a534d9..5fe9008 100644 --- a/client/src/main/generated/com/regula/documentreader/webclient/model/ContainerListListInner.java +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/ContainerListListInner.java @@ -89,6 +89,10 @@ public TypeAdapter create(Gson gson, TypeToken type) { gson.getDelegateAdapter(this, TypeToken.get(RFIDGraphicsInfoResult.class)); final TypeAdapter adapterRFIDTextDataResult = gson.getDelegateAdapter(this, TypeToken.get(RFIDTextDataResult.class)); + final TypeAdapter adapterVDSNCDataResult = + gson.getDelegateAdapter(this, TypeToken.get(VDSNCDataResult.class)); + final TypeAdapter adapterVDSDataResult = + gson.getDelegateAdapter(this, TypeToken.get(VDSDataResult.class)); return (TypeAdapter) new TypeAdapter() { @@ -283,8 +287,22 @@ public void write(JsonWriter out, ContainerListListInner value) throws IOExcepti elementAdapter.write(out, element); return; } + // check if the actual instance is of the type `VDSNCDataResult` + if (value.getActualInstance() instanceof VDSNCDataResult) { + JsonElement element = + adapterVDSNCDataResult.toJsonTree((VDSNCDataResult) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `VDSDataResult` + if (value.getActualInstance() instanceof VDSDataResult) { + JsonElement element = + adapterVDSDataResult.toJsonTree((VDSDataResult) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } throw new IOException( - "Failed to serialize as the type doesn't match oneOf schemas: AuthenticityResult, BarcodePositionResult, ByteArrayResult, ChosenDocumentTypeResult, DocBarCodeInfo, DocumentBinaryInfoResult, DocumentImageResult, DocumentPositionResult, DocumentTypesCandidatesResult, EncryptedRCLResult, FaceDetectionResult, GraphicsResult, ImageQualityResult, ImagesResult, LexicalAnalysisResult, LicenseResult, MRZDetectorResult, MRZPositionResult, MRZTestQualityResult, RFIDGraphicsInfoResult, RFIDTextDataResult, StatusResult, TextDataResult, TextResult"); + "Failed to serialize as the type doesn't match oneOf schemas: AuthenticityResult, BarcodePositionResult, ByteArrayResult, ChosenDocumentTypeResult, DocBarCodeInfo, DocumentBinaryInfoResult, DocumentImageResult, DocumentPositionResult, DocumentTypesCandidatesResult, EncryptedRCLResult, FaceDetectionResult, GraphicsResult, ImageQualityResult, ImagesResult, LexicalAnalysisResult, LicenseResult, MRZDetectorResult, MRZPositionResult, MRZTestQualityResult, RFIDGraphicsInfoResult, RFIDTextDataResult, StatusResult, TextDataResult, TextResult, VDSDataResult, VDSNCDataResult"); } @Override @@ -653,6 +671,34 @@ public ContainerListListInner read(JsonReader in) throws IOException { e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'RFIDTextDataResult'", e); } + // deserialize VDSNCDataResult + try { + // validate the JSON object to see if any exception is thrown + VDSNCDataResult.validateJsonElement(jsonElement); + actualAdapter = adapterVDSNCDataResult; + match++; + log.log(Level.FINER, "Input data matches schema 'VDSNCDataResult'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for VDSNCDataResult failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'VDSNCDataResult'", e); + } + // deserialize VDSDataResult + try { + // validate the JSON object to see if any exception is thrown + VDSDataResult.validateJsonElement(jsonElement); + actualAdapter = adapterVDSDataResult; + match++; + log.log(Level.FINER, "Input data matches schema 'VDSDataResult'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + "Deserialization for VDSDataResult failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'VDSDataResult'", e); + } if (match == 1) { ContainerListListInner ret = new ContainerListListInner(); @@ -706,6 +752,8 @@ public ContainerListListInner(Object o) { schemas.put("MRZTestQualityResult", MRZTestQualityResult.class); schemas.put("RFIDGraphicsInfoResult", RFIDGraphicsInfoResult.class); schemas.put("RFIDTextDataResult", RFIDTextDataResult.class); + schemas.put("VDSNCDataResult", VDSNCDataResult.class); + schemas.put("VDSDataResult", VDSDataResult.class); } @Override @@ -720,7 +768,7 @@ public Map> getSchemas() { * DocumentPositionResult, DocumentTypesCandidatesResult, EncryptedRCLResult, FaceDetectionResult, * GraphicsResult, ImageQualityResult, ImagesResult, LexicalAnalysisResult, LicenseResult, * MRZDetectorResult, MRZPositionResult, MRZTestQualityResult, RFIDGraphicsInfoResult, - * RFIDTextDataResult, StatusResult, TextDataResult, TextResult + * RFIDTextDataResult, StatusResult, TextDataResult, TextResult, VDSDataResult, VDSNCDataResult * *

It could be an instance of the 'oneOf' schemas. */ @@ -846,8 +894,18 @@ public void setActualInstance(Object instance) { return; } + if (instance instanceof VDSNCDataResult) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof VDSDataResult) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( - "Invalid instance type. Must be AuthenticityResult, BarcodePositionResult, ByteArrayResult, ChosenDocumentTypeResult, DocBarCodeInfo, DocumentBinaryInfoResult, DocumentImageResult, DocumentPositionResult, DocumentTypesCandidatesResult, EncryptedRCLResult, FaceDetectionResult, GraphicsResult, ImageQualityResult, ImagesResult, LexicalAnalysisResult, LicenseResult, MRZDetectorResult, MRZPositionResult, MRZTestQualityResult, RFIDGraphicsInfoResult, RFIDTextDataResult, StatusResult, TextDataResult, TextResult"); + "Invalid instance type. Must be AuthenticityResult, BarcodePositionResult, ByteArrayResult, ChosenDocumentTypeResult, DocBarCodeInfo, DocumentBinaryInfoResult, DocumentImageResult, DocumentPositionResult, DocumentTypesCandidatesResult, EncryptedRCLResult, FaceDetectionResult, GraphicsResult, ImageQualityResult, ImagesResult, LexicalAnalysisResult, LicenseResult, MRZDetectorResult, MRZPositionResult, MRZTestQualityResult, RFIDGraphicsInfoResult, RFIDTextDataResult, StatusResult, TextDataResult, TextResult, VDSDataResult, VDSNCDataResult"); } /** @@ -856,7 +914,8 @@ public void setActualInstance(Object instance) { * DocumentImageResult, DocumentPositionResult, DocumentTypesCandidatesResult, EncryptedRCLResult, * FaceDetectionResult, GraphicsResult, ImageQualityResult, ImagesResult, LexicalAnalysisResult, * LicenseResult, MRZDetectorResult, MRZPositionResult, MRZTestQualityResult, - * RFIDGraphicsInfoResult, RFIDTextDataResult, StatusResult, TextDataResult, TextResult + * RFIDGraphicsInfoResult, RFIDTextDataResult, StatusResult, TextDataResult, TextResult, + * VDSDataResult, VDSNCDataResult * * @return The actual instance (AuthenticityResult, BarcodePositionResult, ByteArrayResult, * ChosenDocumentTypeResult, DocBarCodeInfo, DocumentBinaryInfoResult, DocumentImageResult, @@ -864,7 +923,7 @@ public void setActualInstance(Object instance) { * FaceDetectionResult, GraphicsResult, ImageQualityResult, ImagesResult, * LexicalAnalysisResult, LicenseResult, MRZDetectorResult, MRZPositionResult, * MRZTestQualityResult, RFIDGraphicsInfoResult, RFIDTextDataResult, StatusResult, - * TextDataResult, TextResult) + * TextDataResult, TextResult, VDSDataResult, VDSNCDataResult) */ @SuppressWarnings("unchecked") @Override @@ -1137,6 +1196,28 @@ public RFIDTextDataResult getRFIDTextDataResult() throws ClassCastException { return (RFIDTextDataResult) super.getActualInstance(); } + /** + * Get the actual instance of `VDSNCDataResult`. If the actual instance is not `VDSNCDataResult`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `VDSNCDataResult` + * @throws ClassCastException if the instance is not `VDSNCDataResult` + */ + public VDSNCDataResult getVDSNCDataResult() throws ClassCastException { + return (VDSNCDataResult) super.getActualInstance(); + } + + /** + * Get the actual instance of `VDSDataResult`. If the actual instance is not `VDSDataResult`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `VDSDataResult` + * @throws ClassCastException if the instance is not `VDSDataResult` + */ + public VDSDataResult getVDSDataResult() throws ClassCastException { + return (VDSDataResult) super.getActualInstance(); + } + /** * Validates the JSON Element and throws an exception if issues found * @@ -1378,10 +1459,28 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti "Deserialization for RFIDTextDataResult failed with `%s`.", e.getMessage())); // continue to the next one } + // validate the json string with VDSNCDataResult + try { + VDSNCDataResult.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format("Deserialization for VDSNCDataResult failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with VDSDataResult + try { + VDSDataResult.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format("Deserialization for VDSDataResult failed with `%s`.", e.getMessage())); + // continue to the next one + } if (validCount != 1) { throw new IOException( String.format( - "The JSON string is invalid for ContainerListListInner with oneOf schemas: AuthenticityResult, BarcodePositionResult, ByteArrayResult, ChosenDocumentTypeResult, DocBarCodeInfo, DocumentBinaryInfoResult, DocumentImageResult, DocumentPositionResult, DocumentTypesCandidatesResult, EncryptedRCLResult, FaceDetectionResult, GraphicsResult, ImageQualityResult, ImagesResult, LexicalAnalysisResult, LicenseResult, MRZDetectorResult, MRZPositionResult, MRZTestQualityResult, RFIDGraphicsInfoResult, RFIDTextDataResult, StatusResult, TextDataResult, TextResult. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + "The JSON string is invalid for ContainerListListInner with oneOf schemas: AuthenticityResult, BarcodePositionResult, ByteArrayResult, ChosenDocumentTypeResult, DocBarCodeInfo, DocumentBinaryInfoResult, DocumentImageResult, DocumentPositionResult, DocumentTypesCandidatesResult, EncryptedRCLResult, FaceDetectionResult, GraphicsResult, ImageQualityResult, ImagesResult, LexicalAnalysisResult, LicenseResult, MRZDetectorResult, MRZPositionResult, MRZTestQualityResult, RFIDGraphicsInfoResult, RFIDTextDataResult, StatusResult, TextDataResult, TextResult, VDSDataResult, VDSNCDataResult. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); } } diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/DetailsAge.java b/client/src/main/generated/com/regula/documentreader/webclient/model/DetailsAge.java new file mode 100644 index 0000000..fed13dd --- /dev/null +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/DetailsAge.java @@ -0,0 +1,335 @@ +/* + * Regula Document Reader Web API + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 8.1.0 + * + * + * 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.regula.documentreader.webclient.model; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.regula.documentreader.webclient.JSON; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; + +/** DetailsAge */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.15.0") +public class DetailsAge { + public static final String SERIALIZED_NAME_THRESHOLD = "threshold"; + + @SerializedName(SERIALIZED_NAME_THRESHOLD) + @javax.annotation.Nonnull + private Integer threshold; + + public static final String SERIALIZED_NAME_OVER_THRESHOLD = "overThreshold"; + + @SerializedName(SERIALIZED_NAME_OVER_THRESHOLD) + @javax.annotation.Nonnull + private CheckResult overThreshold; + + public static final String SERIALIZED_NAME_OVER18 = "over18"; + + @SerializedName(SERIALIZED_NAME_OVER18) + @javax.annotation.Nonnull + private CheckResult over18; + + public static final String SERIALIZED_NAME_OVER21 = "over21"; + + @SerializedName(SERIALIZED_NAME_OVER21) + @javax.annotation.Nonnull + private CheckResult over21; + + public static final String SERIALIZED_NAME_OVER25 = "over25"; + + @SerializedName(SERIALIZED_NAME_OVER25) + @javax.annotation.Nonnull + private CheckResult over25; + + public static final String SERIALIZED_NAME_OVER65 = "over65"; + + @SerializedName(SERIALIZED_NAME_OVER65) + @javax.annotation.Nonnull + private CheckResult over65; + + public DetailsAge() {} + + public DetailsAge threshold(@javax.annotation.Nonnull Integer threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get threshold + * + * @return threshold + */ + @javax.annotation.Nonnull + public Integer getThreshold() { + return threshold; + } + + public void setThreshold(@javax.annotation.Nonnull Integer threshold) { + this.threshold = threshold; + } + + public DetailsAge overThreshold(@javax.annotation.Nonnull CheckResult overThreshold) { + this.overThreshold = overThreshold; + return this; + } + + /** + * Get overThreshold + * + * @return overThreshold + */ + @javax.annotation.Nonnull + public CheckResult getOverThreshold() { + return overThreshold; + } + + public void setOverThreshold(@javax.annotation.Nonnull CheckResult overThreshold) { + this.overThreshold = overThreshold; + } + + public DetailsAge over18(@javax.annotation.Nonnull CheckResult over18) { + this.over18 = over18; + return this; + } + + /** + * Get over18 + * + * @return over18 + */ + @javax.annotation.Nonnull + public CheckResult getOver18() { + return over18; + } + + public void setOver18(@javax.annotation.Nonnull CheckResult over18) { + this.over18 = over18; + } + + public DetailsAge over21(@javax.annotation.Nonnull CheckResult over21) { + this.over21 = over21; + return this; + } + + /** + * Get over21 + * + * @return over21 + */ + @javax.annotation.Nonnull + public CheckResult getOver21() { + return over21; + } + + public void setOver21(@javax.annotation.Nonnull CheckResult over21) { + this.over21 = over21; + } + + public DetailsAge over25(@javax.annotation.Nonnull CheckResult over25) { + this.over25 = over25; + return this; + } + + /** + * Get over25 + * + * @return over25 + */ + @javax.annotation.Nonnull + public CheckResult getOver25() { + return over25; + } + + public void setOver25(@javax.annotation.Nonnull CheckResult over25) { + this.over25 = over25; + } + + public DetailsAge over65(@javax.annotation.Nonnull CheckResult over65) { + this.over65 = over65; + return this; + } + + /** + * Get over65 + * + * @return over65 + */ + @javax.annotation.Nonnull + public CheckResult getOver65() { + return over65; + } + + public void setOver65(@javax.annotation.Nonnull CheckResult over65) { + this.over65 = over65; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DetailsAge detailsAge = (DetailsAge) o; + return Objects.equals(this.threshold, detailsAge.threshold) + && Objects.equals(this.overThreshold, detailsAge.overThreshold) + && Objects.equals(this.over18, detailsAge.over18) + && Objects.equals(this.over21, detailsAge.over21) + && Objects.equals(this.over25, detailsAge.over25) + && Objects.equals(this.over65, detailsAge.over65); + } + + @Override + public int hashCode() { + return Objects.hash(threshold, overThreshold, over18, over21, over25, over65); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DetailsAge {\n"); + sb.append(" threshold: ").append(toIndentedString(threshold)).append("\n"); + sb.append(" overThreshold: ").append(toIndentedString(overThreshold)).append("\n"); + sb.append(" over18: ").append(toIndentedString(over18)).append("\n"); + sb.append(" over21: ").append(toIndentedString(over21)).append("\n"); + sb.append(" over25: ").append(toIndentedString(over25)).append("\n"); + sb.append(" over65: ").append(toIndentedString(over65)).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("threshold", "overThreshold", "over18", "over21", "over25", "over65")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet( + Arrays.asList("threshold", "overThreshold", "over18", "over21", "over25", "over65")); + } + + /** + * 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 DetailsAge + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DetailsAge.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + System.err.println( + String.format( + "The required field(s) %s in DetailsAge is not found in the empty JSON string", + DetailsAge.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DetailsAge.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + System.err.println( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `overThreshold` + CheckResult.validateJsonElement(jsonObj.get("overThreshold")); + // validate the required field `over18` + CheckResult.validateJsonElement(jsonObj.get("over18")); + // validate the required field `over21` + CheckResult.validateJsonElement(jsonObj.get("over21")); + // validate the required field `over25` + CheckResult.validateJsonElement(jsonObj.get("over25")); + // validate the required field `over65` + CheckResult.validateJsonElement(jsonObj.get("over65")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DetailsAge.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DetailsAge' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DetailsAge.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DetailsAge value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DetailsAge read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DetailsAge given an JSON string + * + * @param jsonString JSON string + * @return An instance of DetailsAge + * @throws IOException if the JSON string is invalid with respect to DetailsAge + */ + public static DetailsAge fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DetailsAge.class); + } + + /** + * Convert an instance of DetailsAge to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/DocFeature.java b/client/src/main/generated/com/regula/documentreader/webclient/model/DocFeature.java new file mode 100644 index 0000000..524356d --- /dev/null +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/DocFeature.java @@ -0,0 +1,215 @@ +/* + * Regula Document Reader Web API + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 8.1.0 + * + * + * 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.regula.documentreader.webclient.model; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.regula.documentreader.webclient.JSON; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; + +/** DocFeature */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.15.0") +public class DocFeature { + public static final String SERIALIZED_NAME_TYPE = "Type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private BigDecimal type; + + public static final String SERIALIZED_NAME_DATA = "Data"; + + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private TrfFtBytes data; + + public DocFeature() {} + + public DocFeature type(@javax.annotation.Nonnull BigDecimal type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @javax.annotation.Nonnull + public BigDecimal getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull BigDecimal type) { + this.type = type; + } + + public DocFeature data(@javax.annotation.Nonnull TrfFtBytes data) { + this.data = data; + return this; + } + + /** + * Get data + * + * @return data + */ + @javax.annotation.Nonnull + public TrfFtBytes getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull TrfFtBytes data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DocFeature docFeature = (DocFeature) o; + return Objects.equals(this.type, docFeature.type) && Objects.equals(this.data, docFeature.data); + } + + @Override + public int hashCode() { + return Objects.hash(type, data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DocFeature {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).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("Type", "Data")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("Type", "Data")); + } + + /** + * 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 DocFeature + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DocFeature.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + System.err.println( + String.format( + "The required field(s) %s in DocFeature is not found in the empty JSON string", + DocFeature.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DocFeature.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + System.err.println( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `Data` + TrfFtBytes.validateJsonElement(jsonObj.get("Data")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DocFeature.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DocFeature' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DocFeature.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DocFeature value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DocFeature read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of DocFeature given an JSON string + * + * @param jsonString JSON string + * @return An instance of DocFeature + * @throws IOException if the JSON string is invalid with respect to DocFeature + */ + public static DocFeature fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DocFeature.class); + } + + /** + * Convert an instance of DocFeature to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/MDLDeviceEngagement.java b/client/src/main/generated/com/regula/documentreader/webclient/model/MDLDeviceEngagement.java new file mode 100644 index 0000000..7a0f550 --- /dev/null +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/MDLDeviceEngagement.java @@ -0,0 +1,71 @@ +/* + * Regula Document Reader Web API + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 8.1.0 + * + * + * 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.regula.documentreader.webclient.model; + +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +/** Gets or Sets MDLDeviceEngagement */ +@JsonAdapter(MDLDeviceEngagement.Adapter.class) +public enum MDLDeviceEngagement { + QR(0), + + NFC(1); + + private Integer value; + + MDLDeviceEngagement(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static MDLDeviceEngagement fromValue(Integer value) { + for (MDLDeviceEngagement b : MDLDeviceEngagement.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final MDLDeviceEngagement enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MDLDeviceEngagement read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return MDLDeviceEngagement.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + MDLDeviceEngagement.fromValue(value); + } +} diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/MDLDeviceRetrieval.java b/client/src/main/generated/com/regula/documentreader/webclient/model/MDLDeviceRetrieval.java new file mode 100644 index 0000000..f4969f6 --- /dev/null +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/MDLDeviceRetrieval.java @@ -0,0 +1,73 @@ +/* + * Regula Document Reader Web API + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 8.1.0 + * + * + * 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.regula.documentreader.webclient.model; + +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +/** Gets or Sets MDLDeviceRetrieval */ +@JsonAdapter(MDLDeviceRetrieval.Adapter.class) +public enum MDLDeviceRetrieval { + NFC(1), + + BLE(2), + + WIFI_AWARE(3); + + private Integer value; + + MDLDeviceRetrieval(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static MDLDeviceRetrieval fromValue(Integer value) { + for (MDLDeviceRetrieval b : MDLDeviceRetrieval.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final MDLDeviceRetrieval enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MDLDeviceRetrieval read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return MDLDeviceRetrieval.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + MDLDeviceRetrieval.fromValue(value); + } +} diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/MDLServerRetrieval.java b/client/src/main/generated/com/regula/documentreader/webclient/model/MDLServerRetrieval.java new file mode 100644 index 0000000..8118695 --- /dev/null +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/MDLServerRetrieval.java @@ -0,0 +1,71 @@ +/* + * Regula Document Reader Web API + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 8.1.0 + * + * + * 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.regula.documentreader.webclient.model; + +import com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +/** Gets or Sets MDLServerRetrieval */ +@JsonAdapter(MDLServerRetrieval.Adapter.class) +public enum MDLServerRetrieval { + WEB_API(0), + + OIDC(1); + + private Integer value; + + MDLServerRetrieval(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static MDLServerRetrieval fromValue(Integer value) { + for (MDLServerRetrieval b : MDLServerRetrieval.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final MDLServerRetrieval enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MDLServerRetrieval read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return MDLServerRetrieval.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + MDLServerRetrieval.fromValue(value); + } +} diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/Message.java b/client/src/main/generated/com/regula/documentreader/webclient/model/Message.java new file mode 100644 index 0000000..fa96622 --- /dev/null +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/Message.java @@ -0,0 +1,271 @@ +/* + * Regula Document Reader Web API + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 8.1.0 + * + * + * 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.regula.documentreader.webclient.model; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.regula.documentreader.webclient.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; + +/** Message */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.15.0") +public class Message { + public static final String SERIALIZED_NAME_PID = "pid"; + + @SerializedName(SERIALIZED_NAME_PID) + @javax.annotation.Nullable + private PID pid; + + public static final String SERIALIZED_NAME_UVCI = "uvci"; + + @SerializedName(SERIALIZED_NAME_UVCI) + @javax.annotation.Nullable + private String uvci; + + public static final String SERIALIZED_NAME_VE = "ve"; + + @SerializedName(SERIALIZED_NAME_VE) + @javax.annotation.Nullable + private List ve; + + public Message() {} + + public Message pid(@javax.annotation.Nullable PID pid) { + this.pid = pid; + return this; + } + + /** + * Get pid + * + * @return pid + */ + @javax.annotation.Nullable + public PID getPid() { + return pid; + } + + public void setPid(@javax.annotation.Nullable PID pid) { + this.pid = pid; + } + + public Message uvci(@javax.annotation.Nullable String uvci) { + this.uvci = uvci; + return this; + } + + /** + * Get uvci + * + * @return uvci + */ + @javax.annotation.Nullable + public String getUvci() { + return uvci; + } + + public void setUvci(@javax.annotation.Nullable String uvci) { + this.uvci = uvci; + } + + public Message ve(@javax.annotation.Nullable List ve) { + this.ve = ve; + return this; + } + + public Message addVeItem(VEItem veItem) { + if (this.ve == null) { + this.ve = new ArrayList<>(); + } + this.ve.add(veItem); + return this; + } + + /** + * Get ve + * + * @return ve + */ + @javax.annotation.Nullable + public List getVe() { + return ve; + } + + public void setVe(@javax.annotation.Nullable List ve) { + this.ve = ve; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Message message = (Message) o; + return Objects.equals(this.pid, message.pid) + && Objects.equals(this.uvci, message.uvci) + && Objects.equals(this.ve, message.ve); + } + + @Override + public int hashCode() { + return Objects.hash(pid, uvci, ve); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Message {\n"); + sb.append(" pid: ").append(toIndentedString(pid)).append("\n"); + sb.append(" uvci: ").append(toIndentedString(uvci)).append("\n"); + sb.append(" ve: ").append(toIndentedString(ve)).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("pid", "uvci", "ve")); + + // 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 Message + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Message.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + System.err.println( + String.format( + "The required field(s) %s in Message is not found in the empty JSON string", + Message.openapiRequiredFields.toString())); + } + } + + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `pid` + if (jsonObj.get("pid") != null && !jsonObj.get("pid").isJsonNull()) { + PID.validateJsonElement(jsonObj.get("pid")); + } + if ((jsonObj.get("uvci") != null && !jsonObj.get("uvci").isJsonNull()) + && !jsonObj.get("uvci").isJsonPrimitive()) { + System.err.println( + String.format( + "Expected the field `uvci` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("uvci").toString())); + } + if (jsonObj.get("ve") != null && !jsonObj.get("ve").isJsonNull()) { + JsonArray jsonArrayve = jsonObj.getAsJsonArray("ve"); + if (jsonArrayve != null) { + // ensure the json data is an array + if (!jsonObj.get("ve").isJsonArray()) { + System.err.println( + String.format( + "Expected the field `ve` to be an array in the JSON string but got `%s`", + jsonObj.get("ve").toString())); + } + + // validate the optional field `ve` (array) + for (int i = 0; i < jsonArrayve.size(); i++) { + VEItem.validateJsonElement(jsonArrayve.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Message.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Message' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Message.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Message value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Message read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of Message given an JSON string + * + * @param jsonString JSON string + * @return An instance of Message + * @throws IOException if the JSON string is invalid with respect to Message + */ + public static Message fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Message.class); + } + + /** + * Convert an instance of Message to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/PID.java b/client/src/main/generated/com/regula/documentreader/webclient/model/PID.java new file mode 100644 index 0000000..85c4df9 --- /dev/null +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/PID.java @@ -0,0 +1,284 @@ +/* + * Regula Document Reader Web API + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 8.1.0 + * + * + * 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.regula.documentreader.webclient.model; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.regula.documentreader.webclient.JSON; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; + +/** PID */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.15.0") +public class PID { + public static final String SERIALIZED_NAME_DOB = "dob"; + + @SerializedName(SERIALIZED_NAME_DOB) + @javax.annotation.Nullable + private String dob; + + public static final String SERIALIZED_NAME_I = "i"; + + @SerializedName(SERIALIZED_NAME_I) + @javax.annotation.Nullable + private String i; + + public static final String SERIALIZED_NAME_N = "n"; + + @SerializedName(SERIALIZED_NAME_N) + @javax.annotation.Nullable + private String n; + + public static final String SERIALIZED_NAME_SEX = "sex"; + + @SerializedName(SERIALIZED_NAME_SEX) + @javax.annotation.Nullable + private String sex; + + public PID() {} + + public PID dob(@javax.annotation.Nullable String dob) { + this.dob = dob; + return this; + } + + /** + * Get dob + * + * @return dob + */ + @javax.annotation.Nullable + public String getDob() { + return dob; + } + + public void setDob(@javax.annotation.Nullable String dob) { + this.dob = dob; + } + + public PID i(@javax.annotation.Nullable String i) { + this.i = i; + return this; + } + + /** + * Get i + * + * @return i + */ + @javax.annotation.Nullable + public String getI() { + return i; + } + + public void setI(@javax.annotation.Nullable String i) { + this.i = i; + } + + public PID n(@javax.annotation.Nullable String n) { + this.n = n; + return this; + } + + /** + * Get n + * + * @return n + */ + @javax.annotation.Nullable + public String getN() { + return n; + } + + public void setN(@javax.annotation.Nullable String n) { + this.n = n; + } + + public PID sex(@javax.annotation.Nullable String sex) { + this.sex = sex; + return this; + } + + /** + * Get sex + * + * @return sex + */ + @javax.annotation.Nullable + public String getSex() { + return sex; + } + + public void setSex(@javax.annotation.Nullable String sex) { + this.sex = sex; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PID PID = (PID) o; + return Objects.equals(this.dob, PID.dob) + && Objects.equals(this.i, PID.i) + && Objects.equals(this.n, PID.n) + && Objects.equals(this.sex, PID.sex); + } + + @Override + public int hashCode() { + return Objects.hash(dob, i, n, sex); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PID {\n"); + sb.append(" dob: ").append(toIndentedString(dob)).append("\n"); + sb.append(" i: ").append(toIndentedString(i)).append("\n"); + sb.append(" n: ").append(toIndentedString(n)).append("\n"); + sb.append(" sex: ").append(toIndentedString(sex)).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("dob", "i", "n", "sex")); + + // 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 PID + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PID.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + System.err.println( + String.format( + "The required field(s) %s in PID is not found in the empty JSON string", + PID.openapiRequiredFields.toString())); + } + } + + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("dob") != null && !jsonObj.get("dob").isJsonNull()) + && !jsonObj.get("dob").isJsonPrimitive()) { + System.err.println( + String.format( + "Expected the field `dob` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("dob").toString())); + } + if ((jsonObj.get("i") != null && !jsonObj.get("i").isJsonNull()) + && !jsonObj.get("i").isJsonPrimitive()) { + System.err.println( + String.format( + "Expected the field `i` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("i").toString())); + } + if ((jsonObj.get("n") != null && !jsonObj.get("n").isJsonNull()) + && !jsonObj.get("n").isJsonPrimitive()) { + System.err.println( + String.format( + "Expected the field `n` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("n").toString())); + } + if ((jsonObj.get("sex") != null && !jsonObj.get("sex").isJsonNull()) + && !jsonObj.get("sex").isJsonPrimitive()) { + System.err.println( + String.format( + "Expected the field `sex` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("sex").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PID.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PID' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PID.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PID value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PID read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of PID given an JSON string + * + * @param jsonString JSON string + * @return An instance of PID + * @throws IOException if the JSON string is invalid with respect to PID + */ + public static PID fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PID.class); + } + + /** + * Convert an instance of PID to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/Result.java b/client/src/main/generated/com/regula/documentreader/webclient/model/Result.java index 16b33ef..24130b5 100644 --- a/client/src/main/generated/com/regula/documentreader/webclient/model/Result.java +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/Result.java @@ -140,7 +140,25 @@ public enum Result { RFID_ORIGINAL_GRAPHICS(105), /** Digital Travel Credential data */ - DTC_VC(109); + DTC_VC(109), + + /** Contains mDL device raw response */ + MDL_DEVICE_RAW_RESPONSE(120), + + /** Contains mDL device parsed response */ + MDL_DEVICE_PARSED_RESPONSE(121), + + /** Contains mDL server raw response */ + MDL_SERVER_RAW_RESPONSE(122), + + /** Contains mDL server parsed response */ + MDL_SERVER_PARSED_RESPONSE(123), + + /** Contains result of VDS NC */ + VDS_NC(124), + + /** Contains result of VDS */ + VDS(125); private Integer value; diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/ResultItem.java b/client/src/main/generated/com/regula/documentreader/webclient/model/ResultItem.java index 79eae12..d0b67b6 100644 --- a/client/src/main/generated/com/regula/documentreader/webclient/model/ResultItem.java +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/ResultItem.java @@ -249,6 +249,12 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti case "109": ByteArrayResult.validateJsonElement(jsonElement); break; + case "124": + VDSNCDataResult.validateJsonElement(jsonElement); + break; + case "125": + VDSDataResult.validateJsonElement(jsonElement); + break; case "15": LexicalAnalysisResult.validateJsonElement(jsonElement); break; diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/Status.java b/client/src/main/generated/com/regula/documentreader/webclient/model/Status.java index 51cff0a..ce89425 100644 --- a/client/src/main/generated/com/regula/documentreader/webclient/model/Status.java +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/Status.java @@ -74,6 +74,24 @@ public class Status { @javax.annotation.Nonnull private DetailsOptical detailsOptical; + public static final String SERIALIZED_NAME_AGE = "age"; + + @SerializedName(SERIALIZED_NAME_AGE) + @javax.annotation.Nonnull + private CheckResult age; + + public static final String SERIALIZED_NAME_DETAILS_AGE = "detailsAge"; + + @SerializedName(SERIALIZED_NAME_DETAILS_AGE) + @javax.annotation.Nonnull + private DetailsAge detailsAge; + + public static final String SERIALIZED_NAME_M_D_L = "mDL"; + + @SerializedName(SERIALIZED_NAME_M_D_L) + @javax.annotation.Nonnull + private CheckResult mDL; + public Status() {} public Status overallStatus(@javax.annotation.Nonnull CheckResult overallStatus) { @@ -209,6 +227,63 @@ public void setDetailsOptical(@javax.annotation.Nonnull DetailsOptical detailsOp this.detailsOptical = detailsOptical; } + public Status age(@javax.annotation.Nonnull CheckResult age) { + this.age = age; + return this; + } + + /** + * Get age + * + * @return age + */ + @javax.annotation.Nonnull + public CheckResult getAge() { + return age; + } + + public void setAge(@javax.annotation.Nonnull CheckResult age) { + this.age = age; + } + + public Status detailsAge(@javax.annotation.Nonnull DetailsAge detailsAge) { + this.detailsAge = detailsAge; + return this; + } + + /** + * Get detailsAge + * + * @return detailsAge + */ + @javax.annotation.Nonnull + public DetailsAge getDetailsAge() { + return detailsAge; + } + + public void setDetailsAge(@javax.annotation.Nonnull DetailsAge detailsAge) { + this.detailsAge = detailsAge; + } + + public Status mDL(@javax.annotation.Nonnull CheckResult mDL) { + this.mDL = mDL; + return this; + } + + /** + * Get mDL + * + * @return mDL + */ + @javax.annotation.Nonnull + public CheckResult getmDL() { + return mDL; + } + + public void setmDL(@javax.annotation.Nonnull CheckResult mDL) { + this.mDL = mDL; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -224,13 +299,25 @@ public boolean equals(Object o) { && Objects.equals(this.rfid, status.rfid) && Objects.equals(this.stopList, status.stopList) && Objects.equals(this.detailsRFID, status.detailsRFID) - && Objects.equals(this.detailsOptical, status.detailsOptical); + && Objects.equals(this.detailsOptical, status.detailsOptical) + && Objects.equals(this.age, status.age) + && Objects.equals(this.detailsAge, status.detailsAge) + && Objects.equals(this.mDL, status.mDL); } @Override public int hashCode() { return Objects.hash( - overallStatus, optical, portrait, rfid, stopList, detailsRFID, detailsOptical); + overallStatus, + optical, + portrait, + rfid, + stopList, + detailsRFID, + detailsOptical, + age, + detailsAge, + mDL); } @Override @@ -244,6 +331,9 @@ public String toString() { sb.append(" stopList: ").append(toIndentedString(stopList)).append("\n"); sb.append(" detailsRFID: ").append(toIndentedString(detailsRFID)).append("\n"); sb.append(" detailsOptical: ").append(toIndentedString(detailsOptical)).append("\n"); + sb.append(" age: ").append(toIndentedString(age)).append("\n"); + sb.append(" detailsAge: ").append(toIndentedString(detailsAge)).append("\n"); + sb.append(" mDL: ").append(toIndentedString(mDL)).append("\n"); sb.append("}"); return sb.toString(); } @@ -272,13 +362,24 @@ private String toIndentedString(Object o) { "rfid", "stopList", "detailsRFID", - "detailsOptical")); + "detailsOptical", + "age", + "detailsAge", + "mDL")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet( Arrays.asList( - "overallStatus", "optical", "portrait", "rfid", "stopList", "detailsOptical")); + "overallStatus", + "optical", + "portrait", + "rfid", + "stopList", + "detailsOptical", + "age", + "detailsAge", + "mDL")); } /** @@ -323,6 +424,12 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } // validate the required field `detailsOptical` DetailsOptical.validateJsonElement(jsonObj.get("detailsOptical")); + // validate the required field `age` + CheckResult.validateJsonElement(jsonObj.get("age")); + // validate the required field `detailsAge` + DetailsAge.validateJsonElement(jsonObj.get("detailsAge")); + // validate the required field `mDL` + CheckResult.validateJsonElement(jsonObj.get("mDL")); } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/TextFieldType.java b/client/src/main/generated/com/regula/documentreader/webclient/model/TextFieldType.java index 5a51de0..f949f3c 100644 --- a/client/src/main/generated/com/regula/documentreader/webclient/model/TextFieldType.java +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/TextFieldType.java @@ -1968,7 +1968,16 @@ public enum TextFieldType { FT_FIRST_ISSUE_DATE_CHECK_DIGIT(698), /** First issue date checksum */ - FT_FIRST_ISSUE_DATE_CHECKSUM(699); + FT_FIRST_ISSUE_DATE_CHECKSUM(699), + + /** Commercial indicator */ + FT_COMMERCIAL_INDICATOR(701), + + /** Non domiciled indicator */ + FT_NON_DOMICILED_INDICATOR(702), + + /** Jurisdiction specific data */ + FT_JURISDICTION_SPECIFIC_DATA(703); private Integer value; diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/TrfFtString.java b/client/src/main/generated/com/regula/documentreader/webclient/model/TrfFtString.java index 8a5e813..53b4a34 100644 --- a/client/src/main/generated/com/regula/documentreader/webclient/model/TrfFtString.java +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/TrfFtString.java @@ -56,7 +56,7 @@ public class TrfFtString { public static final String SERIALIZED_NAME_DATA = "Data"; @SerializedName(SERIALIZED_NAME_DATA) - @javax.annotation.Nonnull + @javax.annotation.Nullable private String data; public TrfFtString() {} @@ -119,7 +119,7 @@ public void setFormat(@javax.annotation.Nullable String format) { this.format = format; } - public TrfFtString data(@javax.annotation.Nonnull String data) { + public TrfFtString data(@javax.annotation.Nullable String data) { this.data = data; return this; } @@ -129,12 +129,12 @@ public TrfFtString data(@javax.annotation.Nonnull String data) { * * @return data */ - @javax.annotation.Nonnull + @javax.annotation.Nullable public String getData() { return data; } - public void setData(@javax.annotation.Nonnull String data) { + public void setData(@javax.annotation.Nullable String data) { this.data = data; } @@ -188,7 +188,7 @@ private String toIndentedString(Object o) { openapiFields = new HashSet(Arrays.asList("Type", "Status", "Format", "Data")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("Data")); + openapiRequiredFields = new HashSet(0); } /** @@ -208,15 +208,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : TrfFtString.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - System.err.println( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("Format") != null && !jsonObj.get("Format").isJsonNull()) && !jsonObj.get("Format").isJsonPrimitive()) { @@ -225,7 +216,8 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti "Expected the field `Format` to be a primitive type in the JSON string but got `%s`", jsonObj.get("Format").toString())); } - if (!jsonObj.get("Data").isJsonPrimitive()) { + if ((jsonObj.get("Data") != null && !jsonObj.get("Data").isJsonNull()) + && !jsonObj.get("Data").isJsonPrimitive()) { System.err.println( String.format( "Expected the field `Data` to be a primitive type in the JSON string but got `%s`", diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/VDItem.java b/client/src/main/generated/com/regula/documentreader/webclient/model/VDItem.java new file mode 100644 index 0000000..bb561fc --- /dev/null +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/VDItem.java @@ -0,0 +1,312 @@ +/* + * Regula Document Reader Web API + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 8.1.0 + * + * + * 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.regula.documentreader.webclient.model; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.regula.documentreader.webclient.JSON; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; + +/** VDItem */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.15.0") +public class VDItem { + public static final String SERIALIZED_NAME_ADM = "adm"; + + @SerializedName(SERIALIZED_NAME_ADM) + @javax.annotation.Nullable + private String adm; + + public static final String SERIALIZED_NAME_CTR = "ctr"; + + @SerializedName(SERIALIZED_NAME_CTR) + @javax.annotation.Nullable + private String ctr; + + public static final String SERIALIZED_NAME_DVC = "dvc"; + + @SerializedName(SERIALIZED_NAME_DVC) + @javax.annotation.Nullable + private String dvc; + + public static final String SERIALIZED_NAME_LOT = "lot"; + + @SerializedName(SERIALIZED_NAME_LOT) + @javax.annotation.Nullable + private String lot; + + public static final String SERIALIZED_NAME_SEQ = "seq"; + + @SerializedName(SERIALIZED_NAME_SEQ) + @javax.annotation.Nullable + private Integer seq; + + public VDItem() {} + + public VDItem adm(@javax.annotation.Nullable String adm) { + this.adm = adm; + return this; + } + + /** + * Get adm + * + * @return adm + */ + @javax.annotation.Nullable + public String getAdm() { + return adm; + } + + public void setAdm(@javax.annotation.Nullable String adm) { + this.adm = adm; + } + + public VDItem ctr(@javax.annotation.Nullable String ctr) { + this.ctr = ctr; + return this; + } + + /** + * Get ctr + * + * @return ctr + */ + @javax.annotation.Nullable + public String getCtr() { + return ctr; + } + + public void setCtr(@javax.annotation.Nullable String ctr) { + this.ctr = ctr; + } + + public VDItem dvc(@javax.annotation.Nullable String dvc) { + this.dvc = dvc; + return this; + } + + /** + * Get dvc + * + * @return dvc + */ + @javax.annotation.Nullable + public String getDvc() { + return dvc; + } + + public void setDvc(@javax.annotation.Nullable String dvc) { + this.dvc = dvc; + } + + public VDItem lot(@javax.annotation.Nullable String lot) { + this.lot = lot; + return this; + } + + /** + * Get lot + * + * @return lot + */ + @javax.annotation.Nullable + public String getLot() { + return lot; + } + + public void setLot(@javax.annotation.Nullable String lot) { + this.lot = lot; + } + + public VDItem seq(@javax.annotation.Nullable Integer seq) { + this.seq = seq; + return this; + } + + /** + * Get seq + * + * @return seq + */ + @javax.annotation.Nullable + public Integer getSeq() { + return seq; + } + + public void setSeq(@javax.annotation.Nullable Integer seq) { + this.seq = seq; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VDItem vdItem = (VDItem) o; + return Objects.equals(this.adm, vdItem.adm) + && Objects.equals(this.ctr, vdItem.ctr) + && Objects.equals(this.dvc, vdItem.dvc) + && Objects.equals(this.lot, vdItem.lot) + && Objects.equals(this.seq, vdItem.seq); + } + + @Override + public int hashCode() { + return Objects.hash(adm, ctr, dvc, lot, seq); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VDItem {\n"); + sb.append(" adm: ").append(toIndentedString(adm)).append("\n"); + sb.append(" ctr: ").append(toIndentedString(ctr)).append("\n"); + sb.append(" dvc: ").append(toIndentedString(dvc)).append("\n"); + sb.append(" lot: ").append(toIndentedString(lot)).append("\n"); + sb.append(" seq: ").append(toIndentedString(seq)).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("adm", "ctr", "dvc", "lot", "seq")); + + // 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 VDItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VDItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + System.err.println( + String.format( + "The required field(s) %s in VDItem is not found in the empty JSON string", + VDItem.openapiRequiredFields.toString())); + } + } + + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("adm") != null && !jsonObj.get("adm").isJsonNull()) + && !jsonObj.get("adm").isJsonPrimitive()) { + System.err.println( + String.format( + "Expected the field `adm` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("adm").toString())); + } + if ((jsonObj.get("ctr") != null && !jsonObj.get("ctr").isJsonNull()) + && !jsonObj.get("ctr").isJsonPrimitive()) { + System.err.println( + String.format( + "Expected the field `ctr` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ctr").toString())); + } + if ((jsonObj.get("dvc") != null && !jsonObj.get("dvc").isJsonNull()) + && !jsonObj.get("dvc").isJsonPrimitive()) { + System.err.println( + String.format( + "Expected the field `dvc` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("dvc").toString())); + } + if ((jsonObj.get("lot") != null && !jsonObj.get("lot").isJsonNull()) + && !jsonObj.get("lot").isJsonPrimitive()) { + System.err.println( + String.format( + "Expected the field `lot` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("lot").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VDItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VDItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VDItem.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VDItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VDItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VDItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of VDItem + * @throws IOException if the JSON string is invalid with respect to VDItem + */ + public static VDItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VDItem.class); + } + + /** + * Convert an instance of VDItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/VDSData.java b/client/src/main/generated/com/regula/documentreader/webclient/model/VDSData.java new file mode 100644 index 0000000..9be5a28 --- /dev/null +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/VDSData.java @@ -0,0 +1,642 @@ +/* + * Regula Document Reader Web API + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 8.1.0 + * + * + * 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.regula.documentreader.webclient.model; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.regula.documentreader.webclient.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; + +/** VDSData */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.15.0") +public class VDSData { + public static final String SERIALIZED_NAME_CERTIFICATE = "Certificate"; + + @SerializedName(SERIALIZED_NAME_CERTIFICATE) + @javax.annotation.Nullable + private String certificate; + + public static final String SERIALIZED_NAME_CERTIFICATE_CHAIN = "CertificateChain"; + + @SerializedName(SERIALIZED_NAME_CERTIFICATE_CHAIN) + @javax.annotation.Nullable + private List certificateChain; + + public static final String SERIALIZED_NAME_DOC_FEATURES = "DocFeatures"; + + @SerializedName(SERIALIZED_NAME_DOC_FEATURES) + @javax.annotation.Nullable + private List docFeatures; + + public static final String SERIALIZED_NAME_DOC_ISSUE_DATE = "DocIssueDate"; + + @SerializedName(SERIALIZED_NAME_DOC_ISSUE_DATE) + @javax.annotation.Nullable + private String docIssueDate; + + public static final String SERIALIZED_NAME_DOC_TYPE = "DocType"; + + @SerializedName(SERIALIZED_NAME_DOC_TYPE) + @javax.annotation.Nullable + private Integer docType; + + public static final String SERIALIZED_NAME_FEATURE_REF = "FeatureRef"; + + @SerializedName(SERIALIZED_NAME_FEATURE_REF) + @javax.annotation.Nullable + private Integer featureRef; + + public static final String SERIALIZED_NAME_ISSUING_COUNTRY = "IssuingCountry"; + + @SerializedName(SERIALIZED_NAME_ISSUING_COUNTRY) + @javax.annotation.Nullable + private String issuingCountry; + + public static final String SERIALIZED_NAME_NOTIFICATIONS = "Notifications"; + + @SerializedName(SERIALIZED_NAME_NOTIFICATIONS) + @javax.annotation.Nullable + private List notifications; + + public static final String SERIALIZED_NAME_SIGNATURE = "Signature"; + + @SerializedName(SERIALIZED_NAME_SIGNATURE) + @javax.annotation.Nullable + private TrfFtBytes signature; + + public static final String SERIALIZED_NAME_SIGNATURE_DATE = "SignatureDate"; + + @SerializedName(SERIALIZED_NAME_SIGNATURE_DATE) + @javax.annotation.Nullable + private String signatureDate; + + public static final String SERIALIZED_NAME_SIGNER = "Signer"; + + @SerializedName(SERIALIZED_NAME_SIGNER) + @javax.annotation.Nullable + private String signer; + + public static final String SERIALIZED_NAME_TYPE = "Type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private Integer type; + + public static final String SERIALIZED_NAME_VERSION = "Version"; + + @SerializedName(SERIALIZED_NAME_VERSION) + @javax.annotation.Nullable + private Integer version; + + public VDSData() {} + + public VDSData certificate(@javax.annotation.Nullable String certificate) { + this.certificate = certificate; + return this; + } + + /** + * Get certificate + * + * @return certificate + */ + @javax.annotation.Nullable + public String getCertificate() { + return certificate; + } + + public void setCertificate(@javax.annotation.Nullable String certificate) { + this.certificate = certificate; + } + + public VDSData certificateChain( + @javax.annotation.Nullable List certificateChain) { + this.certificateChain = certificateChain; + return this; + } + + public VDSData addCertificateChainItem(RfidCertificateEx certificateChainItem) { + if (this.certificateChain == null) { + this.certificateChain = new ArrayList<>(); + } + this.certificateChain.add(certificateChainItem); + return this; + } + + /** + * Get certificateChain + * + * @return certificateChain + */ + @javax.annotation.Nullable + public List getCertificateChain() { + return certificateChain; + } + + public void setCertificateChain( + @javax.annotation.Nullable List certificateChain) { + this.certificateChain = certificateChain; + } + + public VDSData docFeatures(@javax.annotation.Nullable List docFeatures) { + this.docFeatures = docFeatures; + return this; + } + + public VDSData addDocFeaturesItem(DocFeature docFeaturesItem) { + if (this.docFeatures == null) { + this.docFeatures = new ArrayList<>(); + } + this.docFeatures.add(docFeaturesItem); + return this; + } + + /** + * Get docFeatures + * + * @return docFeatures + */ + @javax.annotation.Nullable + public List getDocFeatures() { + return docFeatures; + } + + public void setDocFeatures(@javax.annotation.Nullable List docFeatures) { + this.docFeatures = docFeatures; + } + + public VDSData docIssueDate(@javax.annotation.Nullable String docIssueDate) { + this.docIssueDate = docIssueDate; + return this; + } + + /** + * Get docIssueDate + * + * @return docIssueDate + */ + @javax.annotation.Nullable + public String getDocIssueDate() { + return docIssueDate; + } + + public void setDocIssueDate(@javax.annotation.Nullable String docIssueDate) { + this.docIssueDate = docIssueDate; + } + + public VDSData docType(@javax.annotation.Nullable Integer docType) { + this.docType = docType; + return this; + } + + /** + * Get docType + * + * @return docType + */ + @javax.annotation.Nullable + public Integer getDocType() { + return docType; + } + + public void setDocType(@javax.annotation.Nullable Integer docType) { + this.docType = docType; + } + + public VDSData featureRef(@javax.annotation.Nullable Integer featureRef) { + this.featureRef = featureRef; + return this; + } + + /** + * Get featureRef + * + * @return featureRef + */ + @javax.annotation.Nullable + public Integer getFeatureRef() { + return featureRef; + } + + public void setFeatureRef(@javax.annotation.Nullable Integer featureRef) { + this.featureRef = featureRef; + } + + public VDSData issuingCountry(@javax.annotation.Nullable String issuingCountry) { + this.issuingCountry = issuingCountry; + return this; + } + + /** + * Get issuingCountry + * + * @return issuingCountry + */ + @javax.annotation.Nullable + public String getIssuingCountry() { + return issuingCountry; + } + + public void setIssuingCountry(@javax.annotation.Nullable String issuingCountry) { + this.issuingCountry = issuingCountry; + } + + public VDSData notifications(@javax.annotation.Nullable List notifications) { + this.notifications = notifications; + return this; + } + + public VDSData addNotificationsItem(Integer notificationsItem) { + if (this.notifications == null) { + this.notifications = new ArrayList<>(); + } + this.notifications.add(notificationsItem); + return this; + } + + /** + * Get notifications + * + * @return notifications + */ + @javax.annotation.Nullable + public List getNotifications() { + return notifications; + } + + public void setNotifications(@javax.annotation.Nullable List notifications) { + this.notifications = notifications; + } + + public VDSData signature(@javax.annotation.Nullable TrfFtBytes signature) { + this.signature = signature; + return this; + } + + /** + * Get signature + * + * @return signature + */ + @javax.annotation.Nullable + public TrfFtBytes getSignature() { + return signature; + } + + public void setSignature(@javax.annotation.Nullable TrfFtBytes signature) { + this.signature = signature; + } + + public VDSData signatureDate(@javax.annotation.Nullable String signatureDate) { + this.signatureDate = signatureDate; + return this; + } + + /** + * Get signatureDate + * + * @return signatureDate + */ + @javax.annotation.Nullable + public String getSignatureDate() { + return signatureDate; + } + + public void setSignatureDate(@javax.annotation.Nullable String signatureDate) { + this.signatureDate = signatureDate; + } + + public VDSData signer(@javax.annotation.Nullable String signer) { + this.signer = signer; + return this; + } + + /** + * Get signer + * + * @return signer + */ + @javax.annotation.Nullable + public String getSigner() { + return signer; + } + + public void setSigner(@javax.annotation.Nullable String signer) { + this.signer = signer; + } + + public VDSData type(@javax.annotation.Nullable Integer type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @javax.annotation.Nullable + public Integer getType() { + return type; + } + + public void setType(@javax.annotation.Nullable Integer type) { + this.type = type; + } + + public VDSData version(@javax.annotation.Nullable Integer version) { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version + */ + @javax.annotation.Nullable + public Integer getVersion() { + return version; + } + + public void setVersion(@javax.annotation.Nullable Integer version) { + this.version = version; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VDSData vdSData = (VDSData) o; + return Objects.equals(this.certificate, vdSData.certificate) + && Objects.equals(this.certificateChain, vdSData.certificateChain) + && Objects.equals(this.docFeatures, vdSData.docFeatures) + && Objects.equals(this.docIssueDate, vdSData.docIssueDate) + && Objects.equals(this.docType, vdSData.docType) + && Objects.equals(this.featureRef, vdSData.featureRef) + && Objects.equals(this.issuingCountry, vdSData.issuingCountry) + && Objects.equals(this.notifications, vdSData.notifications) + && Objects.equals(this.signature, vdSData.signature) + && Objects.equals(this.signatureDate, vdSData.signatureDate) + && Objects.equals(this.signer, vdSData.signer) + && Objects.equals(this.type, vdSData.type) + && Objects.equals(this.version, vdSData.version); + } + + @Override + public int hashCode() { + return Objects.hash( + certificate, + certificateChain, + docFeatures, + docIssueDate, + docType, + featureRef, + issuingCountry, + notifications, + signature, + signatureDate, + signer, + type, + version); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VDSData {\n"); + sb.append(" certificate: ").append(toIndentedString(certificate)).append("\n"); + sb.append(" certificateChain: ").append(toIndentedString(certificateChain)).append("\n"); + sb.append(" docFeatures: ").append(toIndentedString(docFeatures)).append("\n"); + sb.append(" docIssueDate: ").append(toIndentedString(docIssueDate)).append("\n"); + sb.append(" docType: ").append(toIndentedString(docType)).append("\n"); + sb.append(" featureRef: ").append(toIndentedString(featureRef)).append("\n"); + sb.append(" issuingCountry: ").append(toIndentedString(issuingCountry)).append("\n"); + sb.append(" notifications: ").append(toIndentedString(notifications)).append("\n"); + sb.append(" signature: ").append(toIndentedString(signature)).append("\n"); + sb.append(" signatureDate: ").append(toIndentedString(signatureDate)).append("\n"); + sb.append(" signer: ").append(toIndentedString(signer)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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( + "Certificate", + "CertificateChain", + "DocFeatures", + "DocIssueDate", + "DocType", + "FeatureRef", + "IssuingCountry", + "Notifications", + "Signature", + "SignatureDate", + "Signer", + "Type", + "Version")); + + // 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 VDSData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VDSData.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + System.err.println( + String.format( + "The required field(s) %s in VDSData is not found in the empty JSON string", + VDSData.openapiRequiredFields.toString())); + } + } + + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("Certificate") != null && !jsonObj.get("Certificate").isJsonNull()) + && !jsonObj.get("Certificate").isJsonPrimitive()) { + System.err.println( + String.format( + "Expected the field `Certificate` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("Certificate").toString())); + } + if (jsonObj.get("CertificateChain") != null && !jsonObj.get("CertificateChain").isJsonNull()) { + JsonArray jsonArraycertificateChain = jsonObj.getAsJsonArray("CertificateChain"); + if (jsonArraycertificateChain != null) { + // ensure the json data is an array + if (!jsonObj.get("CertificateChain").isJsonArray()) { + System.err.println( + String.format( + "Expected the field `CertificateChain` to be an array in the JSON string but got `%s`", + jsonObj.get("CertificateChain").toString())); + } + + // validate the optional field `CertificateChain` (array) + for (int i = 0; i < jsonArraycertificateChain.size(); i++) { + RfidCertificateEx.validateJsonElement(jsonArraycertificateChain.get(i)); + } + ; + } + } + if (jsonObj.get("DocFeatures") != null && !jsonObj.get("DocFeatures").isJsonNull()) { + JsonArray jsonArraydocFeatures = jsonObj.getAsJsonArray("DocFeatures"); + if (jsonArraydocFeatures != null) { + // ensure the json data is an array + if (!jsonObj.get("DocFeatures").isJsonArray()) { + System.err.println( + String.format( + "Expected the field `DocFeatures` to be an array in the JSON string but got `%s`", + jsonObj.get("DocFeatures").toString())); + } + + // validate the optional field `DocFeatures` (array) + for (int i = 0; i < jsonArraydocFeatures.size(); i++) { + DocFeature.validateJsonElement(jsonArraydocFeatures.get(i)); + } + ; + } + } + if ((jsonObj.get("DocIssueDate") != null && !jsonObj.get("DocIssueDate").isJsonNull()) + && !jsonObj.get("DocIssueDate").isJsonPrimitive()) { + System.err.println( + String.format( + "Expected the field `DocIssueDate` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("DocIssueDate").toString())); + } + if ((jsonObj.get("IssuingCountry") != null && !jsonObj.get("IssuingCountry").isJsonNull()) + && !jsonObj.get("IssuingCountry").isJsonPrimitive()) { + System.err.println( + String.format( + "Expected the field `IssuingCountry` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("IssuingCountry").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("Notifications") != null + && !jsonObj.get("Notifications").isJsonNull() + && !jsonObj.get("Notifications").isJsonArray()) { + System.err.println( + String.format( + "Expected the field `Notifications` to be an array in the JSON string but got `%s`", + jsonObj.get("Notifications").toString())); + } + // validate the optional field `Signature` + if (jsonObj.get("Signature") != null && !jsonObj.get("Signature").isJsonNull()) { + TrfFtBytes.validateJsonElement(jsonObj.get("Signature")); + } + if ((jsonObj.get("SignatureDate") != null && !jsonObj.get("SignatureDate").isJsonNull()) + && !jsonObj.get("SignatureDate").isJsonPrimitive()) { + System.err.println( + String.format( + "Expected the field `SignatureDate` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("SignatureDate").toString())); + } + if ((jsonObj.get("Signer") != null && !jsonObj.get("Signer").isJsonNull()) + && !jsonObj.get("Signer").isJsonPrimitive()) { + System.err.println( + String.format( + "Expected the field `Signer` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("Signer").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VDSData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VDSData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VDSData.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VDSData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VDSData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VDSData given an JSON string + * + * @param jsonString JSON string + * @return An instance of VDSData + * @throws IOException if the JSON string is invalid with respect to VDSData + */ + public static VDSData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VDSData.class); + } + + /** + * Convert an instance of VDSData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/VDSDataItem.java b/client/src/main/generated/com/regula/documentreader/webclient/model/VDSDataItem.java new file mode 100644 index 0000000..06f9806 --- /dev/null +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/VDSDataItem.java @@ -0,0 +1,188 @@ +/* + * Regula Document Reader Web API + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 8.1.0 + * + * + * 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.regula.documentreader.webclient.model; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.regula.documentreader.webclient.JSON; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; + +/** VDSDataItem */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.15.0") +public class VDSDataItem { + public static final String SERIALIZED_NAME_DFT_V_D_S = "dftVDS"; + + @SerializedName(SERIALIZED_NAME_DFT_V_D_S) + @javax.annotation.Nonnull + private VDSData dftVDS; + + public VDSDataItem() {} + + public VDSDataItem dftVDS(@javax.annotation.Nonnull VDSData dftVDS) { + this.dftVDS = dftVDS; + return this; + } + + /** + * Get dftVDS + * + * @return dftVDS + */ + @javax.annotation.Nonnull + public VDSData getDftVDS() { + return dftVDS; + } + + public void setDftVDS(@javax.annotation.Nonnull VDSData dftVDS) { + this.dftVDS = dftVDS; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VDSDataItem vdSDataItem = (VDSDataItem) o; + return Objects.equals(this.dftVDS, vdSDataItem.dftVDS); + } + + @Override + public int hashCode() { + return Objects.hash(dftVDS); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VDSDataItem {\n"); + sb.append(" dftVDS: ").append(toIndentedString(dftVDS)).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("dftVDS")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("dftVDS")); + } + + /** + * 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 VDSDataItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VDSDataItem.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + System.err.println( + String.format( + "The required field(s) %s in VDSDataItem is not found in the empty JSON string", + VDSDataItem.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VDSDataItem.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + System.err.println( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `dftVDS` + VDSData.validateJsonElement(jsonObj.get("dftVDS")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VDSDataItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VDSDataItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VDSDataItem.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VDSDataItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VDSDataItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VDSDataItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of VDSDataItem + * @throws IOException if the JSON string is invalid with respect to VDSDataItem + */ + public static VDSDataItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VDSDataItem.class); + } + + /** + * Convert an instance of VDSDataItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/VDSDataResult.java b/client/src/main/generated/com/regula/documentreader/webclient/model/VDSDataResult.java new file mode 100644 index 0000000..0cce0c5 --- /dev/null +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/VDSDataResult.java @@ -0,0 +1,188 @@ +/* + * Regula Document Reader Web API + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 8.1.0 + * + * + * 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.regula.documentreader.webclient.model; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.regula.documentreader.webclient.JSON; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; + +/** VDSDataResult */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.15.0") +public class VDSDataResult extends ResultItem { + public static final String SERIALIZED_NAME_DFT_V_D_S = "dftVDS"; + + @SerializedName(SERIALIZED_NAME_DFT_V_D_S) + @javax.annotation.Nonnull + private VDSData dftVDS; + + public VDSDataResult() {} + + public VDSDataResult dftVDS(@javax.annotation.Nonnull VDSData dftVDS) { + this.dftVDS = dftVDS; + return this; + } + + /** + * Get dftVDS + * + * @return dftVDS + */ + @javax.annotation.Nonnull + public VDSData getDftVDS() { + return dftVDS; + } + + public void setDftVDS(@javax.annotation.Nonnull VDSData dftVDS) { + this.dftVDS = dftVDS; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VDSDataResult vdSDataResult = (VDSDataResult) o; + return Objects.equals(this.dftVDS, vdSDataResult.dftVDS) && super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(dftVDS, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VDSDataResult {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" dftVDS: ").append(toIndentedString(dftVDS)).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("buf_length", "light", "list_idx", "page_idx", "result_type", "dftVDS")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("dftVDS", "result_type")); + } + + /** + * 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 VDSDataResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VDSDataResult.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + System.err.println( + String.format( + "The required field(s) %s in VDSDataResult is not found in the empty JSON string", + VDSDataResult.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VDSDataResult.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + System.err.println( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VDSDataResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VDSDataResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VDSDataResult.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VDSDataResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VDSDataResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VDSDataResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of VDSDataResult + * @throws IOException if the JSON string is invalid with respect to VDSDataResult + */ + public static VDSDataResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VDSDataResult.class); + } + + /** + * Convert an instance of VDSDataResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/VDSNCData.java b/client/src/main/generated/com/regula/documentreader/webclient/model/VDSNCData.java new file mode 100644 index 0000000..c9743ab --- /dev/null +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/VDSNCData.java @@ -0,0 +1,494 @@ +/* + * Regula Document Reader Web API + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 8.1.0 + * + * + * 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.regula.documentreader.webclient.model; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.regula.documentreader.webclient.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; + +/** VDSNCData */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.15.0") +public class VDSNCData { + public static final String SERIALIZED_NAME_CERTIFICATE = "Certificate"; + + @SerializedName(SERIALIZED_NAME_CERTIFICATE) + @javax.annotation.Nullable + private TrfFtBytes certificate; + + public static final String SERIALIZED_NAME_CERTIFICATE_CHAIN = "CertificateChain"; + + @SerializedName(SERIALIZED_NAME_CERTIFICATE_CHAIN) + @javax.annotation.Nullable + private List certificateChain; + + public static final String SERIALIZED_NAME_ISSUING_COUNTRY = "IssuingCountry"; + + @SerializedName(SERIALIZED_NAME_ISSUING_COUNTRY) + @javax.annotation.Nullable + private String issuingCountry; + + public static final String SERIALIZED_NAME_MESSAGE = "Message"; + + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private Message message; + + public static final String SERIALIZED_NAME_NOTIFICATIONS = "Notifications"; + + @SerializedName(SERIALIZED_NAME_NOTIFICATIONS) + @javax.annotation.Nullable + private List notifications; + + public static final String SERIALIZED_NAME_SIGNATURE = "Signature"; + + @SerializedName(SERIALIZED_NAME_SIGNATURE) + @javax.annotation.Nullable + private TrfFtBytes signature; + + public static final String SERIALIZED_NAME_SIGNATURE_ALG = "SignatureAlg"; + + @SerializedName(SERIALIZED_NAME_SIGNATURE_ALG) + @javax.annotation.Nullable + private String signatureAlg; + + public static final String SERIALIZED_NAME_TYPE = "Type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_VERSION = "Version"; + + @SerializedName(SERIALIZED_NAME_VERSION) + @javax.annotation.Nullable + private Integer version; + + public VDSNCData() {} + + public VDSNCData certificate(@javax.annotation.Nullable TrfFtBytes certificate) { + this.certificate = certificate; + return this; + } + + /** + * Get certificate + * + * @return certificate + */ + @javax.annotation.Nullable + public TrfFtBytes getCertificate() { + return certificate; + } + + public void setCertificate(@javax.annotation.Nullable TrfFtBytes certificate) { + this.certificate = certificate; + } + + public VDSNCData certificateChain( + @javax.annotation.Nullable List certificateChain) { + this.certificateChain = certificateChain; + return this; + } + + public VDSNCData addCertificateChainItem(RfidCertificateEx certificateChainItem) { + if (this.certificateChain == null) { + this.certificateChain = new ArrayList<>(); + } + this.certificateChain.add(certificateChainItem); + return this; + } + + /** + * Get certificateChain + * + * @return certificateChain + */ + @javax.annotation.Nullable + public List getCertificateChain() { + return certificateChain; + } + + public void setCertificateChain( + @javax.annotation.Nullable List certificateChain) { + this.certificateChain = certificateChain; + } + + public VDSNCData issuingCountry(@javax.annotation.Nullable String issuingCountry) { + this.issuingCountry = issuingCountry; + return this; + } + + /** + * Get issuingCountry + * + * @return issuingCountry + */ + @javax.annotation.Nullable + public String getIssuingCountry() { + return issuingCountry; + } + + public void setIssuingCountry(@javax.annotation.Nullable String issuingCountry) { + this.issuingCountry = issuingCountry; + } + + public VDSNCData message(@javax.annotation.Nullable Message message) { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message + */ + @javax.annotation.Nullable + public Message getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable Message message) { + this.message = message; + } + + public VDSNCData notifications(@javax.annotation.Nullable List notifications) { + this.notifications = notifications; + return this; + } + + public VDSNCData addNotificationsItem(Integer notificationsItem) { + if (this.notifications == null) { + this.notifications = new ArrayList<>(); + } + this.notifications.add(notificationsItem); + return this; + } + + /** + * Get notifications + * + * @return notifications + */ + @javax.annotation.Nullable + public List getNotifications() { + return notifications; + } + + public void setNotifications(@javax.annotation.Nullable List notifications) { + this.notifications = notifications; + } + + public VDSNCData signature(@javax.annotation.Nullable TrfFtBytes signature) { + this.signature = signature; + return this; + } + + /** + * Get signature + * + * @return signature + */ + @javax.annotation.Nullable + public TrfFtBytes getSignature() { + return signature; + } + + public void setSignature(@javax.annotation.Nullable TrfFtBytes signature) { + this.signature = signature; + } + + public VDSNCData signatureAlg(@javax.annotation.Nullable String signatureAlg) { + this.signatureAlg = signatureAlg; + return this; + } + + /** + * Get signatureAlg + * + * @return signatureAlg + */ + @javax.annotation.Nullable + public String getSignatureAlg() { + return signatureAlg; + } + + public void setSignatureAlg(@javax.annotation.Nullable String signatureAlg) { + this.signatureAlg = signatureAlg; + } + + public VDSNCData 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; + } + + public VDSNCData version(@javax.annotation.Nullable Integer version) { + this.version = version; + return this; + } + + /** + * Get version + * + * @return version + */ + @javax.annotation.Nullable + public Integer getVersion() { + return version; + } + + public void setVersion(@javax.annotation.Nullable Integer version) { + this.version = version; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VDSNCData vdSNCData = (VDSNCData) o; + return Objects.equals(this.certificate, vdSNCData.certificate) + && Objects.equals(this.certificateChain, vdSNCData.certificateChain) + && Objects.equals(this.issuingCountry, vdSNCData.issuingCountry) + && Objects.equals(this.message, vdSNCData.message) + && Objects.equals(this.notifications, vdSNCData.notifications) + && Objects.equals(this.signature, vdSNCData.signature) + && Objects.equals(this.signatureAlg, vdSNCData.signatureAlg) + && Objects.equals(this.type, vdSNCData.type) + && Objects.equals(this.version, vdSNCData.version); + } + + @Override + public int hashCode() { + return Objects.hash( + certificate, + certificateChain, + issuingCountry, + message, + notifications, + signature, + signatureAlg, + type, + version); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VDSNCData {\n"); + sb.append(" certificate: ").append(toIndentedString(certificate)).append("\n"); + sb.append(" certificateChain: ").append(toIndentedString(certificateChain)).append("\n"); + sb.append(" issuingCountry: ").append(toIndentedString(issuingCountry)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" notifications: ").append(toIndentedString(notifications)).append("\n"); + sb.append(" signature: ").append(toIndentedString(signature)).append("\n"); + sb.append(" signatureAlg: ").append(toIndentedString(signatureAlg)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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( + "Certificate", + "CertificateChain", + "IssuingCountry", + "Message", + "Notifications", + "Signature", + "SignatureAlg", + "Type", + "Version")); + + // 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 VDSNCData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VDSNCData.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + System.err.println( + String.format( + "The required field(s) %s in VDSNCData is not found in the empty JSON string", + VDSNCData.openapiRequiredFields.toString())); + } + } + + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `Certificate` + if (jsonObj.get("Certificate") != null && !jsonObj.get("Certificate").isJsonNull()) { + TrfFtBytes.validateJsonElement(jsonObj.get("Certificate")); + } + if (jsonObj.get("CertificateChain") != null && !jsonObj.get("CertificateChain").isJsonNull()) { + JsonArray jsonArraycertificateChain = jsonObj.getAsJsonArray("CertificateChain"); + if (jsonArraycertificateChain != null) { + // ensure the json data is an array + if (!jsonObj.get("CertificateChain").isJsonArray()) { + System.err.println( + String.format( + "Expected the field `CertificateChain` to be an array in the JSON string but got `%s`", + jsonObj.get("CertificateChain").toString())); + } + + // validate the optional field `CertificateChain` (array) + for (int i = 0; i < jsonArraycertificateChain.size(); i++) { + RfidCertificateEx.validateJsonElement(jsonArraycertificateChain.get(i)); + } + ; + } + } + if ((jsonObj.get("IssuingCountry") != null && !jsonObj.get("IssuingCountry").isJsonNull()) + && !jsonObj.get("IssuingCountry").isJsonPrimitive()) { + System.err.println( + String.format( + "Expected the field `IssuingCountry` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("IssuingCountry").toString())); + } + // validate the optional field `Message` + if (jsonObj.get("Message") != null && !jsonObj.get("Message").isJsonNull()) { + Message.validateJsonElement(jsonObj.get("Message")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("Notifications") != null + && !jsonObj.get("Notifications").isJsonNull() + && !jsonObj.get("Notifications").isJsonArray()) { + System.err.println( + String.format( + "Expected the field `Notifications` to be an array in the JSON string but got `%s`", + jsonObj.get("Notifications").toString())); + } + // validate the optional field `Signature` + if (jsonObj.get("Signature") != null && !jsonObj.get("Signature").isJsonNull()) { + TrfFtBytes.validateJsonElement(jsonObj.get("Signature")); + } + if ((jsonObj.get("SignatureAlg") != null && !jsonObj.get("SignatureAlg").isJsonNull()) + && !jsonObj.get("SignatureAlg").isJsonPrimitive()) { + System.err.println( + String.format( + "Expected the field `SignatureAlg` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("SignatureAlg").toString())); + } + if ((jsonObj.get("Type") != null && !jsonObj.get("Type").isJsonNull()) + && !jsonObj.get("Type").isJsonPrimitive()) { + System.err.println( + String.format( + "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 (!VDSNCData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VDSNCData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VDSNCData.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VDSNCData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VDSNCData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VDSNCData given an JSON string + * + * @param jsonString JSON string + * @return An instance of VDSNCData + * @throws IOException if the JSON string is invalid with respect to VDSNCData + */ + public static VDSNCData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VDSNCData.class); + } + + /** + * Convert an instance of VDSNCData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/VDSNCDataItem.java b/client/src/main/generated/com/regula/documentreader/webclient/model/VDSNCDataItem.java new file mode 100644 index 0000000..687a4d5 --- /dev/null +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/VDSNCDataItem.java @@ -0,0 +1,188 @@ +/* + * Regula Document Reader Web API + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 8.1.0 + * + * + * 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.regula.documentreader.webclient.model; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.regula.documentreader.webclient.JSON; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; + +/** VDSNCDataItem */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.15.0") +public class VDSNCDataItem { + public static final String SERIALIZED_NAME_DFT_V_D_S_N_C = "dftVDS_NC"; + + @SerializedName(SERIALIZED_NAME_DFT_V_D_S_N_C) + @javax.annotation.Nonnull + private VDSNCData dftVDSNC; + + public VDSNCDataItem() {} + + public VDSNCDataItem dftVDSNC(@javax.annotation.Nonnull VDSNCData dftVDSNC) { + this.dftVDSNC = dftVDSNC; + return this; + } + + /** + * Get dftVDSNC + * + * @return dftVDSNC + */ + @javax.annotation.Nonnull + public VDSNCData getDftVDSNC() { + return dftVDSNC; + } + + public void setDftVDSNC(@javax.annotation.Nonnull VDSNCData dftVDSNC) { + this.dftVDSNC = dftVDSNC; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VDSNCDataItem vdSNCDataItem = (VDSNCDataItem) o; + return Objects.equals(this.dftVDSNC, vdSNCDataItem.dftVDSNC); + } + + @Override + public int hashCode() { + return Objects.hash(dftVDSNC); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VDSNCDataItem {\n"); + sb.append(" dftVDSNC: ").append(toIndentedString(dftVDSNC)).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("dftVDS_NC")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("dftVDS_NC")); + } + + /** + * 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 VDSNCDataItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VDSNCDataItem.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + System.err.println( + String.format( + "The required field(s) %s in VDSNCDataItem is not found in the empty JSON string", + VDSNCDataItem.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VDSNCDataItem.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + System.err.println( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `dftVDS_NC` + VDSNCData.validateJsonElement(jsonObj.get("dftVDS_NC")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VDSNCDataItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VDSNCDataItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VDSNCDataItem.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VDSNCDataItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VDSNCDataItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VDSNCDataItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of VDSNCDataItem + * @throws IOException if the JSON string is invalid with respect to VDSNCDataItem + */ + public static VDSNCDataItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VDSNCDataItem.class); + } + + /** + * Convert an instance of VDSNCDataItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/VDSNCDataResult.java b/client/src/main/generated/com/regula/documentreader/webclient/model/VDSNCDataResult.java new file mode 100644 index 0000000..d052a18 --- /dev/null +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/VDSNCDataResult.java @@ -0,0 +1,189 @@ +/* + * Regula Document Reader Web API + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 8.1.0 + * + * + * 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.regula.documentreader.webclient.model; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.regula.documentreader.webclient.JSON; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; + +/** VDSNCDataResult */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.15.0") +public class VDSNCDataResult extends ResultItem { + public static final String SERIALIZED_NAME_DFT_V_D_S_N_C = "dftVDS_NC"; + + @SerializedName(SERIALIZED_NAME_DFT_V_D_S_N_C) + @javax.annotation.Nonnull + private VDSNCData dftVDSNC; + + public VDSNCDataResult() {} + + public VDSNCDataResult dftVDSNC(@javax.annotation.Nonnull VDSNCData dftVDSNC) { + this.dftVDSNC = dftVDSNC; + return this; + } + + /** + * Get dftVDSNC + * + * @return dftVDSNC + */ + @javax.annotation.Nonnull + public VDSNCData getDftVDSNC() { + return dftVDSNC; + } + + public void setDftVDSNC(@javax.annotation.Nonnull VDSNCData dftVDSNC) { + this.dftVDSNC = dftVDSNC; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VDSNCDataResult vdSNCDataResult = (VDSNCDataResult) o; + return Objects.equals(this.dftVDSNC, vdSNCDataResult.dftVDSNC) && super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(dftVDSNC, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VDSNCDataResult {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" dftVDSNC: ").append(toIndentedString(dftVDSNC)).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( + "buf_length", "light", "list_idx", "page_idx", "result_type", "dftVDS_NC")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("dftVDS_NC", "result_type")); + } + + /** + * 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 VDSNCDataResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VDSNCDataResult.openapiRequiredFields + .isEmpty()) { // has required fields but JSON element is null + System.err.println( + String.format( + "The required field(s) %s in VDSNCDataResult is not found in the empty JSON string", + VDSNCDataResult.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VDSNCDataResult.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + System.err.println( + String.format( + "The required field `%s` is not found in the JSON string: %s", + requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VDSNCDataResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VDSNCDataResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VDSNCDataResult.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VDSNCDataResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VDSNCDataResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VDSNCDataResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of VDSNCDataResult + * @throws IOException if the JSON string is invalid with respect to VDSNCDataResult + */ + public static VDSNCDataResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VDSNCDataResult.class); + } + + /** + * Convert an instance of VDSNCDataResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/client/src/main/generated/com/regula/documentreader/webclient/model/VEItem.java b/client/src/main/generated/com/regula/documentreader/webclient/model/VEItem.java new file mode 100644 index 0000000..79bc646 --- /dev/null +++ b/client/src/main/generated/com/regula/documentreader/webclient/model/VEItem.java @@ -0,0 +1,307 @@ +/* + * Regula Document Reader Web API + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core + * + * The version of the OpenAPI document: 8.1.0 + * + * + * 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.regula.documentreader.webclient.model; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.regula.documentreader.webclient.JSON; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; + +/** VEItem */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.15.0") +public class VEItem { + public static final String SERIALIZED_NAME_DES = "des"; + + @SerializedName(SERIALIZED_NAME_DES) + @javax.annotation.Nullable + private String des; + + public static final String SERIALIZED_NAME_DIS = "dis"; + + @SerializedName(SERIALIZED_NAME_DIS) + @javax.annotation.Nullable + private String dis; + + public static final String SERIALIZED_NAME_NAM = "nam"; + + @SerializedName(SERIALIZED_NAME_NAM) + @javax.annotation.Nullable + private String nam; + + public static final String SERIALIZED_NAME_VD = "vd"; + + @SerializedName(SERIALIZED_NAME_VD) + @javax.annotation.Nullable + private List vd; + + public VEItem() {} + + public VEItem des(@javax.annotation.Nullable String des) { + this.des = des; + return this; + } + + /** + * Get des + * + * @return des + */ + @javax.annotation.Nullable + public String getDes() { + return des; + } + + public void setDes(@javax.annotation.Nullable String des) { + this.des = des; + } + + public VEItem dis(@javax.annotation.Nullable String dis) { + this.dis = dis; + return this; + } + + /** + * Get dis + * + * @return dis + */ + @javax.annotation.Nullable + public String getDis() { + return dis; + } + + public void setDis(@javax.annotation.Nullable String dis) { + this.dis = dis; + } + + public VEItem nam(@javax.annotation.Nullable String nam) { + this.nam = nam; + return this; + } + + /** + * Get nam + * + * @return nam + */ + @javax.annotation.Nullable + public String getNam() { + return nam; + } + + public void setNam(@javax.annotation.Nullable String nam) { + this.nam = nam; + } + + public VEItem vd(@javax.annotation.Nullable List vd) { + this.vd = vd; + return this; + } + + public VEItem addVdItem(VDItem vdItem) { + if (this.vd == null) { + this.vd = new ArrayList<>(); + } + this.vd.add(vdItem); + return this; + } + + /** + * Get vd + * + * @return vd + */ + @javax.annotation.Nullable + public List getVd() { + return vd; + } + + public void setVd(@javax.annotation.Nullable List vd) { + this.vd = vd; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VEItem veItem = (VEItem) o; + return Objects.equals(this.des, veItem.des) + && Objects.equals(this.dis, veItem.dis) + && Objects.equals(this.nam, veItem.nam) + && Objects.equals(this.vd, veItem.vd); + } + + @Override + public int hashCode() { + return Objects.hash(des, dis, nam, vd); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VEItem {\n"); + sb.append(" des: ").append(toIndentedString(des)).append("\n"); + sb.append(" dis: ").append(toIndentedString(dis)).append("\n"); + sb.append(" nam: ").append(toIndentedString(nam)).append("\n"); + sb.append(" vd: ").append(toIndentedString(vd)).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("des", "dis", "nam", "vd")); + + // 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 VEItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VEItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + System.err.println( + String.format( + "The required field(s) %s in VEItem is not found in the empty JSON string", + VEItem.openapiRequiredFields.toString())); + } + } + + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("des") != null && !jsonObj.get("des").isJsonNull()) + && !jsonObj.get("des").isJsonPrimitive()) { + System.err.println( + String.format( + "Expected the field `des` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("des").toString())); + } + if ((jsonObj.get("dis") != null && !jsonObj.get("dis").isJsonNull()) + && !jsonObj.get("dis").isJsonPrimitive()) { + System.err.println( + String.format( + "Expected the field `dis` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("dis").toString())); + } + if ((jsonObj.get("nam") != null && !jsonObj.get("nam").isJsonNull()) + && !jsonObj.get("nam").isJsonPrimitive()) { + System.err.println( + String.format( + "Expected the field `nam` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("nam").toString())); + } + if (jsonObj.get("vd") != null && !jsonObj.get("vd").isJsonNull()) { + JsonArray jsonArrayvd = jsonObj.getAsJsonArray("vd"); + if (jsonArrayvd != null) { + // ensure the json data is an array + if (!jsonObj.get("vd").isJsonArray()) { + System.err.println( + String.format( + "Expected the field `vd` to be an array in the JSON string but got `%s`", + jsonObj.get("vd").toString())); + } + + // validate the optional field `vd` (array) + for (int i = 0; i < jsonArrayvd.size(); i++) { + VDItem.validateJsonElement(jsonArrayvd.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VEItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VEItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VEItem.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VEItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VEItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of VEItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of VEItem + * @throws IOException if the JSON string is invalid with respect to VEItem + */ + public static VEItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VEItem.class); + } + + /** + * Convert an instance of VEItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +}