diff --git a/README.md b/README.md
index 00537c1..2015816 100644
--- a/README.md
+++ b/README.md
@@ -63,7 +63,7 @@ Ten klient API zapewnia interfejsy Java dla Symfonia WebAPI, umożliwiając pły
## 📦 Informacje o wersji
-- **Aktualna wersja**: `0.1.5`
+- **Aktualna wersja**: `0.1.6`
- **Wymagana wersja Java**: Java 17+
## 🔓 Licencja
@@ -84,7 +84,7 @@ Możesz dodać bibliotekę do swojego projektu, dołączając zależność z Mav
pl.wtx.symfonia
symfonia-erp-webapi-client
- 0.1.5
+ 0.1.6
```
@@ -102,7 +102,7 @@ Następnie dodaj zbudowany artefakt do swojego projektu:
pl.wtx.symfonia
symfonia-erp-webapi-client
- 0.1.5
+ 0.1.6
```
diff --git a/pom.xml b/pom.xml
index 11e7642..5ab2c12 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
pl.wtx.symfonia
symfonia-erp-webapi-client
- 0.1.5
+ 0.1.6
jar
Symfonia ERP WebAPI Client
diff --git a/src/main/java/pl/wtx/symfonia/api/client/ContractorsApi.java b/src/main/java/pl/wtx/symfonia/api/client/ContractorsApi.java
index 5e6432b..47c8044 100644
--- a/src/main/java/pl/wtx/symfonia/api/client/ContractorsApi.java
+++ b/src/main/java/pl/wtx/symfonia/api/client/ContractorsApi.java
@@ -28,9 +28,9 @@
import pl.wtx.symfonia.api.client.model.ApiError;
-import pl.wtx.symfonia.api.client.model.Contractor;
import pl.wtx.symfonia.api.client.model.ContractorCriteriaFilter;
import pl.wtx.symfonia.api.client.model.ContractorListElement;
+import pl.wtx.symfonia.api.client.model.GetContractors200Response;
import java.lang.reflect.Type;
import java.util.ArrayList;
@@ -87,7 +87,7 @@ public void setCustomBaseUrl(String customBaseUrl) {
Response Details
| Status Code | Description | Response Headers |
- | 200 | Zwraca kolekcje obiektow Contractor. | - |
+ | 200 | Jeśli parametr 'id' jest podany, zwracany jest pojedynczy obiekt Contractor. Jeśli parametr 'nip' jest podany, zwracana jest lista obiektów Contractor. | - |
| 400 | Bad Request | - |
| 401 | Unauthorized | - |
| 404 | Not Found | - |
@@ -161,20 +161,20 @@ private okhttp3.Call getContractorsValidateBeforeCall(@javax.annotation.Nullable
* @param id Identyfikator kontrahenta. (optional)
* @param code Kod kontrahenta. (optional)
* @param nip Identyfikator NIP kontrahenta. (optional)
- * @return List<Contractor>
+ * @return GetContractors200Response
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Response Details
| Status Code | Description | Response Headers |
- | 200 | Zwraca kolekcje obiektow Contractor. | - |
+ | 200 | Jeśli parametr 'id' jest podany, zwracany jest pojedynczy obiekt Contractor. Jeśli parametr 'nip' jest podany, zwracana jest lista obiektów Contractor. | - |
| 400 | Bad Request | - |
| 401 | Unauthorized | - |
| 404 | Not Found | - |
*/
- public List getContractors(@javax.annotation.Nullable String id, @javax.annotation.Nullable String code, @javax.annotation.Nullable String nip) throws ApiException {
- ApiResponse> localVarResp = getContractorsWithHttpInfo(id, code, nip);
+ public GetContractors200Response getContractors(@javax.annotation.Nullable String id, @javax.annotation.Nullable String code, @javax.annotation.Nullable String nip) throws ApiException {
+ ApiResponse localVarResp = getContractorsWithHttpInfo(id, code, nip);
return localVarResp.getData();
}
@@ -184,21 +184,21 @@ public List getContractors(@javax.annotation.Nullable String id, @ja
* @param id Identyfikator kontrahenta. (optional)
* @param code Kod kontrahenta. (optional)
* @param nip Identyfikator NIP kontrahenta. (optional)
- * @return ApiResponse<List<Contractor>>
+ * @return ApiResponse<GetContractors200Response>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Response Details
| Status Code | Description | Response Headers |
- | 200 | Zwraca kolekcje obiektow Contractor. | - |
+ | 200 | Jeśli parametr 'id' jest podany, zwracany jest pojedynczy obiekt Contractor. Jeśli parametr 'nip' jest podany, zwracana jest lista obiektów Contractor. | - |
| 400 | Bad Request | - |
| 401 | Unauthorized | - |
| 404 | Not Found | - |
*/
- public ApiResponse> getContractorsWithHttpInfo(@javax.annotation.Nullable String id, @javax.annotation.Nullable String code, @javax.annotation.Nullable String nip) throws ApiException {
+ public ApiResponse getContractorsWithHttpInfo(@javax.annotation.Nullable String id, @javax.annotation.Nullable String code, @javax.annotation.Nullable String nip) throws ApiException {
okhttp3.Call localVarCall = getContractorsValidateBeforeCall(id, code, nip, null);
- Type localVarReturnType = new TypeToken>(){}.getType();
+ Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
@@ -215,16 +215,16 @@ public ApiResponse> getContractorsWithHttpInfo(@javax.annotatio
Response Details
| Status Code | Description | Response Headers |
- | 200 | Zwraca kolekcje obiektow Contractor. | - |
+ | 200 | Jeśli parametr 'id' jest podany, zwracany jest pojedynczy obiekt Contractor. Jeśli parametr 'nip' jest podany, zwracana jest lista obiektów Contractor. | - |
| 400 | Bad Request | - |
| 401 | Unauthorized | - |
| 404 | Not Found | - |
*/
- public okhttp3.Call getContractorsAsync(@javax.annotation.Nullable String id, @javax.annotation.Nullable String code, @javax.annotation.Nullable String nip, final ApiCallback> _callback) throws ApiException {
+ public okhttp3.Call getContractorsAsync(@javax.annotation.Nullable String id, @javax.annotation.Nullable String code, @javax.annotation.Nullable String nip, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = getContractorsValidateBeforeCall(id, code, nip, _callback);
- Type localVarReturnType = new TypeToken>(){}.getType();
+ Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
diff --git a/src/main/java/pl/wtx/symfonia/api/client/invoker/JSON.java b/src/main/java/pl/wtx/symfonia/api/client/invoker/JSON.java
index 489f9a9..64e94eb 100644
--- a/src/main/java/pl/wtx/symfonia/api/client/invoker/JSON.java
+++ b/src/main/java/pl/wtx/symfonia/api/client/invoker/JSON.java
@@ -102,6 +102,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri
gsonBuilder.registerTypeAdapterFactory(new pl.wtx.symfonia.api.client.model.ContractorCriteriaFilter.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new pl.wtx.symfonia.api.client.model.ContractorListElement.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new pl.wtx.symfonia.api.client.model.Dimension.CustomTypeAdapterFactory());
+ gsonBuilder.registerTypeAdapterFactory(new pl.wtx.symfonia.api.client.model.GetContractors200Response.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new pl.wtx.symfonia.api.client.model.InventoryState.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new pl.wtx.symfonia.api.client.model.LoadedModuleInfo.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new pl.wtx.symfonia.api.client.model.Order.CustomTypeAdapterFactory());
diff --git a/src/main/java/pl/wtx/symfonia/api/client/model/GetContractors200Response.java b/src/main/java/pl/wtx/symfonia/api/client/model/GetContractors200Response.java
new file mode 100644
index 0000000..f5ff06a
--- /dev/null
+++ b/src/main/java/pl/wtx/symfonia/api/client/model/GetContractors200Response.java
@@ -0,0 +1,300 @@
+/*
+ * Symfonia WebAPI
+ * Symfonia WebAPI - specyfikacja wybranych endpointow API systemu ERP Symfonia. Modele danych sa uproszczone i ograniczone do niektorych parametrow (wersja rozwojowa).
+ *
+ * The version of the OpenAPI document: 1.0.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 pl.wtx.symfonia.api.client.model;
+
+import java.util.Objects;
+import com.google.gson.TypeAdapter;
+import com.google.gson.annotations.JsonAdapter;
+import com.google.gson.annotations.SerializedName;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import pl.wtx.symfonia.api.client.model.Contractor;
+import pl.wtx.symfonia.api.client.model.PaymentForm;
+import pl.wtx.symfonia.api.client.model.PaymentRegistry;
+
+
+
+import java.io.IOException;
+import java.lang.reflect.Type;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonParseException;
+import com.google.gson.TypeAdapter;
+import com.google.gson.TypeAdapterFactory;
+import com.google.gson.reflect.TypeToken;
+import com.google.gson.JsonPrimitive;
+import com.google.gson.annotations.JsonAdapter;
+import com.google.gson.annotations.SerializedName;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonParseException;
+
+import pl.wtx.symfonia.api.client.invoker.JSON;
+
+@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0")
+public class GetContractors200Response extends AbstractOpenApiSchema {
+ private static final Logger log = Logger.getLogger(GetContractors200Response.class.getName());
+
+ public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
+ @SuppressWarnings("unchecked")
+ @Override
+ public TypeAdapter create(Gson gson, TypeToken type) {
+ if (!GetContractors200Response.class.isAssignableFrom(type.getRawType())) {
+ return null; // this class only serializes 'GetContractors200Response' and its subtypes
+ }
+ final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
+ final TypeAdapter adapterContractor = gson.getDelegateAdapter(this, TypeToken.get(Contractor.class));
+
+ final Type typeInstanceListContractor = new TypeToken>(){}.getType();
+ final TypeAdapter> adapterListContractor = (TypeAdapter>) gson.getDelegateAdapter(this, TypeToken.get(typeInstanceListContractor));
+
+ return (TypeAdapter) new TypeAdapter() {
+ @Override
+ public void write(JsonWriter out, GetContractors200Response value) throws IOException {
+ if (value == null || value.getActualInstance() == null) {
+ elementAdapter.write(out, null);
+ return;
+ }
+
+ // check if the actual instance is of the type `Contractor`
+ if (value.getActualInstance() instanceof Contractor) {
+ JsonElement element = adapterContractor.toJsonTree((Contractor)value.getActualInstance());
+ elementAdapter.write(out, element);
+ return;
+ }
+ // check if the actual instance is of the type `List`
+ if (value.getActualInstance() instanceof List>) {
+ List> list = (List>) value.getActualInstance();
+ if (!list.isEmpty() && list.get(0) instanceof Contractor) {
+ JsonArray array = adapterListContractor.toJsonTree((List)value.getActualInstance()).getAsJsonArray();
+ elementAdapter.write(out, array);
+ return;
+ }
+ }
+ throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: Contractor, List");
+ }
+
+ @Override
+ public GetContractors200Response read(JsonReader in) throws IOException {
+ Object deserialized = null;
+ JsonElement jsonElement = elementAdapter.read(in);
+
+ int match = 0;
+ ArrayList errorMessages = new ArrayList<>();
+ TypeAdapter actualAdapter = elementAdapter;
+
+ // deserialize Contractor
+ try {
+ // validate the JSON object to see if any exception is thrown
+ Contractor.validateJsonElement(jsonElement);
+ actualAdapter = adapterContractor;
+ match++;
+ log.log(Level.FINER, "Input data matches schema 'Contractor'");
+ } catch (Exception e) {
+ // deserialization failed, continue
+ errorMessages.add(String.format("Deserialization for Contractor failed with `%s`.", e.getMessage()));
+ log.log(Level.FINER, "Input data does not match schema 'Contractor'", e);
+ }
+ // deserialize List
+ try {
+ // validate the JSON object to see if any exception is thrown
+ if (!jsonElement.isJsonArray()) {
+ throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString()));
+ }
+
+ JsonArray array = jsonElement.getAsJsonArray();
+ // validate array items
+ for(JsonElement element : array) {
+ Contractor.validateJsonElement(element);
+ }
+ actualAdapter = adapterListContractor;
+ match++;
+ log.log(Level.FINER, "Input data matches schema 'List'");
+ } catch (Exception e) {
+ // deserialization failed, continue
+ errorMessages.add(String.format("Deserialization for List failed with `%s`.", e.getMessage()));
+ log.log(Level.FINER, "Input data does not match schema 'List'", e);
+ }
+
+ if (match == 1) {
+ GetContractors200Response ret = new GetContractors200Response();
+ ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement));
+ return ret;
+ }
+
+ throw new IOException(String.format("Failed deserialization for GetContractors200Response: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString()));
+ }
+ }.nullSafe();
+ }
+ }
+
+ // store a list of schema names defined in oneOf
+ public static final Map> schemas = new HashMap>();
+
+ public GetContractors200Response() {
+ super("oneOf", Boolean.FALSE);
+ }
+
+ public GetContractors200Response(Object o) {
+ super("oneOf", Boolean.FALSE);
+ setActualInstance(o);
+ }
+
+ static {
+ schemas.put("Contractor", Contractor.class);
+ schemas.put("List", List.class);
+ }
+
+ @Override
+ public Map> getSchemas() {
+ return GetContractors200Response.schemas;
+ }
+
+ /**
+ * Set the instance that matches the oneOf child schema, check
+ * the instance parameter is valid against the oneOf child schemas:
+ * Contractor, List
+ *
+ * It could be an instance of the 'oneOf' schemas.
+ */
+ @Override
+ public void setActualInstance(Object instance) {
+ if (instance instanceof Contractor) {
+ super.setActualInstance(instance);
+ return;
+ }
+
+ if (instance instanceof List>) {
+ List> list = (List>) instance;
+ if (!list.isEmpty() && list.get(0) instanceof Contractor) {
+ super.setActualInstance(instance);
+ return;
+ }
+ }
+
+ throw new RuntimeException("Invalid instance type. Must be Contractor, List");
+ }
+
+ /**
+ * Get the actual instance, which can be the following:
+ * Contractor, List
+ *
+ * @return The actual instance (Contractor, List)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object getActualInstance() {
+ return super.getActualInstance();
+ }
+
+ /**
+ * Get the actual instance of `Contractor`. If the actual instance is not `Contractor`,
+ * the ClassCastException will be thrown.
+ *
+ * @return The actual instance of `Contractor`
+ * @throws ClassCastException if the instance is not `Contractor`
+ */
+ public Contractor getContractor() throws ClassCastException {
+ return (Contractor)super.getActualInstance();
+ }
+
+ /**
+ * Get the actual instance of `List`. If the actual instance is not `List`,
+ * the ClassCastException will be thrown.
+ *
+ * @return The actual instance of `List`
+ * @throws ClassCastException if the instance is not `List`
+ */
+ public List getListContractor() throws ClassCastException {
+ return (List)super.getActualInstance();
+ }
+
+ /**
+ * 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 GetContractors200Response
+ */
+ public static void validateJsonElement(JsonElement jsonElement) throws IOException {
+ // validate oneOf schemas one by one
+ int validCount = 0;
+ ArrayList errorMessages = new ArrayList<>();
+ // validate the json string with Contractor
+ try {
+ Contractor.validateJsonElement(jsonElement);
+ validCount++;
+ } catch (Exception e) {
+ errorMessages.add(String.format("Deserialization for Contractor failed with `%s`.", e.getMessage()));
+ // continue to the next one
+ }
+ // validate the json string with List
+ try {
+ if (!jsonElement.isJsonArray()) {
+ throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString()));
+ }
+ JsonArray array = jsonElement.getAsJsonArray();
+ // validate array items
+ for(JsonElement element : array) {
+ Contractor.validateJsonElement(element);
+ }
+ validCount++;
+ } catch (Exception e) {
+ errorMessages.add(String.format("Deserialization for List failed with `%s`.", e.getMessage()));
+ // continue to the next one
+ }
+ if (validCount != 1) {
+ throw new IOException(String.format("The JSON string is invalid for GetContractors200Response with oneOf schemas: Contractor, List. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString()));
+ }
+ }
+
+ /**
+ * Create an instance of GetContractors200Response given an JSON string
+ *
+ * @param jsonString JSON string
+ * @return An instance of GetContractors200Response
+ * @throws IOException if the JSON string is invalid with respect to GetContractors200Response
+ */
+ public static GetContractors200Response fromJson(String jsonString) throws IOException {
+ return JSON.getGson().fromJson(jsonString, GetContractors200Response.class);
+ }
+
+ /**
+ * Convert an instance of GetContractors200Response to an JSON string
+ *
+ * @return JSON string
+ */
+ public String toJson() {
+ return JSON.getGson().toJson(this);
+ }
+}
+