Skip to content

Commit 92e69bc

Browse files
Merge pull request #251 from regulaforensics/develop
Develop -> Stable
2 parents 0257ece + 1141ac1 commit 92e69bc

File tree

9 files changed

+559
-25
lines changed

9 files changed

+559
-25
lines changed

client/.openapi-generator/FILES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ src/main/generated/com/regula/documentreader/webclient/model/AuthenticityCheckRe
3030
src/main/generated/com/regula/documentreader/webclient/model/AuthenticityCheckResultListInner.java
3131
src/main/generated/com/regula/documentreader/webclient/model/AuthenticityResult.java
3232
src/main/generated/com/regula/documentreader/webclient/model/AuthenticityResultType.java
33+
src/main/generated/com/regula/documentreader/webclient/model/BSIV2Item.java
34+
src/main/generated/com/regula/documentreader/webclient/model/BSIV2Result.java
3335
src/main/generated/com/regula/documentreader/webclient/model/BarCodeModuleType.java
3436
src/main/generated/com/regula/documentreader/webclient/model/BarcodePositionItem.java
3537
src/main/generated/com/regula/documentreader/webclient/model/BarcodePositionResult.java

client/src/main/generated/com/regula/documentreader/webclient/JSON.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,20 @@ public static GsonBuilder createGson() {
254254
getDiscriminatorValue(readElement, "result_type"));
255255
}
256256
})
257+
.registerTypeSelector(
258+
com.regula.documentreader.webclient.model.BSIV2Result.class,
259+
new TypeSelector<com.regula.documentreader.webclient.model.BSIV2Result>() {
260+
@Override
261+
public Class<? extends com.regula.documentreader.webclient.model.BSIV2Result>
262+
getClassForElement(JsonElement readElement) {
263+
Map<String, Class> classByDiscriminatorValue = new HashMap<String, Class>();
264+
classByDiscriminatorValue.put(
265+
"BSIV2Result", com.regula.documentreader.webclient.model.BSIV2Result.class);
266+
return getClassByDiscriminator(
267+
classByDiscriminatorValue,
268+
getDiscriminatorValue(readElement, "result_type"));
269+
}
270+
})
257271
.registerTypeSelector(
258272
com.regula.documentreader.webclient.model.BarcodePositionResult.class,
259273
new TypeSelector<
@@ -387,6 +401,8 @@ public static GsonBuilder createGson() {
387401
com.regula.documentreader.webclient.model.BarcodePositionResult.class);
388402
classByDiscriminatorValue.put(
389403
"7", com.regula.documentreader.webclient.model.MRZTestQualityResult.class);
404+
classByDiscriminatorValue.put(
405+
"73", com.regula.documentreader.webclient.model.BSIV2Result.class);
390406
classByDiscriminatorValue.put(
391407
"8",
392408
com.regula.documentreader.webclient.model.DocumentTypesCandidatesResult
@@ -838,6 +854,8 @@ public static GsonBuilder createGson() {
838854
com.regula.documentreader.webclient.model.BarcodePositionResult.class);
839855
classByDiscriminatorValue.put(
840856
"7", com.regula.documentreader.webclient.model.MRZTestQualityResult.class);
857+
classByDiscriminatorValue.put(
858+
"73", com.regula.documentreader.webclient.model.BSIV2Result.class);
841859
classByDiscriminatorValue.put(
842860
"8",
843861
com.regula.documentreader.webclient.model.DocumentTypesCandidatesResult
@@ -1009,6 +1027,10 @@ private static Class getClassByDiscriminator(
10091027
gsonBuilder.registerTypeAdapterFactory(
10101028
new com.regula.documentreader.webclient.model.AuthenticityResult
10111029
.CustomTypeAdapterFactory());
1030+
gsonBuilder.registerTypeAdapterFactory(
1031+
new com.regula.documentreader.webclient.model.BSIV2Item.CustomTypeAdapterFactory());
1032+
gsonBuilder.registerTypeAdapterFactory(
1033+
new com.regula.documentreader.webclient.model.BSIV2Result.CustomTypeAdapterFactory());
10121034
gsonBuilder.registerTypeAdapterFactory(
10131035
new com.regula.documentreader.webclient.model.BarcodePositionItem
10141036
.CustomTypeAdapterFactory());
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
/*
2+
* Regula Document Reader Web API
3+
* 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
4+
*
5+
* The version of the OpenAPI document: 8.1.0
6+
*
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
13+
package com.regula.documentreader.webclient.model;
14+
15+
import com.google.gson.Gson;
16+
import com.google.gson.JsonElement;
17+
import com.google.gson.JsonObject;
18+
import com.google.gson.TypeAdapter;
19+
import com.google.gson.TypeAdapterFactory;
20+
import com.google.gson.annotations.SerializedName;
21+
import com.google.gson.reflect.TypeToken;
22+
import com.google.gson.stream.JsonReader;
23+
import com.google.gson.stream.JsonWriter;
24+
import com.regula.documentreader.webclient.JSON;
25+
import java.io.IOException;
26+
import java.util.Arrays;
27+
import java.util.HashSet;
28+
import java.util.Objects;
29+
30+
/** BSIV2Item */
31+
@javax.annotation.Generated(
32+
value = "org.openapitools.codegen.languages.JavaClientCodegen",
33+
comments = "Generator version: 7.15.0")
34+
public class BSIV2Item {
35+
public static final String SERIALIZED_NAME_XM_L_BUFFER = "XML_buffer";
36+
37+
@SerializedName(SERIALIZED_NAME_XM_L_BUFFER)
38+
@javax.annotation.Nonnull
39+
private String xmLBuffer;
40+
41+
public BSIV2Item() {}
42+
43+
public BSIV2Item xmLBuffer(@javax.annotation.Nonnull String xmLBuffer) {
44+
this.xmLBuffer = xmLBuffer;
45+
return this;
46+
}
47+
48+
/**
49+
* Get xmLBuffer
50+
*
51+
* @return xmLBuffer
52+
*/
53+
@javax.annotation.Nonnull
54+
public String getXmLBuffer() {
55+
return xmLBuffer;
56+
}
57+
58+
public void setXmLBuffer(@javax.annotation.Nonnull String xmLBuffer) {
59+
this.xmLBuffer = xmLBuffer;
60+
}
61+
62+
@Override
63+
public boolean equals(Object o) {
64+
if (this == o) {
65+
return true;
66+
}
67+
if (o == null || getClass() != o.getClass()) {
68+
return false;
69+
}
70+
BSIV2Item bsIV2Item = (BSIV2Item) o;
71+
return Objects.equals(this.xmLBuffer, bsIV2Item.xmLBuffer);
72+
}
73+
74+
@Override
75+
public int hashCode() {
76+
return Objects.hash(xmLBuffer);
77+
}
78+
79+
@Override
80+
public String toString() {
81+
StringBuilder sb = new StringBuilder();
82+
sb.append("class BSIV2Item {\n");
83+
sb.append(" xmLBuffer: ").append(toIndentedString(xmLBuffer)).append("\n");
84+
sb.append("}");
85+
return sb.toString();
86+
}
87+
88+
/**
89+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
90+
*/
91+
private String toIndentedString(Object o) {
92+
if (o == null) {
93+
return "null";
94+
}
95+
return o.toString().replace("\n", "\n ");
96+
}
97+
98+
public static HashSet<String> openapiFields;
99+
public static HashSet<String> openapiRequiredFields;
100+
101+
static {
102+
// a set of all properties/fields (JSON key names)
103+
openapiFields = new HashSet<String>(Arrays.asList("XML_buffer"));
104+
105+
// a set of required properties/fields (JSON key names)
106+
openapiRequiredFields = new HashSet<String>(Arrays.asList("XML_buffer"));
107+
}
108+
109+
/**
110+
* Validates the JSON Element and throws an exception if issues found
111+
*
112+
* @param jsonElement JSON Element
113+
* @throws IOException if the JSON Element is invalid with respect to BSIV2Item
114+
*/
115+
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
116+
if (jsonElement == null) {
117+
if (!BSIV2Item.openapiRequiredFields
118+
.isEmpty()) { // has required fields but JSON element is null
119+
System.err.println(
120+
String.format(
121+
"The required field(s) %s in BSIV2Item is not found in the empty JSON string",
122+
BSIV2Item.openapiRequiredFields.toString()));
123+
}
124+
}
125+
126+
// check to make sure all required properties/fields are present in the JSON string
127+
for (String requiredField : BSIV2Item.openapiRequiredFields) {
128+
if (jsonElement.getAsJsonObject().get(requiredField) == null) {
129+
System.err.println(
130+
String.format(
131+
"The required field `%s` is not found in the JSON string: %s",
132+
requiredField, jsonElement.toString()));
133+
}
134+
}
135+
JsonObject jsonObj = jsonElement.getAsJsonObject();
136+
if (!jsonObj.get("XML_buffer").isJsonPrimitive()) {
137+
System.err.println(
138+
String.format(
139+
"Expected the field `XML_buffer` to be a primitive type in the JSON string but got `%s`",
140+
jsonObj.get("XML_buffer").toString()));
141+
}
142+
}
143+
144+
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
145+
@SuppressWarnings("unchecked")
146+
@Override
147+
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
148+
if (!BSIV2Item.class.isAssignableFrom(type.getRawType())) {
149+
return null; // this class only serializes 'BSIV2Item' and its subtypes
150+
}
151+
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
152+
final TypeAdapter<BSIV2Item> thisAdapter =
153+
gson.getDelegateAdapter(this, TypeToken.get(BSIV2Item.class));
154+
155+
return (TypeAdapter<T>)
156+
new TypeAdapter<BSIV2Item>() {
157+
@Override
158+
public void write(JsonWriter out, BSIV2Item value) throws IOException {
159+
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
160+
elementAdapter.write(out, obj);
161+
}
162+
163+
@Override
164+
public BSIV2Item read(JsonReader in) throws IOException {
165+
JsonElement jsonElement = elementAdapter.read(in);
166+
validateJsonElement(jsonElement);
167+
return thisAdapter.fromJsonTree(jsonElement);
168+
}
169+
}.nullSafe();
170+
}
171+
}
172+
173+
/**
174+
* Create an instance of BSIV2Item given an JSON string
175+
*
176+
* @param jsonString JSON string
177+
* @return An instance of BSIV2Item
178+
* @throws IOException if the JSON string is invalid with respect to BSIV2Item
179+
*/
180+
public static BSIV2Item fromJson(String jsonString) throws IOException {
181+
return JSON.getGson().fromJson(jsonString, BSIV2Item.class);
182+
}
183+
184+
/**
185+
* Convert an instance of BSIV2Item to an JSON string
186+
*
187+
* @return JSON string
188+
*/
189+
public String toJson() {
190+
return JSON.getGson().toJson(this);
191+
}
192+
}

0 commit comments

Comments
 (0)