Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ src/main/generated/com/regula/documentreader/webclient/model/AuthenticityCheckRe
src/main/generated/com/regula/documentreader/webclient/model/AuthenticityCheckResultListInner.java
src/main/generated/com/regula/documentreader/webclient/model/AuthenticityResult.java
src/main/generated/com/regula/documentreader/webclient/model/AuthenticityResultType.java
src/main/generated/com/regula/documentreader/webclient/model/BSIV2Item.java
src/main/generated/com/regula/documentreader/webclient/model/BSIV2Result.java
src/main/generated/com/regula/documentreader/webclient/model/BarCodeModuleType.java
src/main/generated/com/regula/documentreader/webclient/model/BarcodePositionItem.java
src/main/generated/com/regula/documentreader/webclient/model/BarcodePositionResult.java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,20 @@ public static GsonBuilder createGson() {
getDiscriminatorValue(readElement, "result_type"));
}
})
.registerTypeSelector(
com.regula.documentreader.webclient.model.BSIV2Result.class,
new TypeSelector<com.regula.documentreader.webclient.model.BSIV2Result>() {
@Override
public Class<? extends com.regula.documentreader.webclient.model.BSIV2Result>
getClassForElement(JsonElement readElement) {
Map<String, Class> classByDiscriminatorValue = new HashMap<String, Class>();
classByDiscriminatorValue.put(
"BSIV2Result", com.regula.documentreader.webclient.model.BSIV2Result.class);
return getClassByDiscriminator(
classByDiscriminatorValue,
getDiscriminatorValue(readElement, "result_type"));
}
})
.registerTypeSelector(
com.regula.documentreader.webclient.model.BarcodePositionResult.class,
new TypeSelector<
Expand Down Expand Up @@ -387,6 +401,8 @@ public static GsonBuilder createGson() {
com.regula.documentreader.webclient.model.BarcodePositionResult.class);
classByDiscriminatorValue.put(
"7", com.regula.documentreader.webclient.model.MRZTestQualityResult.class);
classByDiscriminatorValue.put(
"73", com.regula.documentreader.webclient.model.BSIV2Result.class);
classByDiscriminatorValue.put(
"8",
com.regula.documentreader.webclient.model.DocumentTypesCandidatesResult
Expand Down Expand Up @@ -838,6 +854,8 @@ public static GsonBuilder createGson() {
com.regula.documentreader.webclient.model.BarcodePositionResult.class);
classByDiscriminatorValue.put(
"7", com.regula.documentreader.webclient.model.MRZTestQualityResult.class);
classByDiscriminatorValue.put(
"73", com.regula.documentreader.webclient.model.BSIV2Result.class);
classByDiscriminatorValue.put(
"8",
com.regula.documentreader.webclient.model.DocumentTypesCandidatesResult
Expand Down Expand Up @@ -1009,6 +1027,10 @@ private static Class getClassByDiscriminator(
gsonBuilder.registerTypeAdapterFactory(
new com.regula.documentreader.webclient.model.AuthenticityResult
.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(
new com.regula.documentreader.webclient.model.BSIV2Item.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(
new com.regula.documentreader.webclient.model.BSIV2Result.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(
new com.regula.documentreader.webclient.model.BarcodePositionItem
.CustomTypeAdapterFactory());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
/*
* 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;

/** BSIV2Item */
@javax.annotation.Generated(
value = "org.openapitools.codegen.languages.JavaClientCodegen",
comments = "Generator version: 7.15.0")
public class BSIV2Item {
public static final String SERIALIZED_NAME_XM_L_BUFFER = "XML_buffer";

@SerializedName(SERIALIZED_NAME_XM_L_BUFFER)
@javax.annotation.Nonnull
private String xmLBuffer;

public BSIV2Item() {}

public BSIV2Item xmLBuffer(@javax.annotation.Nonnull String xmLBuffer) {
this.xmLBuffer = xmLBuffer;
return this;
}

/**
* Get xmLBuffer
*
* @return xmLBuffer
*/
@javax.annotation.Nonnull
public String getXmLBuffer() {
return xmLBuffer;
}

public void setXmLBuffer(@javax.annotation.Nonnull String xmLBuffer) {
this.xmLBuffer = xmLBuffer;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
BSIV2Item bsIV2Item = (BSIV2Item) o;
return Objects.equals(this.xmLBuffer, bsIV2Item.xmLBuffer);
}

@Override
public int hashCode() {
return Objects.hash(xmLBuffer);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BSIV2Item {\n");
sb.append(" xmLBuffer: ").append(toIndentedString(xmLBuffer)).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<String> openapiFields;
public static HashSet<String> openapiRequiredFields;

static {
// a set of all properties/fields (JSON key names)
openapiFields = new HashSet<String>(Arrays.asList("XML_buffer"));

// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet<String>(Arrays.asList("XML_buffer"));
}

/**
* 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 BSIV2Item
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!BSIV2Item.openapiRequiredFields
.isEmpty()) { // has required fields but JSON element is null
System.err.println(
String.format(
"The required field(s) %s in BSIV2Item is not found in the empty JSON string",
BSIV2Item.openapiRequiredFields.toString()));
}
}

// check to make sure all required properties/fields are present in the JSON string
for (String requiredField : BSIV2Item.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("XML_buffer").isJsonPrimitive()) {
System.err.println(
String.format(
"Expected the field `XML_buffer` to be a primitive type in the JSON string but got `%s`",
jsonObj.get("XML_buffer").toString()));
}
}

public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!BSIV2Item.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'BSIV2Item' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<BSIV2Item> thisAdapter =
gson.getDelegateAdapter(this, TypeToken.get(BSIV2Item.class));

return (TypeAdapter<T>)
new TypeAdapter<BSIV2Item>() {
@Override
public void write(JsonWriter out, BSIV2Item value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}

@Override
public BSIV2Item read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}

/**
* Create an instance of BSIV2Item given an JSON string
*
* @param jsonString JSON string
* @return An instance of BSIV2Item
* @throws IOException if the JSON string is invalid with respect to BSIV2Item
*/
public static BSIV2Item fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, BSIV2Item.class);
}

/**
* Convert an instance of BSIV2Item to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}
Loading