diff --git a/PricingUnit.java b/PricingUnit.java new file mode 100644 index 00000000..72015da5 --- /dev/null +++ b/PricingUnit.java @@ -0,0 +1,335 @@ +/* + * SaaSus Pricing API Schema + * SaaSus Pricing API Schema + * + * 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 saasus.sdk.pricing.models; + +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.ArrayList; +import java.util.Arrays; +import java.util.List; +import saasus.sdk.pricing.models.AggregateUsage; +import saasus.sdk.pricing.models.Currency; +import saasus.sdk.pricing.models.PricingFixedUnit; +import saasus.sdk.pricing.models.PricingTier; +import saasus.sdk.pricing.models.PricingTieredUnit; +import saasus.sdk.pricing.models.PricingTieredUsageUnit; +import saasus.sdk.pricing.models.PricingUsageUnit; +import saasus.sdk.pricing.models.RecurringInterval; +import saasus.sdk.pricing.models.UnitType; + +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 saasus.sdk.pricing.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-14T05:49:40.753989212Z[Etc/UTC]") +public class PricingUnit extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(PricingUnit.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PricingUnit.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PricingUnit' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterPricingTieredUsageUnit = gson.getDelegateAdapter(this, TypeToken.get(PricingTieredUsageUnit.class)); + final TypeAdapter adapterPricingTieredUnit = gson.getDelegateAdapter(this, TypeToken.get(PricingTieredUnit.class)); + final TypeAdapter adapterPricingUsageUnit = gson.getDelegateAdapter(this, TypeToken.get(PricingUsageUnit.class)); + final TypeAdapter adapterPricingFixedUnit = gson.getDelegateAdapter(this, TypeToken.get(PricingFixedUnit.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PricingUnit value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `PricingTieredUsageUnit` + if (value.getActualInstance() instanceof PricingTieredUsageUnit) { + JsonElement element = adapterPricingTieredUsageUnit.toJsonTree((PricingTieredUsageUnit)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PricingTieredUnit` + if (value.getActualInstance() instanceof PricingTieredUnit) { + JsonElement element = adapterPricingTieredUnit.toJsonTree((PricingTieredUnit)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PricingUsageUnit` + if (value.getActualInstance() instanceof PricingUsageUnit) { + JsonElement element = adapterPricingUsageUnit.toJsonTree((PricingUsageUnit)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PricingFixedUnit` + if (value.getActualInstance() instanceof PricingFixedUnit) { + JsonElement element = adapterPricingFixedUnit.toJsonTree((PricingFixedUnit)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: PricingFixedUnit, PricingTieredUnit, PricingTieredUsageUnit, PricingUsageUnit"); + } + + @Override + public PricingUnit read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + JsonObject jsonObject = jsonElement.getAsJsonObject(); + + // use discriminator value for faster oneOf lookup + PricingUnit newPricingUnit = new PricingUnit(); + if (jsonObject.get("type") == null) { + log.log(Level.WARNING, "Failed to lookup discriminator value for PricingUnit as `type` was not found in the payload or the payload is empty."); + } else { + // look up the discriminator value in the field `type` + switch (jsonObject.get("type").getAsString()) { + case "fixed": + deserialized = adapterPricingFixedUnit.fromJsonTree(jsonObject); + newPricingUnit.setActualInstance(deserialized); + return newPricingUnit; + case "tiered": + deserialized = adapterPricingTieredUnit.fromJsonTree(jsonObject); + newPricingUnit.setActualInstance(deserialized); + return newPricingUnit; + case "tiered_usage": + deserialized = adapterPricingTieredUsageUnit.fromJsonTree(jsonObject); + newPricingUnit.setActualInstance(deserialized); + return newPricingUnit; + case "usage": + deserialized = adapterPricingUsageUnit.fromJsonTree(jsonObject); + newPricingUnit.setActualInstance(deserialized); + return newPricingUnit; + default: + log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for PricingUnit. Possible values: fixed tiered tiered_usage usage", jsonObject.get("type").getAsString())); + } + } + + throw new IOException(String.format("JSON: %s", jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public PricingUnit() { + super("oneOf", Boolean.FALSE); + } + + public PricingUnit(PricingFixedUnit o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public PricingUnit(PricingTieredUnit o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public PricingUnit(PricingTieredUsageUnit o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public PricingUnit(PricingUsageUnit o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("PricingTieredUsageUnit", PricingTieredUsageUnit.class); + schemas.put("PricingTieredUnit", PricingTieredUnit.class); + schemas.put("PricingUsageUnit", PricingUsageUnit.class); + schemas.put("PricingFixedUnit", PricingFixedUnit.class); + } + + @Override + public Map> getSchemas() { + return PricingUnit.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * PricingFixedUnit, PricingTieredUnit, PricingTieredUsageUnit, PricingUsageUnit + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof PricingTieredUsageUnit) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PricingTieredUnit) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PricingUsageUnit) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PricingFixedUnit) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be PricingFixedUnit, PricingTieredUnit, PricingTieredUsageUnit, PricingUsageUnit"); + } + + /** + * Get the actual instance, which can be the following: + * PricingFixedUnit, PricingTieredUnit, PricingTieredUsageUnit, PricingUsageUnit + * + * @return The actual instance (PricingFixedUnit, PricingTieredUnit, PricingTieredUsageUnit, PricingUsageUnit) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `PricingTieredUsageUnit`. If the actual instance is not `PricingTieredUsageUnit`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PricingTieredUsageUnit` + * @throws ClassCastException if the instance is not `PricingTieredUsageUnit` + */ + public PricingTieredUsageUnit getPricingTieredUsageUnit() throws ClassCastException { + return (PricingTieredUsageUnit)super.getActualInstance(); + } + /** + * Get the actual instance of `PricingTieredUnit`. If the actual instance is not `PricingTieredUnit`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PricingTieredUnit` + * @throws ClassCastException if the instance is not `PricingTieredUnit` + */ + public PricingTieredUnit getPricingTieredUnit() throws ClassCastException { + return (PricingTieredUnit)super.getActualInstance(); + } + /** + * Get the actual instance of `PricingUsageUnit`. If the actual instance is not `PricingUsageUnit`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PricingUsageUnit` + * @throws ClassCastException if the instance is not `PricingUsageUnit` + */ + public PricingUsageUnit getPricingUsageUnit() throws ClassCastException { + return (PricingUsageUnit)super.getActualInstance(); + } + /** + * Get the actual instance of `PricingFixedUnit`. If the actual instance is not `PricingFixedUnit`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PricingFixedUnit` + * @throws ClassCastException if the instance is not `PricingFixedUnit` + */ + public PricingFixedUnit getPricingFixedUnit() throws ClassCastException { + return (PricingFixedUnit)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 PricingUnit + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + JsonObject jsonObject = jsonElement.getAsJsonObject(); + + if (jsonObject.get("type") == null) { + throw new IOException("Discriminator field `type` is missing"); + } + + String discriminatorValue = jsonObject.get("type").getAsString(); + switch (discriminatorValue) { + case "fixed": + PricingFixedUnit.validateJsonElement(jsonElement); + break; + case "tiered": + PricingTieredUnit.validateJsonElement(jsonElement); + break; + case "tiered_usage": + PricingTieredUsageUnit.validateJsonElement(jsonElement); + break; + case "usage": + PricingUsageUnit.validateJsonElement(jsonElement); + break; + default: + throw new IOException("Unknown discriminator value: " + discriminatorValue); + } + } + + /** + * Create an instance of PricingUnit given an JSON string + * + * @param jsonString JSON string + * @return An instance of PricingUnit + * @throws IOException if the JSON string is invalid with respect to PricingUnit + */ + public static PricingUnit fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PricingUnit.class); + } + + /** + * Convert an instance of PricingUnit to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/PricingUnitForSave.java b/PricingUnitForSave.java new file mode 100644 index 00000000..6837f4b5 --- /dev/null +++ b/PricingUnitForSave.java @@ -0,0 +1,339 @@ +/* + * SaaSus Pricing API Schema + * SaaSus Pricing API Schema + * + * 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 saasus.sdk.pricing.models; + +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.ArrayList; +import java.util.Arrays; +import java.util.List; +import saasus.sdk.pricing.models.AggregateUsage; +import saasus.sdk.pricing.models.Currency; +import saasus.sdk.pricing.models.PricingFixedUnitForSave; +import saasus.sdk.pricing.models.PricingTier; +import saasus.sdk.pricing.models.PricingTieredUnitForSave; +import saasus.sdk.pricing.models.PricingTieredUsageUnitForSave; +import saasus.sdk.pricing.models.PricingUsageUnitForSave; +import saasus.sdk.pricing.models.RecurringInterval; +import saasus.sdk.pricing.models.UnitType; + + + +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 saasus.sdk.pricing.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-14T05:49:40.753989212Z[Etc/UTC]") +public class PricingUnitForSave extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(PricingUnitForSave.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PricingUnitForSave.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PricingUnitForSave' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterPricingTieredUsageUnitForSave = gson.getDelegateAdapter(this, TypeToken.get(PricingTieredUsageUnitForSave.class)); + final TypeAdapter adapterPricingTieredUnitForSave = gson.getDelegateAdapter(this, TypeToken.get(PricingTieredUnitForSave.class)); + final TypeAdapter adapterPricingUsageUnitForSave = gson.getDelegateAdapter(this, TypeToken.get(PricingUsageUnitForSave.class)); + final TypeAdapter adapterPricingFixedUnitForSave = gson.getDelegateAdapter(this, TypeToken.get(PricingFixedUnitForSave.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PricingUnitForSave value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `PricingTieredUsageUnitForSave` + if (value.getActualInstance() instanceof PricingTieredUsageUnitForSave) { + JsonElement element = adapterPricingTieredUsageUnitForSave.toJsonTree((PricingTieredUsageUnitForSave)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PricingTieredUnitForSave` + if (value.getActualInstance() instanceof PricingTieredUnitForSave) { + JsonElement element = adapterPricingTieredUnitForSave.toJsonTree((PricingTieredUnitForSave)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PricingUsageUnitForSave` + if (value.getActualInstance() instanceof PricingUsageUnitForSave) { + JsonElement element = adapterPricingUsageUnitForSave.toJsonTree((PricingUsageUnitForSave)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PricingFixedUnitForSave` + if (value.getActualInstance() instanceof PricingFixedUnitForSave) { + JsonElement element = adapterPricingFixedUnitForSave.toJsonTree((PricingFixedUnitForSave)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: PricingFixedUnitForSave, PricingTieredUnitForSave, PricingTieredUsageUnitForSave, PricingUsageUnitForSave"); + } + + @Override + public PricingUnitForSave read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + JsonObject jsonObject = jsonElement.getAsJsonObject(); + + // use discriminator value for faster oneOf lookup + PricingUnitForSave newPricingUnitForSave = new PricingUnitForSave(); + if (jsonObject.get("type") == null) { + log.log(Level.WARNING, "Failed to lookup discriminator value for PricingUnitForSave as `type` was not found in the payload or the payload is empty."); + } else { + // look up the discriminator value in the field `type` + switch (jsonObject.get("type").getAsString()) { + case "fixed": + deserialized = adapterPricingFixedUnitForSave.fromJsonTree(jsonObject); + newPricingUnitForSave.setActualInstance(deserialized); + return newPricingUnitForSave; + case "tiered": + deserialized = adapterPricingTieredUnitForSave.fromJsonTree(jsonObject); + newPricingUnitForSave.setActualInstance(deserialized); + return newPricingUnitForSave; + case "tiered_usage": + deserialized = adapterPricingTieredUsageUnitForSave.fromJsonTree(jsonObject); + newPricingUnitForSave.setActualInstance(deserialized); + return newPricingUnitForSave; + case "usage": + deserialized = adapterPricingUsageUnitForSave.fromJsonTree(jsonObject); + newPricingUnitForSave.setActualInstance(deserialized); + return newPricingUnitForSave; + default: + log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for PricingUnitForSave. Possible values: fixed tiered tiered_usage usage", jsonObject.get("type").getAsString())); + } + } + + throw new IOException(String.format("JSON: %s", jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public PricingUnitForSave() { + super("oneOf", Boolean.FALSE); + } + + public PricingUnitForSave(PricingFixedUnitForSave o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public PricingUnitForSave(PricingTieredUnitForSave o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public PricingUnitForSave(PricingTieredUsageUnitForSave o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public PricingUnitForSave(PricingUsageUnitForSave o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("PricingTieredUsageUnitForSave", PricingTieredUsageUnitForSave.class); + schemas.put("PricingTieredUnitForSave", PricingTieredUnitForSave.class); + schemas.put("PricingUsageUnitForSave", PricingUsageUnitForSave.class); + schemas.put("PricingFixedUnitForSave", PricingFixedUnitForSave.class); + } + + @Override + public Map> getSchemas() { + return PricingUnitForSave.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * PricingFixedUnitForSave, PricingTieredUnitForSave, PricingTieredUsageUnitForSave, PricingUsageUnitForSave + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof PricingTieredUsageUnitForSave) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PricingTieredUnitForSave) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PricingUsageUnitForSave) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PricingFixedUnitForSave) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be PricingFixedUnitForSave, PricingTieredUnitForSave, PricingTieredUsageUnitForSave, PricingUsageUnitForSave"); + } + + /** + * Get the actual instance, which can be the following: + * PricingFixedUnitForSave, PricingTieredUnitForSave, PricingTieredUsageUnitForSave, PricingUsageUnitForSave + * + * @return The actual instance (PricingFixedUnitForSave, PricingTieredUnitForSave, PricingTieredUsageUnitForSave, PricingUsageUnitForSave) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `PricingTieredUsageUnitForSave`. If the actual instance is not `PricingTieredUsageUnitForSave`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PricingTieredUsageUnitForSave` + * @throws ClassCastException if the instance is not `PricingTieredUsageUnitForSave` + */ + public PricingTieredUsageUnitForSave getPricingTieredUsageUnitForSave() throws ClassCastException { + return (PricingTieredUsageUnitForSave)super.getActualInstance(); + } + /** + * Get the actual instance of `PricingTieredUnitForSave`. If the actual instance is not `PricingTieredUnitForSave`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PricingTieredUnitForSave` + * @throws ClassCastException if the instance is not `PricingTieredUnitForSave` + */ + public PricingTieredUnitForSave getPricingTieredUnitForSave() throws ClassCastException { + return (PricingTieredUnitForSave)super.getActualInstance(); + } + /** + * Get the actual instance of `PricingUsageUnitForSave`. If the actual instance is not `PricingUsageUnitForSave`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PricingUsageUnitForSave` + * @throws ClassCastException if the instance is not `PricingUsageUnitForSave` + */ + public PricingUsageUnitForSave getPricingUsageUnitForSave() throws ClassCastException { + return (PricingUsageUnitForSave)super.getActualInstance(); + } + /** + * Get the actual instance of `PricingFixedUnitForSave`. If the actual instance is not `PricingFixedUnitForSave`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PricingFixedUnitForSave` + * @throws ClassCastException if the instance is not `PricingFixedUnitForSave` + */ + public PricingFixedUnitForSave getPricingFixedUnitForSave() throws ClassCastException { + return (PricingFixedUnitForSave)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 PricingUnitForSave + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + JsonObject jsonObject = jsonElement.getAsJsonObject(); + + if (jsonObject.get("type") == null) { + throw new IOException("Discriminator field `type` is missing"); + } + + String discriminatorValue = jsonObject.get("type").getAsString(); + switch (discriminatorValue) { + case "fixed": + PricingFixedUnitForSave.validateJsonElement(jsonElement); + break; + case "tiered": + PricingTieredUnitForSave.validateJsonElement(jsonElement); + break; + case "tiered_usage": + PricingTieredUsageUnitForSave.validateJsonElement(jsonElement); + break; + case "usage": + PricingUsageUnitForSave.validateJsonElement(jsonElement); + break; + default: + throw new IOException("Unknown discriminator value: " + discriminatorValue); + } + } + + /** + * Create an instance of PricingUnitForSave given an JSON string + * + * @param jsonString JSON string + * @return An instance of PricingUnitForSave + * @throws IOException if the JSON string is invalid with respect to PricingUnitForSave + */ + public static PricingUnitForSave fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PricingUnitForSave.class); + } + + /** + * Convert an instance of PricingUnitForSave to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/docs/auth/SaasUser.md b/docs/auth/SaasUser.md index 51f4c3da..6874ba38 100644 --- a/docs/auth/SaasUser.md +++ b/docs/auth/SaasUser.md @@ -9,6 +9,7 @@ |------------ | ------------- | ------------- | -------------| |**id** | **String** | | | |**email** | **String** | E-mail | | +|**attributes** | **Map<String, Object>** | Attribute information | | diff --git a/docs/auth/SaasUserApi.md b/docs/auth/SaasUserApi.md index 50f25995..3ffded18 100644 --- a/docs/auth/SaasUserApi.md +++ b/docs/auth/SaasUserApi.md @@ -20,6 +20,7 @@ All URIs are relative to *https://api.saasus.io/v1/auth* | [**signUp**](SaasUserApi.md#signUp) | **POST** /sign-up | Sign Up | | [**signUpWithAwsMarketplace**](SaasUserApi.md#signUpWithAwsMarketplace) | **POST** /aws-marketplace/sign-up | Sign Up with AWS Marketplace | | [**unlinkProvider**](SaasUserApi.md#unlinkProvider) | **DELETE** /users/{user_id}/providers/{provider_name} | Unlink external identity providers | +| [**updateSaasUserAttributes**](SaasUserApi.md#updateSaasUserAttributes) | **PATCH** /users/{user_id}/attributes | Update SaaS User Attributes | | [**updateSaasUserEmail**](SaasUserApi.md#updateSaasUserEmail) | **PATCH** /users/{user_id}/email | Change Email | | [**updateSaasUserPassword**](SaasUserApi.md#updateSaasUserPassword) | **PATCH** /users/{user_id}/password | Change Password | | [**updateSoftwareToken**](SaasUserApi.md#updateSoftwareToken) | **PUT** /users/{user_id}/mfa/software-token | Register Authentication Application | @@ -1115,6 +1116,75 @@ null (empty response body) | **200** | OK | - | | **500** | Internal Server Error | - | + +# **updateSaasUserAttributes** +> updateSaasUserAttributes(userId, updateSaasUserAttributesParam) + +Update SaaS User Attributes + +Update the additional attributes of the SaaS user. + +### Example +```java +// Import classes: +import saasus.sdk.auth.ApiClient; +import saasus.sdk.auth.ApiException; +import saasus.sdk.auth.Configuration; +import saasus.sdk.auth.auth.*; +import saasus.sdk.auth.models.*; +import saasus.sdk.auth.api.SaasUserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.saasus.io/v1/auth"); + + // Configure HTTP bearer authorization: Bearer + HttpBearerAuth Bearer = (HttpBearerAuth) defaultClient.getAuthentication("Bearer"); + Bearer.setBearerToken("BEARER TOKEN"); + + SaasUserApi apiInstance = new SaasUserApi(defaultClient); + String userId = "f94bfffc-8be2-11ec-b41a-0242ac120004"; // String | User ID + UpdateSaasUserAttributesParam updateSaasUserAttributesParam = new UpdateSaasUserAttributesParam(); // UpdateSaasUserAttributesParam | + try { + apiInstance.updateSaasUserAttributes(userId, updateSaasUserAttributesParam); + } catch (ApiException e) { + System.err.println("Exception when calling SaasUserApi#updateSaasUserAttributes"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **userId** | **String**| User ID | | +| **updateSaasUserAttributesParam** | [**UpdateSaasUserAttributesParam**](UpdateSaasUserAttributesParam.md)| | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **500** | Internal Server Error | - | + # **updateSaasUserEmail** > updateSaasUserEmail(userId, updateSaasUserEmailParam) diff --git a/docs/auth/UpdateSaasUserAttributesParam.md b/docs/auth/UpdateSaasUserAttributesParam.md new file mode 100644 index 00000000..af7896f9 --- /dev/null +++ b/docs/auth/UpdateSaasUserAttributesParam.md @@ -0,0 +1,13 @@ + + +# UpdateSaasUserAttributesParam + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**attributes** | **Map<String, Object>** | Attribute information | | + + + diff --git a/docs/auth/UserAttributeApi.md b/docs/auth/UserAttributeApi.md index 2448998a..8c9ffbd1 100644 --- a/docs/auth/UserAttributeApi.md +++ b/docs/auth/UserAttributeApi.md @@ -4,18 +4,87 @@ All URIs are relative to *https://api.saasus.io/v1/auth* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**createSaasUserAttribute**](UserAttributeApi.md#createSaasUserAttribute) | **POST** /saas-user-attributes | Create SaaS User Attributes | | [**createUserAttribute**](UserAttributeApi.md#createUserAttribute) | **POST** /user-attributes | Create User Attributes | | [**deleteUserAttribute**](UserAttributeApi.md#deleteUserAttribute) | **DELETE** /user-attributes/{attribute_name} | Delete User Attribute | | [**getUserAttributes**](UserAttributeApi.md#getUserAttributes) | **GET** /user-attributes | Get User Attributes | + +# **createSaasUserAttribute** +> Attribute createSaasUserAttribute(body) + +Create SaaS User Attributes + +Create additional SaaS user attributes to be kept on the SaaSus Platform. You can give common values to all tenants. + +### Example +```java +// Import classes: +import saasus.sdk.auth.ApiClient; +import saasus.sdk.auth.ApiException; +import saasus.sdk.auth.Configuration; +import saasus.sdk.auth.auth.*; +import saasus.sdk.auth.models.*; +import saasus.sdk.auth.api.UserAttributeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.saasus.io/v1/auth"); + + // Configure HTTP bearer authorization: Bearer + HttpBearerAuth Bearer = (HttpBearerAuth) defaultClient.getAuthentication("Bearer"); + Bearer.setBearerToken("BEARER TOKEN"); + + UserAttributeApi apiInstance = new UserAttributeApi(defaultClient); + Attribute body = new Attribute(); // Attribute | + try { + Attribute result = apiInstance.createSaasUserAttribute(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserAttributeApi#createSaasUserAttribute"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **body** | **Attribute**| | [optional] | + +### Return type + +[**Attribute**](Attribute.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **500** | Internal Server Error | - | + # **createUserAttribute** > Attribute createUserAttribute(body) Create User Attributes -Create additional user attributes to be kept on the SaaSus Platform. For example, you can define items associated with a user, such as user name, birthday, etc. If you don't want personal information on the SaaS Platform side, personal information can be kept on the SaaS side without user attribute definition. +Create additional user attributes to be kept on the SaaSus Platform. You can give different values to each tenant. For example, you can define items associated with a user, such as user name, birthday, etc. If you don't want personal information on the SaaS Platform side, personal information can be kept on the SaaS side without user attribute definition. ### Example ```java diff --git a/docs/auth/UserInfo.md b/docs/auth/UserInfo.md index a45de84c..257903cd 100644 --- a/docs/auth/UserInfo.md +++ b/docs/auth/UserInfo.md @@ -9,6 +9,7 @@ |------------ | ------------- | ------------- | -------------| |**id** | **String** | | | |**email** | **String** | E-mail | | +|**userAttribute** | **Map<String, Object>** | user additional attributes | | |**tenants** | [**List<UserAvailableTenant>**](UserAvailableTenant.md) | Tenant Info | | diff --git a/generate.sh b/generate.sh index 4a6d7a85..6d8797b2 100755 --- a/generate.sh +++ b/generate.sh @@ -47,7 +47,7 @@ do -g java \ --additional-properties=modelPackage=saasus.sdk.${module}.models,apiPackage=saasus.sdk.${module}.api \ -o /local/generated/${module} \ - --additional-properties useOneOfDiscriminatorLookup=true + --additional-properties useOneOfDiscriminatorLookup=true,disallowAdditionalPropertiesIfNotPresent=false done for module in ${MODULES} @@ -61,6 +61,10 @@ do echo "copy ${module} success" done +# discriminatorの判定でエラーになるため、上書きする +cp -p PricingUnit.java ${SDK_SRC_DIR}/pricing/models/PricingUnit.java +cp -p PricingUnitForSave.java ${SDK_SRC_DIR}/pricing/models/PricingUnitForSave.java + # 生成したプログラムを削除 rm -rf ./generated echo "delete generated success" diff --git a/src/main/java/saasus/sdk/apilog/ApiException.java b/src/main/java/saasus/sdk/apilog/ApiException.java index 7c83f719..a4df530c 100644 --- a/src/main/java/saasus/sdk/apilog/ApiException.java +++ b/src/main/java/saasus/sdk/apilog/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:58.737628856Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:39.829344008Z[Etc/UTC]") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/src/main/java/saasus/sdk/apilog/Configuration.java b/src/main/java/saasus/sdk/apilog/Configuration.java index 2f520aa9..f36ee5ef 100644 --- a/src/main/java/saasus/sdk/apilog/Configuration.java +++ b/src/main/java/saasus/sdk/apilog/Configuration.java @@ -13,7 +13,7 @@ package saasus.sdk.apilog; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:58.737628856Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:39.829344008Z[Etc/UTC]") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/src/main/java/saasus/sdk/apilog/Pair.java b/src/main/java/saasus/sdk/apilog/Pair.java index cadfe377..59c68ee5 100644 --- a/src/main/java/saasus/sdk/apilog/Pair.java +++ b/src/main/java/saasus/sdk/apilog/Pair.java @@ -13,7 +13,7 @@ package saasus.sdk.apilog; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:58.737628856Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:39.829344008Z[Etc/UTC]") public class Pair { private String name = ""; private String value = ""; diff --git a/src/main/java/saasus/sdk/apilog/StringUtil.java b/src/main/java/saasus/sdk/apilog/StringUtil.java index 1c52b4aa..36c8c855 100644 --- a/src/main/java/saasus/sdk/apilog/StringUtil.java +++ b/src/main/java/saasus/sdk/apilog/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:58.737628856Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:39.829344008Z[Etc/UTC]") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/src/main/java/saasus/sdk/apilog/auth/ApiKeyAuth.java b/src/main/java/saasus/sdk/apilog/auth/ApiKeyAuth.java index b5f17dc5..64a5c336 100644 --- a/src/main/java/saasus/sdk/apilog/auth/ApiKeyAuth.java +++ b/src/main/java/saasus/sdk/apilog/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:58.737628856Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:39.829344008Z[Etc/UTC]") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/src/main/java/saasus/sdk/apilog/auth/HttpBearerAuth.java b/src/main/java/saasus/sdk/apilog/auth/HttpBearerAuth.java index b28e99c2..9742f5d2 100644 --- a/src/main/java/saasus/sdk/apilog/auth/HttpBearerAuth.java +++ b/src/main/java/saasus/sdk/apilog/auth/HttpBearerAuth.java @@ -22,7 +22,7 @@ import java.util.Optional; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:58.737628856Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:39.829344008Z[Etc/UTC]") public class HttpBearerAuth implements Authentication { private final String scheme; private Supplier tokenSupplier; diff --git a/src/main/java/saasus/sdk/apilog/models/AbstractOpenApiSchema.java b/src/main/java/saasus/sdk/apilog/models/AbstractOpenApiSchema.java index e845b459..3d95d15d 100644 --- a/src/main/java/saasus/sdk/apilog/models/AbstractOpenApiSchema.java +++ b/src/main/java/saasus/sdk/apilog/models/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:58.737628856Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:39.829344008Z[Etc/UTC]") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/src/main/java/saasus/sdk/apilog/models/ApiLog.java b/src/main/java/saasus/sdk/apilog/models/ApiLog.java index 2730df6b..7c18eb88 100644 --- a/src/main/java/saasus/sdk/apilog/models/ApiLog.java +++ b/src/main/java/saasus/sdk/apilog/models/ApiLog.java @@ -49,7 +49,7 @@ /** * ApiLog */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:58.737628856Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:39.829344008Z[Etc/UTC]") public class ApiLog { public static final String SERIALIZED_NAME_TRACE_ID = "trace_id"; @SerializedName(SERIALIZED_NAME_TRACE_ID) @@ -375,6 +375,50 @@ public void setResponseBody(String responseBody) { this.responseBody = responseBody; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ApiLog instance itself + */ + public ApiLog putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -399,12 +443,13 @@ public boolean equals(Object o) { Objects.equals(this.remoteAddress, apiLog.remoteAddress) && Objects.equals(this.referer, apiLog.referer) && Objects.equals(this.requestBody, apiLog.requestBody) && - Objects.equals(this.responseBody, apiLog.responseBody); + Objects.equals(this.responseBody, apiLog.responseBody)&& + Objects.equals(this.additionalProperties, apiLog.additionalProperties); } @Override public int hashCode() { - return Objects.hash(traceId, apiLogId, createdAt, createdDate, ttl, requestMethod, saasId, apiKey, responseStatus, requestUri, remoteAddress, referer, requestBody, responseBody); + return Objects.hash(traceId, apiLogId, createdAt, createdDate, ttl, requestMethod, saasId, apiKey, responseStatus, requestUri, remoteAddress, referer, requestBody, responseBody, additionalProperties); } @Override @@ -425,6 +470,7 @@ public String toString() { sb.append(" referer: ").append(toIndentedString(referer)).append("\n"); sb.append(" requestBody: ").append(toIndentedString(requestBody)).append("\n"); sb.append(" responseBody: ").append(toIndentedString(responseBody)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -493,14 +539,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ApiLog.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApiLog` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : ApiLog.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -561,6 +599,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ApiLog value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -568,7 +623,28 @@ public void write(JsonWriter out, ApiLog value) throws IOException { public ApiLog read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ApiLog instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/apilog/models/ApiLogs.java b/src/main/java/saasus/sdk/apilog/models/ApiLogs.java index bbc3e5bc..bc526a4d 100644 --- a/src/main/java/saasus/sdk/apilog/models/ApiLogs.java +++ b/src/main/java/saasus/sdk/apilog/models/ApiLogs.java @@ -52,7 +52,7 @@ /** * ApiLogs */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:58.737628856Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:39.829344008Z[Etc/UTC]") public class ApiLogs { public static final String SERIALIZED_NAME_API_LOGS = "api_logs"; @SerializedName(SERIALIZED_NAME_API_LOGS) @@ -110,6 +110,50 @@ public void setCursor(String cursor) { this.cursor = cursor; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ApiLogs instance itself + */ + public ApiLogs putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -122,12 +166,13 @@ public boolean equals(Object o) { } ApiLogs apiLogs = (ApiLogs) o; return Objects.equals(this.apiLogs, apiLogs.apiLogs) && - Objects.equals(this.cursor, apiLogs.cursor); + Objects.equals(this.cursor, apiLogs.cursor)&& + Objects.equals(this.additionalProperties, apiLogs.additionalProperties); } @Override public int hashCode() { - return Objects.hash(apiLogs, cursor); + return Objects.hash(apiLogs, cursor, additionalProperties); } @Override @@ -136,6 +181,7 @@ public String toString() { sb.append("class ApiLogs {\n"); sb.append(" apiLogs: ").append(toIndentedString(apiLogs)).append("\n"); sb.append(" cursor: ").append(toIndentedString(cursor)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -179,14 +225,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ApiLogs.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApiLogs` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : ApiLogs.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -224,6 +262,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ApiLogs value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -231,7 +286,28 @@ public void write(JsonWriter out, ApiLogs value) throws IOException { public ApiLogs read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ApiLogs instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/apilog/models/Error.java b/src/main/java/saasus/sdk/apilog/models/Error.java index 8c13df80..4017ba22 100644 --- a/src/main/java/saasus/sdk/apilog/models/Error.java +++ b/src/main/java/saasus/sdk/apilog/models/Error.java @@ -49,7 +49,7 @@ /** * Error */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:58.737628856Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:39.829344008Z[Etc/UTC]") public class Error { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @@ -99,6 +99,50 @@ public void setMessage(String message) { this.message = message; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Error instance itself + */ + public Error putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } Error error = (Error) o; return Objects.equals(this.type, error.type) && - Objects.equals(this.message, error.message); + Objects.equals(this.message, error.message)&& + Objects.equals(this.additionalProperties, error.additionalProperties); } @Override public int hashCode() { - return Objects.hash(type, message); + return Objects.hash(type, message, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class Error {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Error.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Error` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Error.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Error value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, Error value) throws IOException { public Error read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Error instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/ApiException.java b/src/main/java/saasus/sdk/auth/ApiException.java index a0bbc6a8..707ed45e 100644 --- a/src/main/java/saasus/sdk/auth/ApiException.java +++ b/src/main/java/saasus/sdk/auth/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/src/main/java/saasus/sdk/auth/Configuration.java b/src/main/java/saasus/sdk/auth/Configuration.java index f8d88c54..3b9f6ccb 100644 --- a/src/main/java/saasus/sdk/auth/Configuration.java +++ b/src/main/java/saasus/sdk/auth/Configuration.java @@ -13,7 +13,7 @@ package saasus.sdk.auth; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/src/main/java/saasus/sdk/auth/JSON.java b/src/main/java/saasus/sdk/auth/JSON.java index 9bf12c36..cafc96c8 100644 --- a/src/main/java/saasus/sdk/auth/JSON.java +++ b/src/main/java/saasus/sdk/auth/JSON.java @@ -167,6 +167,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new saasus.sdk.auth.models.UpdateEnvParam.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new saasus.sdk.auth.models.UpdateIdentityProviderParam.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new saasus.sdk.auth.models.UpdateNotificationMessagesParam.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new saasus.sdk.auth.models.UpdateSaasUserAttributesParam.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new saasus.sdk.auth.models.UpdateSaasUserEmailParam.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new saasus.sdk.auth.models.UpdateSaasUserPasswordParam.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new saasus.sdk.auth.models.UpdateSignInSettingsParam.CustomTypeAdapterFactory()); diff --git a/src/main/java/saasus/sdk/auth/Pair.java b/src/main/java/saasus/sdk/auth/Pair.java index 9f2528d0..c7a6499c 100644 --- a/src/main/java/saasus/sdk/auth/Pair.java +++ b/src/main/java/saasus/sdk/auth/Pair.java @@ -13,7 +13,7 @@ package saasus.sdk.auth; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class Pair { private String name = ""; private String value = ""; diff --git a/src/main/java/saasus/sdk/auth/StringUtil.java b/src/main/java/saasus/sdk/auth/StringUtil.java index fd27ee18..f9040380 100644 --- a/src/main/java/saasus/sdk/auth/StringUtil.java +++ b/src/main/java/saasus/sdk/auth/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/src/main/java/saasus/sdk/auth/api/SaasUserApi.java b/src/main/java/saasus/sdk/auth/api/SaasUserApi.java index d9739f6e..c4df417c 100644 --- a/src/main/java/saasus/sdk/auth/api/SaasUserApi.java +++ b/src/main/java/saasus/sdk/auth/api/SaasUserApi.java @@ -44,6 +44,7 @@ import saasus.sdk.auth.models.SignUpWithAwsMarketplaceParam; import saasus.sdk.auth.models.SoftwareTokenSecretCode; import saasus.sdk.auth.models.Tenant; +import saasus.sdk.auth.models.UpdateSaasUserAttributesParam; import saasus.sdk.auth.models.UpdateSaasUserEmailParam; import saasus.sdk.auth.models.UpdateSaasUserPasswordParam; import saasus.sdk.auth.models.UpdateSoftwareTokenParam; @@ -2086,6 +2087,134 @@ public okhttp3.Call unlinkProviderAsync(String providerName, String userId, fina localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } + /** + * Build call for updateSaasUserAttributes + * @param userId User ID (required) + * @param updateSaasUserAttributesParam (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 OK -
500 Internal Server Error -
+ */ + public okhttp3.Call updateSaasUserAttributesCall(String userId, UpdateSaasUserAttributesParam updateSaasUserAttributesParam, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateSaasUserAttributesParam; + + // create path and map variables + String localVarPath = "/users/{user_id}/attributes" + .replace("{" + "user_id" + "}", localVarApiClient.escapeString(userId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Bearer" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateSaasUserAttributesValidateBeforeCall(String userId, UpdateSaasUserAttributesParam updateSaasUserAttributesParam, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling updateSaasUserAttributes(Async)"); + } + + return updateSaasUserAttributesCall(userId, updateSaasUserAttributesParam, _callback); + + } + + /** + * Update SaaS User Attributes + * Update the additional attributes of the SaaS user. + * @param userId User ID (required) + * @param updateSaasUserAttributesParam (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 OK -
500 Internal Server Error -
+ */ + public void updateSaasUserAttributes(String userId, UpdateSaasUserAttributesParam updateSaasUserAttributesParam) throws ApiException { + updateSaasUserAttributesWithHttpInfo(userId, updateSaasUserAttributesParam); + } + + /** + * Update SaaS User Attributes + * Update the additional attributes of the SaaS user. + * @param userId User ID (required) + * @param updateSaasUserAttributesParam (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 OK -
500 Internal Server Error -
+ */ + public ApiResponse updateSaasUserAttributesWithHttpInfo(String userId, UpdateSaasUserAttributesParam updateSaasUserAttributesParam) throws ApiException { + okhttp3.Call localVarCall = updateSaasUserAttributesValidateBeforeCall(userId, updateSaasUserAttributesParam, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update SaaS User Attributes (asynchronously) + * Update the additional attributes of the SaaS user. + * @param userId User ID (required) + * @param updateSaasUserAttributesParam (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 OK -
500 Internal Server Error -
+ */ + public okhttp3.Call updateSaasUserAttributesAsync(String userId, UpdateSaasUserAttributesParam updateSaasUserAttributesParam, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateSaasUserAttributesValidateBeforeCall(userId, updateSaasUserAttributesParam, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } /** * Build call for updateSaasUserEmail * @param userId User ID (required) diff --git a/src/main/java/saasus/sdk/auth/api/UserAttributeApi.java b/src/main/java/saasus/sdk/auth/api/UserAttributeApi.java index 97521dc0..52def2a4 100644 --- a/src/main/java/saasus/sdk/auth/api/UserAttributeApi.java +++ b/src/main/java/saasus/sdk/auth/api/UserAttributeApi.java @@ -74,6 +74,128 @@ public void setCustomBaseUrl(String customBaseUrl) { this.localCustomBaseUrl = customBaseUrl; } + /** + * Build call for createSaasUserAttribute + * @param body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
201 Created -
500 Internal Server Error -
+ */ + public okhttp3.Call createSaasUserAttributeCall(Attribute body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/saas-user-attributes"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Bearer" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createSaasUserAttributeValidateBeforeCall(Attribute body, final ApiCallback _callback) throws ApiException { + return createSaasUserAttributeCall(body, _callback); + + } + + /** + * Create SaaS User Attributes + * Create additional SaaS user attributes to be kept on the SaaSus Platform. You can give common values to all tenants. + * @param body (optional) + * @return Attribute + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
201 Created -
500 Internal Server Error -
+ */ + public Attribute createSaasUserAttribute(Attribute body) throws ApiException { + ApiResponse localVarResp = createSaasUserAttributeWithHttpInfo(body); + return localVarResp.getData(); + } + + /** + * Create SaaS User Attributes + * Create additional SaaS user attributes to be kept on the SaaSus Platform. You can give common values to all tenants. + * @param body (optional) + * @return ApiResponse<Attribute> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
201 Created -
500 Internal Server Error -
+ */ + public ApiResponse createSaasUserAttributeWithHttpInfo(Attribute body) throws ApiException { + okhttp3.Call localVarCall = createSaasUserAttributeValidateBeforeCall(body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create SaaS User Attributes (asynchronously) + * Create additional SaaS user attributes to be kept on the SaaSus Platform. You can give common values to all tenants. + * @param body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
201 Created -
500 Internal Server Error -
+ */ + public okhttp3.Call createSaasUserAttributeAsync(Attribute body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createSaasUserAttributeValidateBeforeCall(body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for createUserAttribute * @param body (optional) @@ -140,7 +262,7 @@ private okhttp3.Call createUserAttributeValidateBeforeCall(Attribute body, final /** * Create User Attributes - * Create additional user attributes to be kept on the SaaSus Platform. For example, you can define items associated with a user, such as user name, birthday, etc. If you don't want personal information on the SaaS Platform side, personal information can be kept on the SaaS side without user attribute definition. + * Create additional user attributes to be kept on the SaaSus Platform. You can give different values to each tenant. For example, you can define items associated with a user, such as user name, birthday, etc. If you don't want personal information on the SaaS Platform side, personal information can be kept on the SaaS side without user attribute definition. * @param body (optional) * @return Attribute * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -158,7 +280,7 @@ public Attribute createUserAttribute(Attribute body) throws ApiException { /** * Create User Attributes - * Create additional user attributes to be kept on the SaaSus Platform. For example, you can define items associated with a user, such as user name, birthday, etc. If you don't want personal information on the SaaS Platform side, personal information can be kept on the SaaS side without user attribute definition. + * Create additional user attributes to be kept on the SaaSus Platform. You can give different values to each tenant. For example, you can define items associated with a user, such as user name, birthday, etc. If you don't want personal information on the SaaS Platform side, personal information can be kept on the SaaS side without user attribute definition. * @param body (optional) * @return ApiResponse<Attribute> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -177,7 +299,7 @@ public ApiResponse createUserAttributeWithHttpInfo(Attribute body) th /** * Create User Attributes (asynchronously) - * Create additional user attributes to be kept on the SaaSus Platform. For example, you can define items associated with a user, such as user name, birthday, etc. If you don't want personal information on the SaaS Platform side, personal information can be kept on the SaaS side without user attribute definition. + * Create additional user attributes to be kept on the SaaSus Platform. You can give different values to each tenant. For example, you can define items associated with a user, such as user name, birthday, etc. If you don't want personal information on the SaaS Platform side, personal information can be kept on the SaaS side without user attribute definition. * @param body (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call diff --git a/src/main/java/saasus/sdk/auth/auth/ApiKeyAuth.java b/src/main/java/saasus/sdk/auth/auth/ApiKeyAuth.java index 19e21ed7..3d261d70 100644 --- a/src/main/java/saasus/sdk/auth/auth/ApiKeyAuth.java +++ b/src/main/java/saasus/sdk/auth/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/src/main/java/saasus/sdk/auth/auth/HttpBearerAuth.java b/src/main/java/saasus/sdk/auth/auth/HttpBearerAuth.java index 514a0c81..a13bbd34 100644 --- a/src/main/java/saasus/sdk/auth/auth/HttpBearerAuth.java +++ b/src/main/java/saasus/sdk/auth/auth/HttpBearerAuth.java @@ -22,7 +22,7 @@ import java.util.Optional; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class HttpBearerAuth implements Authentication { private final String scheme; private Supplier tokenSupplier; diff --git a/src/main/java/saasus/sdk/auth/models/AbstractOpenApiSchema.java b/src/main/java/saasus/sdk/auth/models/AbstractOpenApiSchema.java index e7188a53..16b021a4 100644 --- a/src/main/java/saasus/sdk/auth/models/AbstractOpenApiSchema.java +++ b/src/main/java/saasus/sdk/auth/models/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/src/main/java/saasus/sdk/auth/models/AccountVerification.java b/src/main/java/saasus/sdk/auth/models/AccountVerification.java index 74093d50..d6fc76b7 100644 --- a/src/main/java/saasus/sdk/auth/models/AccountVerification.java +++ b/src/main/java/saasus/sdk/auth/models/AccountVerification.java @@ -49,7 +49,7 @@ /** * Account authentication settings ※ This function is not yet provided, so it cannot be changed or saved. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class AccountVerification { /** * code: verification code link: verification link ※ This function is not yet provided, so it cannot be changed or saved. @@ -205,6 +205,50 @@ public void setSendingTo(SendingToEnum sendingTo) { this.sendingTo = sendingTo; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AccountVerification instance itself + */ + public AccountVerification putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -217,12 +261,13 @@ public boolean equals(Object o) { } AccountVerification accountVerification = (AccountVerification) o; return Objects.equals(this.verificationMethod, accountVerification.verificationMethod) && - Objects.equals(this.sendingTo, accountVerification.sendingTo); + Objects.equals(this.sendingTo, accountVerification.sendingTo)&& + Objects.equals(this.additionalProperties, accountVerification.additionalProperties); } @Override public int hashCode() { - return Objects.hash(verificationMethod, sendingTo); + return Objects.hash(verificationMethod, sendingTo, additionalProperties); } @Override @@ -231,6 +276,7 @@ public String toString() { sb.append("class AccountVerification {\n"); sb.append(" verificationMethod: ").append(toIndentedString(verificationMethod)).append("\n"); sb.append(" sendingTo: ").append(toIndentedString(sendingTo)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -275,14 +321,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!AccountVerification.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AccountVerification` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : AccountVerification.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -317,6 +355,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, AccountVerification value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -324,7 +379,28 @@ public void write(JsonWriter out, AccountVerification value) throws IOException public AccountVerification read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AccountVerification instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/ApiKeys.java b/src/main/java/saasus/sdk/auth/models/ApiKeys.java index b17b2a0b..94c40972 100644 --- a/src/main/java/saasus/sdk/auth/models/ApiKeys.java +++ b/src/main/java/saasus/sdk/auth/models/ApiKeys.java @@ -51,7 +51,7 @@ /** * ApiKeys */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class ApiKeys { public static final String SERIALIZED_NAME_API_KEYS = "api_keys"; @SerializedName(SERIALIZED_NAME_API_KEYS) @@ -86,6 +86,50 @@ public void setApiKeys(List apiKeys) { this.apiKeys = apiKeys; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ApiKeys instance itself + */ + public ApiKeys putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -97,12 +141,13 @@ public boolean equals(Object o) { return false; } ApiKeys apiKeys = (ApiKeys) o; - return Objects.equals(this.apiKeys, apiKeys.apiKeys); + return Objects.equals(this.apiKeys, apiKeys.apiKeys)&& + Objects.equals(this.additionalProperties, apiKeys.additionalProperties); } @Override public int hashCode() { - return Objects.hash(apiKeys); + return Objects.hash(apiKeys, additionalProperties); } @Override @@ -110,6 +155,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ApiKeys {\n"); sb.append(" apiKeys: ").append(toIndentedString(apiKeys)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -152,14 +198,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ApiKeys.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApiKeys` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : ApiKeys.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -190,6 +228,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ApiKeys value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -197,7 +252,28 @@ public void write(JsonWriter out, ApiKeys value) throws IOException { public ApiKeys read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ApiKeys instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/Attribute.java b/src/main/java/saasus/sdk/auth/models/Attribute.java index 98ab6dc1..1a23859f 100644 --- a/src/main/java/saasus/sdk/auth/models/Attribute.java +++ b/src/main/java/saasus/sdk/auth/models/Attribute.java @@ -50,7 +50,7 @@ /** * Attribute */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class Attribute { public static final String SERIALIZED_NAME_ATTRIBUTE_NAME = "attribute_name"; @SerializedName(SERIALIZED_NAME_ATTRIBUTE_NAME) @@ -123,6 +123,50 @@ public void setAttributeType(AttributeType attributeType) { this.attributeType = attributeType; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Attribute instance itself + */ + public Attribute putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -136,12 +180,13 @@ public boolean equals(Object o) { Attribute attribute = (Attribute) o; return Objects.equals(this.attributeName, attribute.attributeName) && Objects.equals(this.displayName, attribute.displayName) && - Objects.equals(this.attributeType, attribute.attributeType); + Objects.equals(this.attributeType, attribute.attributeType)&& + Objects.equals(this.additionalProperties, attribute.additionalProperties); } @Override public int hashCode() { - return Objects.hash(attributeName, displayName, attributeType); + return Objects.hash(attributeName, displayName, attributeType, additionalProperties); } @Override @@ -151,6 +196,7 @@ public String toString() { sb.append(" attributeName: ").append(toIndentedString(attributeName)).append("\n"); sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); sb.append(" attributeType: ").append(toIndentedString(attributeType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -197,14 +243,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Attribute.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Attribute` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Attribute.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -237,6 +275,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Attribute value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -244,7 +299,28 @@ public void write(JsonWriter out, Attribute value) throws IOException { public Attribute read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Attribute instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/AuthInfo.java b/src/main/java/saasus/sdk/auth/models/AuthInfo.java index 58ff7f70..4a18583f 100644 --- a/src/main/java/saasus/sdk/auth/models/AuthInfo.java +++ b/src/main/java/saasus/sdk/auth/models/AuthInfo.java @@ -49,7 +49,7 @@ /** * AuthInfo */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class AuthInfo { public static final String SERIALIZED_NAME_CALLBACK_URL = "callback_url"; @SerializedName(SERIALIZED_NAME_CALLBACK_URL) @@ -76,6 +76,50 @@ public void setCallbackUrl(String callbackUrl) { this.callbackUrl = callbackUrl; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AuthInfo instance itself + */ + public AuthInfo putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } AuthInfo authInfo = (AuthInfo) o; - return Objects.equals(this.callbackUrl, authInfo.callbackUrl); + return Objects.equals(this.callbackUrl, authInfo.callbackUrl)&& + Objects.equals(this.additionalProperties, authInfo.additionalProperties); } @Override public int hashCode() { - return Objects.hash(callbackUrl); + return Objects.hash(callbackUrl, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class AuthInfo {\n"); sb.append(" callbackUrl: ").append(toIndentedString(callbackUrl)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!AuthInfo.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuthInfo` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : AuthInfo.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, AuthInfo value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, AuthInfo value) throws IOException { public AuthInfo read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AuthInfo instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/AuthorizationTempCode.java b/src/main/java/saasus/sdk/auth/models/AuthorizationTempCode.java index 9ee5f48a..884c61b6 100644 --- a/src/main/java/saasus/sdk/auth/models/AuthorizationTempCode.java +++ b/src/main/java/saasus/sdk/auth/models/AuthorizationTempCode.java @@ -49,7 +49,7 @@ /** * AuthorizationTempCode */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class AuthorizationTempCode { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) @@ -76,6 +76,50 @@ public void setCode(String code) { this.code = code; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AuthorizationTempCode instance itself + */ + public AuthorizationTempCode putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } AuthorizationTempCode authorizationTempCode = (AuthorizationTempCode) o; - return Objects.equals(this.code, authorizationTempCode.code); + return Objects.equals(this.code, authorizationTempCode.code)&& + Objects.equals(this.additionalProperties, authorizationTempCode.additionalProperties); } @Override public int hashCode() { - return Objects.hash(code); + return Objects.hash(code, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class AuthorizationTempCode {\n"); sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!AuthorizationTempCode.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuthorizationTempCode` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : AuthorizationTempCode.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, AuthorizationTempCode value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, AuthorizationTempCode value) throws IOExceptio public AuthorizationTempCode read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AuthorizationTempCode instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/BasicInfo.java b/src/main/java/saasus/sdk/auth/models/BasicInfo.java index d3e0f848..d115a410 100644 --- a/src/main/java/saasus/sdk/auth/models/BasicInfo.java +++ b/src/main/java/saasus/sdk/auth/models/BasicInfo.java @@ -52,7 +52,7 @@ /** * BasicInfo */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class BasicInfo { public static final String SERIALIZED_NAME_DOMAIN_NAME = "domain_name"; @SerializedName(SERIALIZED_NAME_DOMAIN_NAME) @@ -271,6 +271,50 @@ public void setIsSesSandboxGranted(Boolean isSesSandboxGranted) { this.isSesSandboxGranted = isSesSandboxGranted; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BasicInfo instance itself + */ + public BasicInfo putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -290,12 +334,13 @@ public boolean equals(Object o) { Objects.equals(this.defaultDomainName, basicInfo.defaultDomainName) && Objects.equals(this.fromEmailAddress, basicInfo.fromEmailAddress) && Objects.equals(this.replyEmailAddress, basicInfo.replyEmailAddress) && - Objects.equals(this.isSesSandboxGranted, basicInfo.isSesSandboxGranted); + Objects.equals(this.isSesSandboxGranted, basicInfo.isSesSandboxGranted)&& + Objects.equals(this.additionalProperties, basicInfo.additionalProperties); } @Override public int hashCode() { - return Objects.hash(domainName, isDnsValidated, certificateDnsRecord, cloudFrontDnsRecord, dkimDnsRecords, defaultDomainName, fromEmailAddress, replyEmailAddress, isSesSandboxGranted); + return Objects.hash(domainName, isDnsValidated, certificateDnsRecord, cloudFrontDnsRecord, dkimDnsRecords, defaultDomainName, fromEmailAddress, replyEmailAddress, isSesSandboxGranted, additionalProperties); } @Override @@ -311,6 +356,7 @@ public String toString() { sb.append(" fromEmailAddress: ").append(toIndentedString(fromEmailAddress)).append("\n"); sb.append(" replyEmailAddress: ").append(toIndentedString(replyEmailAddress)).append("\n"); sb.append(" isSesSandboxGranted: ").append(toIndentedString(isSesSandboxGranted)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -369,14 +415,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!BasicInfo.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BasicInfo` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : BasicInfo.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -427,6 +465,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, BasicInfo value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -434,7 +489,28 @@ public void write(JsonWriter out, BasicInfo value) throws IOException { public BasicInfo read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BasicInfo instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/BillingAddress.java b/src/main/java/saasus/sdk/auth/models/BillingAddress.java index 8635b900..630a6b15 100644 --- a/src/main/java/saasus/sdk/auth/models/BillingAddress.java +++ b/src/main/java/saasus/sdk/auth/models/BillingAddress.java @@ -49,7 +49,7 @@ /** * BillingAddress */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class BillingAddress { public static final String SERIALIZED_NAME_STREET = "street"; @SerializedName(SERIALIZED_NAME_STREET) @@ -191,6 +191,50 @@ public void setPostalCode(String postalCode) { this.postalCode = postalCode; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BillingAddress instance itself + */ + public BillingAddress putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -207,12 +251,13 @@ public boolean equals(Object o) { Objects.equals(this.state, billingAddress.state) && Objects.equals(this.country, billingAddress.country) && Objects.equals(this.additionalAddressInfo, billingAddress.additionalAddressInfo) && - Objects.equals(this.postalCode, billingAddress.postalCode); + Objects.equals(this.postalCode, billingAddress.postalCode)&& + Objects.equals(this.additionalProperties, billingAddress.additionalProperties); } @Override public int hashCode() { - return Objects.hash(street, city, state, country, additionalAddressInfo, postalCode); + return Objects.hash(street, city, state, country, additionalAddressInfo, postalCode, additionalProperties); } @Override @@ -225,6 +270,7 @@ public String toString() { sb.append(" country: ").append(toIndentedString(country)).append("\n"); sb.append(" additionalAddressInfo: ").append(toIndentedString(additionalAddressInfo)).append("\n"); sb.append(" postalCode: ").append(toIndentedString(postalCode)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -276,14 +322,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!BillingAddress.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BillingAddress` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : BillingAddress.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -326,6 +364,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, BillingAddress value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -333,7 +388,28 @@ public void write(JsonWriter out, BillingAddress value) throws IOException { public BillingAddress read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BillingAddress instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/BillingInfo.java b/src/main/java/saasus/sdk/auth/models/BillingInfo.java index e726b986..1f184433 100644 --- a/src/main/java/saasus/sdk/auth/models/BillingInfo.java +++ b/src/main/java/saasus/sdk/auth/models/BillingInfo.java @@ -51,7 +51,7 @@ /** * BillingInfo */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class BillingInfo { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -124,6 +124,50 @@ public void setInvoiceLanguage(InvoiceLanguage invoiceLanguage) { this.invoiceLanguage = invoiceLanguage; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BillingInfo instance itself + */ + public BillingInfo putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -137,12 +181,13 @@ public boolean equals(Object o) { BillingInfo billingInfo = (BillingInfo) o; return Objects.equals(this.name, billingInfo.name) && Objects.equals(this.address, billingInfo.address) && - Objects.equals(this.invoiceLanguage, billingInfo.invoiceLanguage); + Objects.equals(this.invoiceLanguage, billingInfo.invoiceLanguage)&& + Objects.equals(this.additionalProperties, billingInfo.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, address, invoiceLanguage); + return Objects.hash(name, address, invoiceLanguage, additionalProperties); } @Override @@ -152,6 +197,7 @@ public String toString() { sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" address: ").append(toIndentedString(address)).append("\n"); sb.append(" invoiceLanguage: ").append(toIndentedString(invoiceLanguage)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -198,14 +244,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!BillingInfo.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BillingInfo` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : BillingInfo.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -237,6 +275,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, BillingInfo value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -244,7 +299,28 @@ public void write(JsonWriter out, BillingInfo value) throws IOException { public BillingInfo read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BillingInfo instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/ClientSecret.java b/src/main/java/saasus/sdk/auth/models/ClientSecret.java index 30842545..2cd3f5fe 100644 --- a/src/main/java/saasus/sdk/auth/models/ClientSecret.java +++ b/src/main/java/saasus/sdk/auth/models/ClientSecret.java @@ -49,7 +49,7 @@ /** * ClientSecret */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class ClientSecret { public static final String SERIALIZED_NAME_CLIENT_SECRET = "client_secret"; @SerializedName(SERIALIZED_NAME_CLIENT_SECRET) @@ -76,6 +76,50 @@ public void setClientSecret(String clientSecret) { this.clientSecret = clientSecret; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ClientSecret instance itself + */ + public ClientSecret putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } ClientSecret clientSecret = (ClientSecret) o; - return Objects.equals(this.clientSecret, clientSecret.clientSecret); + return Objects.equals(this.clientSecret, clientSecret.clientSecret)&& + Objects.equals(this.additionalProperties, clientSecret.additionalProperties); } @Override public int hashCode() { - return Objects.hash(clientSecret); + return Objects.hash(clientSecret, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ClientSecret {\n"); sb.append(" clientSecret: ").append(toIndentedString(clientSecret)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ClientSecret.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClientSecret` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : ClientSecret.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ClientSecret value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, ClientSecret value) throws IOException { public ClientSecret read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ClientSecret instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/CloudFormationLaunchStackLink.java b/src/main/java/saasus/sdk/auth/models/CloudFormationLaunchStackLink.java index 0fa746ce..57de861d 100644 --- a/src/main/java/saasus/sdk/auth/models/CloudFormationLaunchStackLink.java +++ b/src/main/java/saasus/sdk/auth/models/CloudFormationLaunchStackLink.java @@ -49,7 +49,7 @@ /** * CloudFormationLaunchStackLink */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class CloudFormationLaunchStackLink { public static final String SERIALIZED_NAME_LINK = "link"; @SerializedName(SERIALIZED_NAME_LINK) @@ -76,6 +76,50 @@ public void setLink(String link) { this.link = link; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CloudFormationLaunchStackLink instance itself + */ + public CloudFormationLaunchStackLink putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } CloudFormationLaunchStackLink cloudFormationLaunchStackLink = (CloudFormationLaunchStackLink) o; - return Objects.equals(this.link, cloudFormationLaunchStackLink.link); + return Objects.equals(this.link, cloudFormationLaunchStackLink.link)&& + Objects.equals(this.additionalProperties, cloudFormationLaunchStackLink.additionalProperties); } @Override public int hashCode() { - return Objects.hash(link); + return Objects.hash(link, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CloudFormationLaunchStackLink {\n"); sb.append(" link: ").append(toIndentedString(link)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CloudFormationLaunchStackLink.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CloudFormationLaunchStackLink` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CloudFormationLaunchStackLink.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, CloudFormationLaunchStackLink value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, CloudFormationLaunchStackLink value) throws IO public CloudFormationLaunchStackLink read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CloudFormationLaunchStackLink instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/ConfirmEmailUpdateParam.java b/src/main/java/saasus/sdk/auth/models/ConfirmEmailUpdateParam.java index a2da8c7a..72ae6f6b 100644 --- a/src/main/java/saasus/sdk/auth/models/ConfirmEmailUpdateParam.java +++ b/src/main/java/saasus/sdk/auth/models/ConfirmEmailUpdateParam.java @@ -49,7 +49,7 @@ /** * ConfirmEmailUpdateParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class ConfirmEmailUpdateParam { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) @@ -99,6 +99,50 @@ public void setAccessToken(String accessToken) { this.accessToken = accessToken; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ConfirmEmailUpdateParam instance itself + */ + public ConfirmEmailUpdateParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } ConfirmEmailUpdateParam confirmEmailUpdateParam = (ConfirmEmailUpdateParam) o; return Objects.equals(this.code, confirmEmailUpdateParam.code) && - Objects.equals(this.accessToken, confirmEmailUpdateParam.accessToken); + Objects.equals(this.accessToken, confirmEmailUpdateParam.accessToken)&& + Objects.equals(this.additionalProperties, confirmEmailUpdateParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(code, accessToken); + return Objects.hash(code, accessToken, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class ConfirmEmailUpdateParam {\n"); sb.append(" code: ").append(toIndentedString(code)).append("\n"); sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ConfirmEmailUpdateParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ConfirmEmailUpdateParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : ConfirmEmailUpdateParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ConfirmEmailUpdateParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, ConfirmEmailUpdateParam value) throws IOExcept public ConfirmEmailUpdateParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ConfirmEmailUpdateParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/ConfirmExternalUserLinkParam.java b/src/main/java/saasus/sdk/auth/models/ConfirmExternalUserLinkParam.java index 656d6a27..d9afa20d 100644 --- a/src/main/java/saasus/sdk/auth/models/ConfirmExternalUserLinkParam.java +++ b/src/main/java/saasus/sdk/auth/models/ConfirmExternalUserLinkParam.java @@ -49,7 +49,7 @@ /** * ConfirmExternalUserLinkParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class ConfirmExternalUserLinkParam { public static final String SERIALIZED_NAME_ACCESS_TOKEN = "access_token"; @SerializedName(SERIALIZED_NAME_ACCESS_TOKEN) @@ -99,6 +99,50 @@ public void setCode(String code) { this.code = code; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ConfirmExternalUserLinkParam instance itself + */ + public ConfirmExternalUserLinkParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } ConfirmExternalUserLinkParam confirmExternalUserLinkParam = (ConfirmExternalUserLinkParam) o; return Objects.equals(this.accessToken, confirmExternalUserLinkParam.accessToken) && - Objects.equals(this.code, confirmExternalUserLinkParam.code); + Objects.equals(this.code, confirmExternalUserLinkParam.code)&& + Objects.equals(this.additionalProperties, confirmExternalUserLinkParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(accessToken, code); + return Objects.hash(accessToken, code, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class ConfirmExternalUserLinkParam {\n"); sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ConfirmExternalUserLinkParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ConfirmExternalUserLinkParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : ConfirmExternalUserLinkParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ConfirmExternalUserLinkParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, ConfirmExternalUserLinkParam value) throws IOE public ConfirmExternalUserLinkParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ConfirmExternalUserLinkParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/ConfirmSignUpWithAwsMarketplaceParam.java b/src/main/java/saasus/sdk/auth/models/ConfirmSignUpWithAwsMarketplaceParam.java index 22438589..4b228176 100644 --- a/src/main/java/saasus/sdk/auth/models/ConfirmSignUpWithAwsMarketplaceParam.java +++ b/src/main/java/saasus/sdk/auth/models/ConfirmSignUpWithAwsMarketplaceParam.java @@ -49,7 +49,7 @@ /** * ConfirmSignUpWithAwsMarketplaceParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class ConfirmSignUpWithAwsMarketplaceParam { public static final String SERIALIZED_NAME_TENANT_NAME = "tenant_name"; @SerializedName(SERIALIZED_NAME_TENANT_NAME) @@ -122,6 +122,50 @@ public void setRegistrationToken(String registrationToken) { this.registrationToken = registrationToken; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ConfirmSignUpWithAwsMarketplaceParam instance itself + */ + public ConfirmSignUpWithAwsMarketplaceParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -135,12 +179,13 @@ public boolean equals(Object o) { ConfirmSignUpWithAwsMarketplaceParam confirmSignUpWithAwsMarketplaceParam = (ConfirmSignUpWithAwsMarketplaceParam) o; return Objects.equals(this.tenantName, confirmSignUpWithAwsMarketplaceParam.tenantName) && Objects.equals(this.accessToken, confirmSignUpWithAwsMarketplaceParam.accessToken) && - Objects.equals(this.registrationToken, confirmSignUpWithAwsMarketplaceParam.registrationToken); + Objects.equals(this.registrationToken, confirmSignUpWithAwsMarketplaceParam.registrationToken)&& + Objects.equals(this.additionalProperties, confirmSignUpWithAwsMarketplaceParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(tenantName, accessToken, registrationToken); + return Objects.hash(tenantName, accessToken, registrationToken, additionalProperties); } @Override @@ -150,6 +195,7 @@ public String toString() { sb.append(" tenantName: ").append(toIndentedString(tenantName)).append("\n"); sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); sb.append(" registrationToken: ").append(toIndentedString(registrationToken)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -195,14 +241,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ConfirmSignUpWithAwsMarketplaceParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ConfirmSignUpWithAwsMarketplaceParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : ConfirmSignUpWithAwsMarketplaceParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -236,6 +274,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ConfirmSignUpWithAwsMarketplaceParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -243,7 +298,28 @@ public void write(JsonWriter out, ConfirmSignUpWithAwsMarketplaceParam value) th public ConfirmSignUpWithAwsMarketplaceParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ConfirmSignUpWithAwsMarketplaceParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/CreateSaasUserParam.java b/src/main/java/saasus/sdk/auth/models/CreateSaasUserParam.java index a5114169..930e40fd 100644 --- a/src/main/java/saasus/sdk/auth/models/CreateSaasUserParam.java +++ b/src/main/java/saasus/sdk/auth/models/CreateSaasUserParam.java @@ -49,7 +49,7 @@ /** * CreateSaasUserParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class CreateSaasUserParam { public static final String SERIALIZED_NAME_EMAIL = "email"; @SerializedName(SERIALIZED_NAME_EMAIL) @@ -99,6 +99,50 @@ public void setPassword(String password) { this.password = password; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateSaasUserParam instance itself + */ + public CreateSaasUserParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } CreateSaasUserParam createSaasUserParam = (CreateSaasUserParam) o; return Objects.equals(this.email, createSaasUserParam.email) && - Objects.equals(this.password, createSaasUserParam.password); + Objects.equals(this.password, createSaasUserParam.password)&& + Objects.equals(this.additionalProperties, createSaasUserParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(email, password); + return Objects.hash(email, password, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class CreateSaasUserParam {\n"); sb.append(" email: ").append(toIndentedString(email)).append("\n"); sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreateSaasUserParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSaasUserParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreateSaasUserParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, CreateSaasUserParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, CreateSaasUserParam value) throws IOException public CreateSaasUserParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateSaasUserParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/CreateSecretCodeParam.java b/src/main/java/saasus/sdk/auth/models/CreateSecretCodeParam.java index 7384932e..7b94eb8c 100644 --- a/src/main/java/saasus/sdk/auth/models/CreateSecretCodeParam.java +++ b/src/main/java/saasus/sdk/auth/models/CreateSecretCodeParam.java @@ -49,7 +49,7 @@ /** * CreateSecretCodeParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class CreateSecretCodeParam { public static final String SERIALIZED_NAME_ACCESS_TOKEN = "access_token"; @SerializedName(SERIALIZED_NAME_ACCESS_TOKEN) @@ -76,6 +76,50 @@ public void setAccessToken(String accessToken) { this.accessToken = accessToken; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateSecretCodeParam instance itself + */ + public CreateSecretCodeParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } CreateSecretCodeParam createSecretCodeParam = (CreateSecretCodeParam) o; - return Objects.equals(this.accessToken, createSecretCodeParam.accessToken); + return Objects.equals(this.accessToken, createSecretCodeParam.accessToken)&& + Objects.equals(this.additionalProperties, createSecretCodeParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(accessToken); + return Objects.hash(accessToken, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreateSecretCodeParam {\n"); sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreateSecretCodeParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSecretCodeParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreateSecretCodeParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, CreateSecretCodeParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, CreateSecretCodeParam value) throws IOExceptio public CreateSecretCodeParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateSecretCodeParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/CreateTenantInvitationParam.java b/src/main/java/saasus/sdk/auth/models/CreateTenantInvitationParam.java index 81cad460..37b3627f 100644 --- a/src/main/java/saasus/sdk/auth/models/CreateTenantInvitationParam.java +++ b/src/main/java/saasus/sdk/auth/models/CreateTenantInvitationParam.java @@ -52,7 +52,7 @@ /** * CreateTenantInvitationParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class CreateTenantInvitationParam { public static final String SERIALIZED_NAME_EMAIL = "email"; @SerializedName(SERIALIZED_NAME_EMAIL) @@ -133,6 +133,50 @@ public void setEnvs(List envs) { this.envs = envs; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateTenantInvitationParam instance itself + */ + public CreateTenantInvitationParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -146,12 +190,13 @@ public boolean equals(Object o) { CreateTenantInvitationParam createTenantInvitationParam = (CreateTenantInvitationParam) o; return Objects.equals(this.email, createTenantInvitationParam.email) && Objects.equals(this.accessToken, createTenantInvitationParam.accessToken) && - Objects.equals(this.envs, createTenantInvitationParam.envs); + Objects.equals(this.envs, createTenantInvitationParam.envs)&& + Objects.equals(this.additionalProperties, createTenantInvitationParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(email, accessToken, envs); + return Objects.hash(email, accessToken, envs, additionalProperties); } @Override @@ -161,6 +206,7 @@ public String toString() { sb.append(" email: ").append(toIndentedString(email)).append("\n"); sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); sb.append(" envs: ").append(toIndentedString(envs)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -207,14 +253,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreateTenantInvitationParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateTenantInvitationParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreateTenantInvitationParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -255,6 +293,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, CreateTenantInvitationParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -262,7 +317,28 @@ public void write(JsonWriter out, CreateTenantInvitationParam value) throws IOEx public CreateTenantInvitationParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateTenantInvitationParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/CreateTenantUserParam.java b/src/main/java/saasus/sdk/auth/models/CreateTenantUserParam.java index cf946cca..4f8d6b86 100644 --- a/src/main/java/saasus/sdk/auth/models/CreateTenantUserParam.java +++ b/src/main/java/saasus/sdk/auth/models/CreateTenantUserParam.java @@ -51,7 +51,7 @@ /** * CreateTenantUserParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class CreateTenantUserParam { public static final String SERIALIZED_NAME_EMAIL = "email"; @SerializedName(SERIALIZED_NAME_EMAIL) @@ -109,6 +109,50 @@ public void setAttributes(Map attributes) { this.attributes = attributes; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateTenantUserParam instance itself + */ + public CreateTenantUserParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -121,12 +165,13 @@ public boolean equals(Object o) { } CreateTenantUserParam createTenantUserParam = (CreateTenantUserParam) o; return Objects.equals(this.email, createTenantUserParam.email) && - Objects.equals(this.attributes, createTenantUserParam.attributes); + Objects.equals(this.attributes, createTenantUserParam.attributes)&& + Objects.equals(this.additionalProperties, createTenantUserParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(email, attributes); + return Objects.hash(email, attributes, additionalProperties); } @Override @@ -135,6 +180,7 @@ public String toString() { sb.append("class CreateTenantUserParam {\n"); sb.append(" email: ").append(toIndentedString(email)).append("\n"); sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -179,14 +225,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreateTenantUserParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateTenantUserParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreateTenantUserParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -214,6 +252,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, CreateTenantUserParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -221,7 +276,28 @@ public void write(JsonWriter out, CreateTenantUserParam value) throws IOExceptio public CreateTenantUserParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateTenantUserParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/CreateTenantUserRolesParam.java b/src/main/java/saasus/sdk/auth/models/CreateTenantUserRolesParam.java index c942d23f..ecb6c218 100644 --- a/src/main/java/saasus/sdk/auth/models/CreateTenantUserRolesParam.java +++ b/src/main/java/saasus/sdk/auth/models/CreateTenantUserRolesParam.java @@ -51,7 +51,7 @@ /** * CreateTenantUserRolesParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class CreateTenantUserRolesParam { public static final String SERIALIZED_NAME_ROLE_NAMES = "role_names"; @SerializedName(SERIALIZED_NAME_ROLE_NAMES) @@ -86,6 +86,50 @@ public void setRoleNames(List roleNames) { this.roleNames = roleNames; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateTenantUserRolesParam instance itself + */ + public CreateTenantUserRolesParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -97,12 +141,13 @@ public boolean equals(Object o) { return false; } CreateTenantUserRolesParam createTenantUserRolesParam = (CreateTenantUserRolesParam) o; - return Objects.equals(this.roleNames, createTenantUserRolesParam.roleNames); + return Objects.equals(this.roleNames, createTenantUserRolesParam.roleNames)&& + Objects.equals(this.additionalProperties, createTenantUserRolesParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(roleNames); + return Objects.hash(roleNames, additionalProperties); } @Override @@ -110,6 +155,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreateTenantUserRolesParam {\n"); sb.append(" roleNames: ").append(toIndentedString(roleNames)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -152,14 +198,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreateTenantUserRolesParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateTenantUserRolesParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreateTenantUserRolesParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -190,6 +228,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, CreateTenantUserRolesParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -197,7 +252,28 @@ public void write(JsonWriter out, CreateTenantUserRolesParam value) throws IOExc public CreateTenantUserRolesParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateTenantUserRolesParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/Credentials.java b/src/main/java/saasus/sdk/auth/models/Credentials.java index 04e89f70..0e7e2f0e 100644 --- a/src/main/java/saasus/sdk/auth/models/Credentials.java +++ b/src/main/java/saasus/sdk/auth/models/Credentials.java @@ -49,7 +49,7 @@ /** * Credentials */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class Credentials { public static final String SERIALIZED_NAME_ID_TOKEN = "id_token"; @SerializedName(SERIALIZED_NAME_ID_TOKEN) @@ -122,6 +122,50 @@ public void setRefreshToken(String refreshToken) { this.refreshToken = refreshToken; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Credentials instance itself + */ + public Credentials putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -135,12 +179,13 @@ public boolean equals(Object o) { Credentials credentials = (Credentials) o; return Objects.equals(this.idToken, credentials.idToken) && Objects.equals(this.accessToken, credentials.accessToken) && - Objects.equals(this.refreshToken, credentials.refreshToken); + Objects.equals(this.refreshToken, credentials.refreshToken)&& + Objects.equals(this.additionalProperties, credentials.additionalProperties); } @Override public int hashCode() { - return Objects.hash(idToken, accessToken, refreshToken); + return Objects.hash(idToken, accessToken, refreshToken, additionalProperties); } @Override @@ -150,6 +195,7 @@ public String toString() { sb.append(" idToken: ").append(toIndentedString(idToken)).append("\n"); sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); sb.append(" refreshToken: ").append(toIndentedString(refreshToken)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -195,14 +241,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Credentials.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Credentials` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Credentials.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -236,6 +274,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Credentials value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -243,7 +298,28 @@ public void write(JsonWriter out, Credentials value) throws IOException { public Credentials read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Credentials instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/CustomizePageProps.java b/src/main/java/saasus/sdk/auth/models/CustomizePageProps.java index 95f9e009..3449ed81 100644 --- a/src/main/java/saasus/sdk/auth/models/CustomizePageProps.java +++ b/src/main/java/saasus/sdk/auth/models/CustomizePageProps.java @@ -49,7 +49,7 @@ /** * CustomizePageProps */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class CustomizePageProps { public static final String SERIALIZED_NAME_HTML_CONTENTS = "html_contents"; @SerializedName(SERIALIZED_NAME_HTML_CONTENTS) @@ -122,6 +122,50 @@ public void setIsPrivacyPolicy(Boolean isPrivacyPolicy) { this.isPrivacyPolicy = isPrivacyPolicy; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CustomizePageProps instance itself + */ + public CustomizePageProps putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -135,12 +179,13 @@ public boolean equals(Object o) { CustomizePageProps customizePageProps = (CustomizePageProps) o; return Objects.equals(this.htmlContents, customizePageProps.htmlContents) && Objects.equals(this.isTermsOfService, customizePageProps.isTermsOfService) && - Objects.equals(this.isPrivacyPolicy, customizePageProps.isPrivacyPolicy); + Objects.equals(this.isPrivacyPolicy, customizePageProps.isPrivacyPolicy)&& + Objects.equals(this.additionalProperties, customizePageProps.additionalProperties); } @Override public int hashCode() { - return Objects.hash(htmlContents, isTermsOfService, isPrivacyPolicy); + return Objects.hash(htmlContents, isTermsOfService, isPrivacyPolicy, additionalProperties); } @Override @@ -150,6 +195,7 @@ public String toString() { sb.append(" htmlContents: ").append(toIndentedString(htmlContents)).append("\n"); sb.append(" isTermsOfService: ").append(toIndentedString(isTermsOfService)).append("\n"); sb.append(" isPrivacyPolicy: ").append(toIndentedString(isPrivacyPolicy)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -196,14 +242,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CustomizePageProps.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomizePageProps` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CustomizePageProps.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -231,6 +269,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, CustomizePageProps value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -238,7 +293,28 @@ public void write(JsonWriter out, CustomizePageProps value) throws IOException { public CustomizePageProps read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CustomizePageProps instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/CustomizePageSettings.java b/src/main/java/saasus/sdk/auth/models/CustomizePageSettings.java index ed27141d..f63ea2e9 100644 --- a/src/main/java/saasus/sdk/auth/models/CustomizePageSettings.java +++ b/src/main/java/saasus/sdk/auth/models/CustomizePageSettings.java @@ -49,7 +49,7 @@ /** * CustomizePageSettings */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class CustomizePageSettings { public static final String SERIALIZED_NAME_TITLE = "title"; @SerializedName(SERIALIZED_NAME_TITLE) @@ -191,6 +191,50 @@ public void setFavicon(String favicon) { this.favicon = favicon; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CustomizePageSettings instance itself + */ + public CustomizePageSettings putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -207,12 +251,13 @@ public boolean equals(Object o) { Objects.equals(this.privacyPolicyUrl, customizePageSettings.privacyPolicyUrl) && Objects.equals(this.googleTagManagerContainerId, customizePageSettings.googleTagManagerContainerId) && Objects.equals(this.icon, customizePageSettings.icon) && - Objects.equals(this.favicon, customizePageSettings.favicon); + Objects.equals(this.favicon, customizePageSettings.favicon)&& + Objects.equals(this.additionalProperties, customizePageSettings.additionalProperties); } @Override public int hashCode() { - return Objects.hash(title, termsOfServiceUrl, privacyPolicyUrl, googleTagManagerContainerId, icon, favicon); + return Objects.hash(title, termsOfServiceUrl, privacyPolicyUrl, googleTagManagerContainerId, icon, favicon, additionalProperties); } @Override @@ -225,6 +270,7 @@ public String toString() { sb.append(" googleTagManagerContainerId: ").append(toIndentedString(googleTagManagerContainerId)).append("\n"); sb.append(" icon: ").append(toIndentedString(icon)).append("\n"); sb.append(" favicon: ").append(toIndentedString(favicon)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -277,14 +323,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CustomizePageSettings.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomizePageSettings` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CustomizePageSettings.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -327,6 +365,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, CustomizePageSettings value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -334,7 +389,28 @@ public void write(JsonWriter out, CustomizePageSettings value) throws IOExceptio public CustomizePageSettings read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CustomizePageSettings instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/CustomizePageSettingsProps.java b/src/main/java/saasus/sdk/auth/models/CustomizePageSettingsProps.java index 482e69dd..f11d5c52 100644 --- a/src/main/java/saasus/sdk/auth/models/CustomizePageSettingsProps.java +++ b/src/main/java/saasus/sdk/auth/models/CustomizePageSettingsProps.java @@ -49,7 +49,7 @@ /** * CustomizePageSettingsProps */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class CustomizePageSettingsProps { public static final String SERIALIZED_NAME_TITLE = "title"; @SerializedName(SERIALIZED_NAME_TITLE) @@ -145,6 +145,50 @@ public void setGoogleTagManagerContainerId(String googleTagManagerContainerId) { this.googleTagManagerContainerId = googleTagManagerContainerId; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CustomizePageSettingsProps instance itself + */ + public CustomizePageSettingsProps putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -159,12 +203,13 @@ public boolean equals(Object o) { return Objects.equals(this.title, customizePageSettingsProps.title) && Objects.equals(this.termsOfServiceUrl, customizePageSettingsProps.termsOfServiceUrl) && Objects.equals(this.privacyPolicyUrl, customizePageSettingsProps.privacyPolicyUrl) && - Objects.equals(this.googleTagManagerContainerId, customizePageSettingsProps.googleTagManagerContainerId); + Objects.equals(this.googleTagManagerContainerId, customizePageSettingsProps.googleTagManagerContainerId)&& + Objects.equals(this.additionalProperties, customizePageSettingsProps.additionalProperties); } @Override public int hashCode() { - return Objects.hash(title, termsOfServiceUrl, privacyPolicyUrl, googleTagManagerContainerId); + return Objects.hash(title, termsOfServiceUrl, privacyPolicyUrl, googleTagManagerContainerId, additionalProperties); } @Override @@ -175,6 +220,7 @@ public String toString() { sb.append(" termsOfServiceUrl: ").append(toIndentedString(termsOfServiceUrl)).append("\n"); sb.append(" privacyPolicyUrl: ").append(toIndentedString(privacyPolicyUrl)).append("\n"); sb.append(" googleTagManagerContainerId: ").append(toIndentedString(googleTagManagerContainerId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -223,14 +269,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CustomizePageSettingsProps.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomizePageSettingsProps` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CustomizePageSettingsProps.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -267,6 +305,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, CustomizePageSettingsProps value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -274,7 +329,28 @@ public void write(JsonWriter out, CustomizePageSettingsProps value) throws IOExc public CustomizePageSettingsProps read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CustomizePageSettingsProps instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/CustomizePages.java b/src/main/java/saasus/sdk/auth/models/CustomizePages.java index dc126ae7..ca18e01a 100644 --- a/src/main/java/saasus/sdk/auth/models/CustomizePages.java +++ b/src/main/java/saasus/sdk/auth/models/CustomizePages.java @@ -50,7 +50,7 @@ /** * CustomizePages */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class CustomizePages { public static final String SERIALIZED_NAME_SIGN_UP_PAGE = "sign_up_page"; @SerializedName(SERIALIZED_NAME_SIGN_UP_PAGE) @@ -123,6 +123,50 @@ public void setPasswordResetPage(CustomizePageProps passwordResetPage) { this.passwordResetPage = passwordResetPage; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CustomizePages instance itself + */ + public CustomizePages putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -136,12 +180,13 @@ public boolean equals(Object o) { CustomizePages customizePages = (CustomizePages) o; return Objects.equals(this.signUpPage, customizePages.signUpPage) && Objects.equals(this.signInPage, customizePages.signInPage) && - Objects.equals(this.passwordResetPage, customizePages.passwordResetPage); + Objects.equals(this.passwordResetPage, customizePages.passwordResetPage)&& + Objects.equals(this.additionalProperties, customizePages.additionalProperties); } @Override public int hashCode() { - return Objects.hash(signUpPage, signInPage, passwordResetPage); + return Objects.hash(signUpPage, signInPage, passwordResetPage, additionalProperties); } @Override @@ -151,6 +196,7 @@ public String toString() { sb.append(" signUpPage: ").append(toIndentedString(signUpPage)).append("\n"); sb.append(" signInPage: ").append(toIndentedString(signInPage)).append("\n"); sb.append(" passwordResetPage: ").append(toIndentedString(passwordResetPage)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -197,14 +243,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CustomizePages.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomizePages` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CustomizePages.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -235,6 +273,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, CustomizePages value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -242,7 +297,28 @@ public void write(JsonWriter out, CustomizePages value) throws IOException { public CustomizePages read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CustomizePages instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/DeviceConfiguration.java b/src/main/java/saasus/sdk/auth/models/DeviceConfiguration.java index 77d9fbf7..a98a1165 100644 --- a/src/main/java/saasus/sdk/auth/models/DeviceConfiguration.java +++ b/src/main/java/saasus/sdk/auth/models/DeviceConfiguration.java @@ -49,7 +49,7 @@ /** * Settings for remembering trusted devices */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class DeviceConfiguration { /** * always: always remember userOptIn: user opt-in no: don't save @@ -130,6 +130,50 @@ public void setDeviceRemembering(DeviceRememberingEnum deviceRemembering) { this.deviceRemembering = deviceRemembering; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DeviceConfiguration instance itself + */ + public DeviceConfiguration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -141,12 +185,13 @@ public boolean equals(Object o) { return false; } DeviceConfiguration deviceConfiguration = (DeviceConfiguration) o; - return Objects.equals(this.deviceRemembering, deviceConfiguration.deviceRemembering); + return Objects.equals(this.deviceRemembering, deviceConfiguration.deviceRemembering)&& + Objects.equals(this.additionalProperties, deviceConfiguration.additionalProperties); } @Override public int hashCode() { - return Objects.hash(deviceRemembering); + return Objects.hash(deviceRemembering, additionalProperties); } @Override @@ -154,6 +199,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class DeviceConfiguration {\n"); sb.append(" deviceRemembering: ").append(toIndentedString(deviceRemembering)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -196,14 +242,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!DeviceConfiguration.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeviceConfiguration` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : DeviceConfiguration.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -233,6 +271,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, DeviceConfiguration value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -240,7 +295,28 @@ public void write(JsonWriter out, DeviceConfiguration value) throws IOException public DeviceConfiguration read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DeviceConfiguration instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/DnsRecord.java b/src/main/java/saasus/sdk/auth/models/DnsRecord.java index 67c2c6fd..a47430b7 100644 --- a/src/main/java/saasus/sdk/auth/models/DnsRecord.java +++ b/src/main/java/saasus/sdk/auth/models/DnsRecord.java @@ -49,7 +49,7 @@ /** * DnsRecord */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class DnsRecord { /** * CNAME Resource Record @@ -172,6 +172,50 @@ public void setValue(String value) { this.value = value; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DnsRecord instance itself + */ + public DnsRecord putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -185,12 +229,13 @@ public boolean equals(Object o) { DnsRecord dnsRecord = (DnsRecord) o; return Objects.equals(this.type, dnsRecord.type) && Objects.equals(this.name, dnsRecord.name) && - Objects.equals(this.value, dnsRecord.value); + Objects.equals(this.value, dnsRecord.value)&& + Objects.equals(this.additionalProperties, dnsRecord.additionalProperties); } @Override public int hashCode() { - return Objects.hash(type, name, value); + return Objects.hash(type, name, value, additionalProperties); } @Override @@ -200,6 +245,7 @@ public String toString() { sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -246,14 +292,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!DnsRecord.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DnsRecord` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : DnsRecord.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -289,6 +327,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, DnsRecord value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -296,7 +351,28 @@ public void write(JsonWriter out, DnsRecord value) throws IOException { public DnsRecord read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DnsRecord instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/Env.java b/src/main/java/saasus/sdk/auth/models/Env.java index 5129392f..14ef3637 100644 --- a/src/main/java/saasus/sdk/auth/models/Env.java +++ b/src/main/java/saasus/sdk/auth/models/Env.java @@ -49,7 +49,7 @@ /** * env info */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class Env { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -122,6 +122,50 @@ public void setDisplayName(String displayName) { this.displayName = displayName; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Env instance itself + */ + public Env putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -135,12 +179,13 @@ public boolean equals(Object o) { Env env = (Env) o; return Objects.equals(this.id, env.id) && Objects.equals(this.name, env.name) && - Objects.equals(this.displayName, env.displayName); + Objects.equals(this.displayName, env.displayName)&& + Objects.equals(this.additionalProperties, env.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, name, displayName); + return Objects.hash(id, name, displayName, additionalProperties); } @Override @@ -150,6 +195,7 @@ public String toString() { sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -195,14 +241,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Env.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Env` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Env.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -233,6 +271,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Env value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -240,7 +295,28 @@ public void write(JsonWriter out, Env value) throws IOException { public Env read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Env instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/Envs.java b/src/main/java/saasus/sdk/auth/models/Envs.java index 7ac8e4c4..6ec06894 100644 --- a/src/main/java/saasus/sdk/auth/models/Envs.java +++ b/src/main/java/saasus/sdk/auth/models/Envs.java @@ -52,7 +52,7 @@ /** * env list */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class Envs { public static final String SERIALIZED_NAME_ENVS = "envs"; @SerializedName(SERIALIZED_NAME_ENVS) @@ -87,6 +87,50 @@ public void setEnvs(List envs) { this.envs = envs; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Envs instance itself + */ + public Envs putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } Envs envs = (Envs) o; - return Objects.equals(this.envs, envs.envs); + return Objects.equals(this.envs, envs.envs)&& + Objects.equals(this.additionalProperties, envs.additionalProperties); } @Override public int hashCode() { - return Objects.hash(envs); + return Objects.hash(envs, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Envs {\n"); sb.append(" envs: ").append(toIndentedString(envs)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Envs.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Envs` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Envs.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Envs value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, Envs value) throws IOException { public Envs read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Envs instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/Error.java b/src/main/java/saasus/sdk/auth/models/Error.java index 227692e6..7775b150 100644 --- a/src/main/java/saasus/sdk/auth/models/Error.java +++ b/src/main/java/saasus/sdk/auth/models/Error.java @@ -51,7 +51,7 @@ /** * Error */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class Error { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @@ -132,6 +132,50 @@ public void setData(Map data) { this.data = data; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Error instance itself + */ + public Error putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -145,12 +189,13 @@ public boolean equals(Object o) { Error error = (Error) o; return Objects.equals(this.type, error.type) && Objects.equals(this.message, error.message) && - Objects.equals(this.data, error.data); + Objects.equals(this.data, error.data)&& + Objects.equals(this.additionalProperties, error.additionalProperties); } @Override public int hashCode() { - return Objects.hash(type, message, data); + return Objects.hash(type, message, data, additionalProperties); } @Override @@ -160,6 +205,7 @@ public String toString() { sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -205,14 +251,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Error.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Error` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Error.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -243,6 +281,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Error value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -250,7 +305,28 @@ public void write(JsonWriter out, Error value) throws IOException { public Error read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Error instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/IdentityProviderConfiguration.java b/src/main/java/saasus/sdk/auth/models/IdentityProviderConfiguration.java index bf60d9a7..6487d3c6 100644 --- a/src/main/java/saasus/sdk/auth/models/IdentityProviderConfiguration.java +++ b/src/main/java/saasus/sdk/auth/models/IdentityProviderConfiguration.java @@ -49,7 +49,7 @@ /** * This information is required to set up sign-in using an external identity provider. It cannot be changed. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class IdentityProviderConfiguration { public static final String SERIALIZED_NAME_DOMAIN = "domain"; @SerializedName(SERIALIZED_NAME_DOMAIN) @@ -145,6 +145,50 @@ public void setReplyUrl(String replyUrl) { this.replyUrl = replyUrl; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the IdentityProviderConfiguration instance itself + */ + public IdentityProviderConfiguration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -159,12 +203,13 @@ public boolean equals(Object o) { return Objects.equals(this.domain, identityProviderConfiguration.domain) && Objects.equals(this.redirectUrl, identityProviderConfiguration.redirectUrl) && Objects.equals(this.entityId, identityProviderConfiguration.entityId) && - Objects.equals(this.replyUrl, identityProviderConfiguration.replyUrl); + Objects.equals(this.replyUrl, identityProviderConfiguration.replyUrl)&& + Objects.equals(this.additionalProperties, identityProviderConfiguration.additionalProperties); } @Override public int hashCode() { - return Objects.hash(domain, redirectUrl, entityId, replyUrl); + return Objects.hash(domain, redirectUrl, entityId, replyUrl, additionalProperties); } @Override @@ -175,6 +220,7 @@ public String toString() { sb.append(" redirectUrl: ").append(toIndentedString(redirectUrl)).append("\n"); sb.append(" entityId: ").append(toIndentedString(entityId)).append("\n"); sb.append(" replyUrl: ").append(toIndentedString(replyUrl)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -223,14 +269,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!IdentityProviderConfiguration.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IdentityProviderConfiguration` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : IdentityProviderConfiguration.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -267,6 +305,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, IdentityProviderConfiguration value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -274,7 +329,28 @@ public void write(JsonWriter out, IdentityProviderConfiguration value) throws IO public IdentityProviderConfiguration read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + IdentityProviderConfiguration instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/IdentityProviderProps.java b/src/main/java/saasus/sdk/auth/models/IdentityProviderProps.java index 1f7c8421..836376f6 100644 --- a/src/main/java/saasus/sdk/auth/models/IdentityProviderProps.java +++ b/src/main/java/saasus/sdk/auth/models/IdentityProviderProps.java @@ -49,7 +49,7 @@ /** * IdentityProviderProps */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class IdentityProviderProps { public static final String SERIALIZED_NAME_APPLICATION_ID = "application_id"; @SerializedName(SERIALIZED_NAME_APPLICATION_ID) @@ -145,6 +145,50 @@ public void setIsButtonHidden(Boolean isButtonHidden) { this.isButtonHidden = isButtonHidden; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the IdentityProviderProps instance itself + */ + public IdentityProviderProps putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -159,12 +203,13 @@ public boolean equals(Object o) { return Objects.equals(this.applicationId, identityProviderProps.applicationId) && Objects.equals(this.applicationSecret, identityProviderProps.applicationSecret) && Objects.equals(this.approvalScope, identityProviderProps.approvalScope) && - Objects.equals(this.isButtonHidden, identityProviderProps.isButtonHidden); + Objects.equals(this.isButtonHidden, identityProviderProps.isButtonHidden)&& + Objects.equals(this.additionalProperties, identityProviderProps.additionalProperties); } @Override public int hashCode() { - return Objects.hash(applicationId, applicationSecret, approvalScope, isButtonHidden); + return Objects.hash(applicationId, applicationSecret, approvalScope, isButtonHidden, additionalProperties); } @Override @@ -175,6 +220,7 @@ public String toString() { sb.append(" applicationSecret: ").append(toIndentedString(applicationSecret)).append("\n"); sb.append(" approvalScope: ").append(toIndentedString(approvalScope)).append("\n"); sb.append(" isButtonHidden: ").append(toIndentedString(isButtonHidden)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -222,14 +268,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!IdentityProviderProps.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IdentityProviderProps` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : IdentityProviderProps.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -263,6 +301,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, IdentityProviderProps value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -270,7 +325,28 @@ public void write(JsonWriter out, IdentityProviderProps value) throws IOExceptio public IdentityProviderProps read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + IdentityProviderProps instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/IdentityProviderSaml.java b/src/main/java/saasus/sdk/auth/models/IdentityProviderSaml.java index aa114550..c1bffc11 100644 --- a/src/main/java/saasus/sdk/auth/models/IdentityProviderSaml.java +++ b/src/main/java/saasus/sdk/auth/models/IdentityProviderSaml.java @@ -49,7 +49,7 @@ /** * IdentityProviderSaml */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class IdentityProviderSaml { public static final String SERIALIZED_NAME_METADATA_URL = "metadata_url"; @SerializedName(SERIALIZED_NAME_METADATA_URL) @@ -99,6 +99,50 @@ public void setEmailAttribute(String emailAttribute) { this.emailAttribute = emailAttribute; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the IdentityProviderSaml instance itself + */ + public IdentityProviderSaml putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } IdentityProviderSaml identityProviderSaml = (IdentityProviderSaml) o; return Objects.equals(this.metadataUrl, identityProviderSaml.metadataUrl) && - Objects.equals(this.emailAttribute, identityProviderSaml.emailAttribute); + Objects.equals(this.emailAttribute, identityProviderSaml.emailAttribute)&& + Objects.equals(this.additionalProperties, identityProviderSaml.additionalProperties); } @Override public int hashCode() { - return Objects.hash(metadataUrl, emailAttribute); + return Objects.hash(metadataUrl, emailAttribute, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class IdentityProviderSaml {\n"); sb.append(" metadataUrl: ").append(toIndentedString(metadataUrl)).append("\n"); sb.append(" emailAttribute: ").append(toIndentedString(emailAttribute)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!IdentityProviderSaml.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IdentityProviderSaml` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : IdentityProviderSaml.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, IdentityProviderSaml value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, IdentityProviderSaml value) throws IOException public IdentityProviderSaml read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + IdentityProviderSaml instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/IdentityProviders.java b/src/main/java/saasus/sdk/auth/models/IdentityProviders.java index 506f30dc..9ba425ac 100644 --- a/src/main/java/saasus/sdk/auth/models/IdentityProviders.java +++ b/src/main/java/saasus/sdk/auth/models/IdentityProviders.java @@ -50,7 +50,7 @@ /** * IdentityProviders */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class IdentityProviders { public static final String SERIALIZED_NAME_GOOGLE = "google"; @SerializedName(SERIALIZED_NAME_GOOGLE) @@ -77,6 +77,50 @@ public void setGoogle(IdentityProviderProps google) { this.google = google; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the IdentityProviders instance itself + */ + public IdentityProviders putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -88,12 +132,13 @@ public boolean equals(Object o) { return false; } IdentityProviders identityProviders = (IdentityProviders) o; - return Objects.equals(this.google, identityProviders.google); + return Objects.equals(this.google, identityProviders.google)&& + Objects.equals(this.additionalProperties, identityProviders.additionalProperties); } @Override public int hashCode() { - return Objects.hash(google); + return Objects.hash(google, additionalProperties); } @Override @@ -101,6 +146,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class IdentityProviders {\n"); sb.append(" google: ").append(toIndentedString(google)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -143,14 +189,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!IdentityProviders.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IdentityProviders` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : IdentityProviders.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, IdentityProviders value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, IdentityProviders value) throws IOException { public IdentityProviders read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + IdentityProviders instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/Invitation.java b/src/main/java/saasus/sdk/auth/models/Invitation.java index 87a66fc5..dd82d6c6 100644 --- a/src/main/java/saasus/sdk/auth/models/Invitation.java +++ b/src/main/java/saasus/sdk/auth/models/Invitation.java @@ -53,7 +53,7 @@ /** * Invitation */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class Invitation { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -203,6 +203,50 @@ public void setStatus(InvitationStatus status) { this.status = status; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Invitation instance itself + */ + public Invitation putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -219,12 +263,13 @@ public boolean equals(Object o) { Objects.equals(this.invitationUrl, invitation.invitationUrl) && Objects.equals(this.envs, invitation.envs) && Objects.equals(this.expiredAt, invitation.expiredAt) && - Objects.equals(this.status, invitation.status); + Objects.equals(this.status, invitation.status)&& + Objects.equals(this.additionalProperties, invitation.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, email, invitationUrl, envs, expiredAt, status); + return Objects.hash(id, email, invitationUrl, envs, expiredAt, status, additionalProperties); } @Override @@ -237,6 +282,7 @@ public String toString() { sb.append(" envs: ").append(toIndentedString(envs)).append("\n"); sb.append(" expiredAt: ").append(toIndentedString(expiredAt)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -289,14 +335,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Invitation.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Invitation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Invitation.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -342,6 +380,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Invitation value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -349,7 +404,28 @@ public void write(JsonWriter out, Invitation value) throws IOException { public Invitation read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Invitation instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/InvitationValidity.java b/src/main/java/saasus/sdk/auth/models/InvitationValidity.java index 1616637e..f6d6fe12 100644 --- a/src/main/java/saasus/sdk/auth/models/InvitationValidity.java +++ b/src/main/java/saasus/sdk/auth/models/InvitationValidity.java @@ -49,7 +49,7 @@ /** * Invitation validity */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class InvitationValidity { public static final String SERIALIZED_NAME_IS_VALID = "is_valid"; @SerializedName(SERIALIZED_NAME_IS_VALID) @@ -76,6 +76,50 @@ public void setIsValid(Boolean isValid) { this.isValid = isValid; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the InvitationValidity instance itself + */ + public InvitationValidity putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } InvitationValidity invitationValidity = (InvitationValidity) o; - return Objects.equals(this.isValid, invitationValidity.isValid); + return Objects.equals(this.isValid, invitationValidity.isValid)&& + Objects.equals(this.additionalProperties, invitationValidity.additionalProperties); } @Override public int hashCode() { - return Objects.hash(isValid); + return Objects.hash(isValid, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class InvitationValidity {\n"); sb.append(" isValid: ").append(toIndentedString(isValid)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!InvitationValidity.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `InvitationValidity` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : InvitationValidity.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -174,6 +212,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, InvitationValidity value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -181,7 +236,28 @@ public void write(JsonWriter out, InvitationValidity value) throws IOException { public InvitationValidity read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + InvitationValidity instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/Invitations.java b/src/main/java/saasus/sdk/auth/models/Invitations.java index dd2e7bac..845e1c34 100644 --- a/src/main/java/saasus/sdk/auth/models/Invitations.java +++ b/src/main/java/saasus/sdk/auth/models/Invitations.java @@ -52,7 +52,7 @@ /** * Invitations */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class Invitations { public static final String SERIALIZED_NAME_INVITATIONS = "invitations"; @SerializedName(SERIALIZED_NAME_INVITATIONS) @@ -87,6 +87,50 @@ public void setInvitations(List invitations) { this.invitations = invitations; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Invitations instance itself + */ + public Invitations putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } Invitations invitations = (Invitations) o; - return Objects.equals(this.invitations, invitations.invitations); + return Objects.equals(this.invitations, invitations.invitations)&& + Objects.equals(this.additionalProperties, invitations.additionalProperties); } @Override public int hashCode() { - return Objects.hash(invitations); + return Objects.hash(invitations, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Invitations {\n"); sb.append(" invitations: ").append(toIndentedString(invitations)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Invitations.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Invitations` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Invitations.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Invitations value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, Invitations value) throws IOException { public Invitations read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Invitations instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/InvitedUserEnvironmentInformationInner.java b/src/main/java/saasus/sdk/auth/models/InvitedUserEnvironmentInformationInner.java index 30ad2647..26e15e24 100644 --- a/src/main/java/saasus/sdk/auth/models/InvitedUserEnvironmentInformationInner.java +++ b/src/main/java/saasus/sdk/auth/models/InvitedUserEnvironmentInformationInner.java @@ -51,7 +51,7 @@ /** * InvitedUserEnvironmentInformationInner */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class InvitedUserEnvironmentInformationInner { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -109,6 +109,50 @@ public void setRoleNames(List roleNames) { this.roleNames = roleNames; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the InvitedUserEnvironmentInformationInner instance itself + */ + public InvitedUserEnvironmentInformationInner putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -121,12 +165,13 @@ public boolean equals(Object o) { } InvitedUserEnvironmentInformationInner invitedUserEnvironmentInformationInner = (InvitedUserEnvironmentInformationInner) o; return Objects.equals(this.id, invitedUserEnvironmentInformationInner.id) && - Objects.equals(this.roleNames, invitedUserEnvironmentInformationInner.roleNames); + Objects.equals(this.roleNames, invitedUserEnvironmentInformationInner.roleNames)&& + Objects.equals(this.additionalProperties, invitedUserEnvironmentInformationInner.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, roleNames); + return Objects.hash(id, roleNames, additionalProperties); } @Override @@ -135,6 +180,7 @@ public String toString() { sb.append("class InvitedUserEnvironmentInformationInner {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" roleNames: ").append(toIndentedString(roleNames)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -179,14 +225,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!InvitedUserEnvironmentInformationInner.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `InvitedUserEnvironmentInformationInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : InvitedUserEnvironmentInformationInner.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -217,6 +255,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, InvitedUserEnvironmentInformationInner value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -224,7 +279,28 @@ public void write(JsonWriter out, InvitedUserEnvironmentInformationInner value) public InvitedUserEnvironmentInformationInner read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + InvitedUserEnvironmentInformationInner instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/LinkAwsMarketplaceParam.java b/src/main/java/saasus/sdk/auth/models/LinkAwsMarketplaceParam.java index 01541bfe..005b17be 100644 --- a/src/main/java/saasus/sdk/auth/models/LinkAwsMarketplaceParam.java +++ b/src/main/java/saasus/sdk/auth/models/LinkAwsMarketplaceParam.java @@ -49,7 +49,7 @@ /** * LinkAwsMarketplaceParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class LinkAwsMarketplaceParam { public static final String SERIALIZED_NAME_TENANT_ID = "tenant_id"; @SerializedName(SERIALIZED_NAME_TENANT_ID) @@ -122,6 +122,50 @@ public void setRegistrationToken(String registrationToken) { this.registrationToken = registrationToken; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the LinkAwsMarketplaceParam instance itself + */ + public LinkAwsMarketplaceParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -135,12 +179,13 @@ public boolean equals(Object o) { LinkAwsMarketplaceParam linkAwsMarketplaceParam = (LinkAwsMarketplaceParam) o; return Objects.equals(this.tenantId, linkAwsMarketplaceParam.tenantId) && Objects.equals(this.accessToken, linkAwsMarketplaceParam.accessToken) && - Objects.equals(this.registrationToken, linkAwsMarketplaceParam.registrationToken); + Objects.equals(this.registrationToken, linkAwsMarketplaceParam.registrationToken)&& + Objects.equals(this.additionalProperties, linkAwsMarketplaceParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(tenantId, accessToken, registrationToken); + return Objects.hash(tenantId, accessToken, registrationToken, additionalProperties); } @Override @@ -150,6 +195,7 @@ public String toString() { sb.append(" tenantId: ").append(toIndentedString(tenantId)).append("\n"); sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); sb.append(" registrationToken: ").append(toIndentedString(registrationToken)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -196,14 +242,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!LinkAwsMarketplaceParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LinkAwsMarketplaceParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : LinkAwsMarketplaceParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -237,6 +275,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, LinkAwsMarketplaceParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -244,7 +299,28 @@ public void write(JsonWriter out, LinkAwsMarketplaceParam value) throws IOExcept public LinkAwsMarketplaceParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + LinkAwsMarketplaceParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/MessageTemplate.java b/src/main/java/saasus/sdk/auth/models/MessageTemplate.java index 01b9c302..a517fb56 100644 --- a/src/main/java/saasus/sdk/auth/models/MessageTemplate.java +++ b/src/main/java/saasus/sdk/auth/models/MessageTemplate.java @@ -49,7 +49,7 @@ /** * MessageTemplate */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class MessageTemplate { public static final String SERIALIZED_NAME_SUBJECT = "subject"; @SerializedName(SERIALIZED_NAME_SUBJECT) @@ -99,6 +99,50 @@ public void setMessage(String message) { this.message = message; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MessageTemplate instance itself + */ + public MessageTemplate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } MessageTemplate messageTemplate = (MessageTemplate) o; return Objects.equals(this.subject, messageTemplate.subject) && - Objects.equals(this.message, messageTemplate.message); + Objects.equals(this.message, messageTemplate.message)&& + Objects.equals(this.additionalProperties, messageTemplate.additionalProperties); } @Override public int hashCode() { - return Objects.hash(subject, message); + return Objects.hash(subject, message, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class MessageTemplate {\n"); sb.append(" subject: ").append(toIndentedString(subject)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MessageTemplate.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MessageTemplate` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : MessageTemplate.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, MessageTemplate value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, MessageTemplate value) throws IOException { public MessageTemplate read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MessageTemplate instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/MfaConfiguration.java b/src/main/java/saasus/sdk/auth/models/MfaConfiguration.java index 13f26432..61c91dac 100644 --- a/src/main/java/saasus/sdk/auth/models/MfaConfiguration.java +++ b/src/main/java/saasus/sdk/auth/models/MfaConfiguration.java @@ -49,7 +49,7 @@ /** * MFA device authentication settings ※ This function is not yet provided, so it cannot be changed or saved. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class MfaConfiguration { /** * on: apply when all users log in optional: apply to individual users with MFA factor enabled ※ The parameter is currently optional and fixed. @@ -128,6 +128,50 @@ public void setMfaConfiguration(MfaConfigurationEnum mfaConfiguration) { this.mfaConfiguration = mfaConfiguration; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MfaConfiguration instance itself + */ + public MfaConfiguration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -139,12 +183,13 @@ public boolean equals(Object o) { return false; } MfaConfiguration mfaConfiguration = (MfaConfiguration) o; - return Objects.equals(this.mfaConfiguration, mfaConfiguration.mfaConfiguration); + return Objects.equals(this.mfaConfiguration, mfaConfiguration.mfaConfiguration)&& + Objects.equals(this.additionalProperties, mfaConfiguration.additionalProperties); } @Override public int hashCode() { - return Objects.hash(mfaConfiguration); + return Objects.hash(mfaConfiguration, additionalProperties); } @Override @@ -152,6 +197,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class MfaConfiguration {\n"); sb.append(" mfaConfiguration: ").append(toIndentedString(mfaConfiguration)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -194,14 +240,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MfaConfiguration.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MfaConfiguration` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : MfaConfiguration.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -231,6 +269,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, MfaConfiguration value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -238,7 +293,28 @@ public void write(JsonWriter out, MfaConfiguration value) throws IOException { public MfaConfiguration read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MfaConfiguration instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/MfaPreference.java b/src/main/java/saasus/sdk/auth/models/MfaPreference.java index 003de7c6..ef45c1b2 100644 --- a/src/main/java/saasus/sdk/auth/models/MfaPreference.java +++ b/src/main/java/saasus/sdk/auth/models/MfaPreference.java @@ -49,7 +49,7 @@ /** * MfaPreference */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class MfaPreference { public static final String SERIALIZED_NAME_ENABLED = "enabled"; @SerializedName(SERIALIZED_NAME_ENABLED) @@ -149,6 +149,50 @@ public void setMethod(MethodEnum method) { this.method = method; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MfaPreference instance itself + */ + public MfaPreference putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -161,12 +205,13 @@ public boolean equals(Object o) { } MfaPreference mfaPreference = (MfaPreference) o; return Objects.equals(this.enabled, mfaPreference.enabled) && - Objects.equals(this.method, mfaPreference.method); + Objects.equals(this.method, mfaPreference.method)&& + Objects.equals(this.additionalProperties, mfaPreference.additionalProperties); } @Override public int hashCode() { - return Objects.hash(enabled, method); + return Objects.hash(enabled, method, additionalProperties); } @Override @@ -175,6 +220,7 @@ public String toString() { sb.append("class MfaPreference {\n"); sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -218,14 +264,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MfaPreference.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MfaPreference` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : MfaPreference.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -257,6 +295,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, MfaPreference value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -264,7 +319,28 @@ public void write(JsonWriter out, MfaPreference value) throws IOException { public MfaPreference read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MfaPreference instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/NotificationMessages.java b/src/main/java/saasus/sdk/auth/models/NotificationMessages.java index 91d594ad..a3e565d6 100644 --- a/src/main/java/saasus/sdk/auth/models/NotificationMessages.java +++ b/src/main/java/saasus/sdk/auth/models/NotificationMessages.java @@ -50,7 +50,7 @@ /** * NotificationMessages */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class NotificationMessages { public static final String SERIALIZED_NAME_SIGN_UP = "sign_up"; @SerializedName(SERIALIZED_NAME_SIGN_UP) @@ -261,6 +261,50 @@ public void setVerifyExternalUser(MessageTemplate verifyExternalUser) { this.verifyExternalUser = verifyExternalUser; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NotificationMessages instance itself + */ + public NotificationMessages putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -280,12 +324,13 @@ public boolean equals(Object o) { Objects.equals(this.verifyUserAttribute, notificationMessages.verifyUserAttribute) && Objects.equals(this.authenticationMfa, notificationMessages.authenticationMfa) && Objects.equals(this.inviteTenantUser, notificationMessages.inviteTenantUser) && - Objects.equals(this.verifyExternalUser, notificationMessages.verifyExternalUser); + Objects.equals(this.verifyExternalUser, notificationMessages.verifyExternalUser)&& + Objects.equals(this.additionalProperties, notificationMessages.additionalProperties); } @Override public int hashCode() { - return Objects.hash(signUp, createUser, resendCode, forgotPassword, updateUserAttribute, verifyUserAttribute, authenticationMfa, inviteTenantUser, verifyExternalUser); + return Objects.hash(signUp, createUser, resendCode, forgotPassword, updateUserAttribute, verifyUserAttribute, authenticationMfa, inviteTenantUser, verifyExternalUser, additionalProperties); } @Override @@ -301,6 +346,7 @@ public String toString() { sb.append(" authenticationMfa: ").append(toIndentedString(authenticationMfa)).append("\n"); sb.append(" inviteTenantUser: ").append(toIndentedString(inviteTenantUser)).append("\n"); sb.append(" verifyExternalUser: ").append(toIndentedString(verifyExternalUser)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -359,14 +405,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!NotificationMessages.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `NotificationMessages` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : NotificationMessages.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -409,6 +447,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, NotificationMessages value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -416,7 +471,28 @@ public void write(JsonWriter out, NotificationMessages value) throws IOException public NotificationMessages read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NotificationMessages instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/PasswordPolicy.java b/src/main/java/saasus/sdk/auth/models/PasswordPolicy.java index 346e19c5..0d91bf0c 100644 --- a/src/main/java/saasus/sdk/auth/models/PasswordPolicy.java +++ b/src/main/java/saasus/sdk/auth/models/PasswordPolicy.java @@ -49,7 +49,7 @@ /** * Password Policy */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class PasswordPolicy { public static final String SERIALIZED_NAME_MINIMUM_LENGTH = "minimum_length"; @SerializedName(SERIALIZED_NAME_MINIMUM_LENGTH) @@ -191,6 +191,50 @@ public void setTemporaryPasswordValidityDays(Integer temporaryPasswordValidityDa this.temporaryPasswordValidityDays = temporaryPasswordValidityDays; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PasswordPolicy instance itself + */ + public PasswordPolicy putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -207,12 +251,13 @@ public boolean equals(Object o) { Objects.equals(this.isRequireNumbers, passwordPolicy.isRequireNumbers) && Objects.equals(this.isRequireSymbols, passwordPolicy.isRequireSymbols) && Objects.equals(this.isRequireUppercase, passwordPolicy.isRequireUppercase) && - Objects.equals(this.temporaryPasswordValidityDays, passwordPolicy.temporaryPasswordValidityDays); + Objects.equals(this.temporaryPasswordValidityDays, passwordPolicy.temporaryPasswordValidityDays)&& + Objects.equals(this.additionalProperties, passwordPolicy.additionalProperties); } @Override public int hashCode() { - return Objects.hash(minimumLength, isRequireLowercase, isRequireNumbers, isRequireSymbols, isRequireUppercase, temporaryPasswordValidityDays); + return Objects.hash(minimumLength, isRequireLowercase, isRequireNumbers, isRequireSymbols, isRequireUppercase, temporaryPasswordValidityDays, additionalProperties); } @Override @@ -225,6 +270,7 @@ public String toString() { sb.append(" isRequireSymbols: ").append(toIndentedString(isRequireSymbols)).append("\n"); sb.append(" isRequireUppercase: ").append(toIndentedString(isRequireUppercase)).append("\n"); sb.append(" temporaryPasswordValidityDays: ").append(toIndentedString(temporaryPasswordValidityDays)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -277,14 +323,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PasswordPolicy.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PasswordPolicy` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PasswordPolicy.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -309,6 +347,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PasswordPolicy value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -316,7 +371,28 @@ public void write(JsonWriter out, PasswordPolicy value) throws IOException { public PasswordPolicy read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PasswordPolicy instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/PlanHistories.java b/src/main/java/saasus/sdk/auth/models/PlanHistories.java index fdd01374..fdb7404e 100644 --- a/src/main/java/saasus/sdk/auth/models/PlanHistories.java +++ b/src/main/java/saasus/sdk/auth/models/PlanHistories.java @@ -52,7 +52,7 @@ /** * PlanHistories */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class PlanHistories { public static final String SERIALIZED_NAME_PLAN_HISTORIES = "plan_histories"; @SerializedName(SERIALIZED_NAME_PLAN_HISTORIES) @@ -87,6 +87,50 @@ public void setPlanHistories(List planHistories) { this.planHistories = planHistories; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PlanHistories instance itself + */ + public PlanHistories putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } PlanHistories planHistories = (PlanHistories) o; - return Objects.equals(this.planHistories, planHistories.planHistories); + return Objects.equals(this.planHistories, planHistories.planHistories)&& + Objects.equals(this.additionalProperties, planHistories.additionalProperties); } @Override public int hashCode() { - return Objects.hash(planHistories); + return Objects.hash(planHistories, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PlanHistories {\n"); sb.append(" planHistories: ").append(toIndentedString(planHistories)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PlanHistories.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PlanHistories` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PlanHistories.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PlanHistories value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, PlanHistories value) throws IOException { public PlanHistories read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PlanHistories instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/PlanHistory.java b/src/main/java/saasus/sdk/auth/models/PlanHistory.java index d8c673ae..5d181be9 100644 --- a/src/main/java/saasus/sdk/auth/models/PlanHistory.java +++ b/src/main/java/saasus/sdk/auth/models/PlanHistory.java @@ -50,7 +50,7 @@ /** * PlanHistory */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class PlanHistory { public static final String SERIALIZED_NAME_PLAN_ID = "plan_id"; @SerializedName(SERIALIZED_NAME_PLAN_ID) @@ -169,6 +169,50 @@ public void setDeleteUsage(Boolean deleteUsage) { this.deleteUsage = deleteUsage; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PlanHistory instance itself + */ + public PlanHistory putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -184,12 +228,13 @@ public boolean equals(Object o) { Objects.equals(this.planAppliedAt, planHistory.planAppliedAt) && Objects.equals(this.taxRateId, planHistory.taxRateId) && Objects.equals(this.prorationBehavior, planHistory.prorationBehavior) && - Objects.equals(this.deleteUsage, planHistory.deleteUsage); + Objects.equals(this.deleteUsage, planHistory.deleteUsage)&& + Objects.equals(this.additionalProperties, planHistory.additionalProperties); } @Override public int hashCode() { - return Objects.hash(planId, planAppliedAt, taxRateId, prorationBehavior, deleteUsage); + return Objects.hash(planId, planAppliedAt, taxRateId, prorationBehavior, deleteUsage, additionalProperties); } @Override @@ -201,6 +246,7 @@ public String toString() { sb.append(" taxRateId: ").append(toIndentedString(taxRateId)).append("\n"); sb.append(" prorationBehavior: ").append(toIndentedString(prorationBehavior)).append("\n"); sb.append(" deleteUsage: ").append(toIndentedString(deleteUsage)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -248,14 +294,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PlanHistory.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PlanHistory` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PlanHistory.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -290,6 +328,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PlanHistory value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -297,7 +352,28 @@ public void write(JsonWriter out, PlanHistory value) throws IOException { public PlanHistory read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PlanHistory instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/PlanReservation.java b/src/main/java/saasus/sdk/auth/models/PlanReservation.java index ca636966..c0d79b21 100644 --- a/src/main/java/saasus/sdk/auth/models/PlanReservation.java +++ b/src/main/java/saasus/sdk/auth/models/PlanReservation.java @@ -50,7 +50,7 @@ /** * PlanReservation */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class PlanReservation { public static final String SERIALIZED_NAME_NEXT_PLAN_ID = "next_plan_id"; @SerializedName(SERIALIZED_NAME_NEXT_PLAN_ID) @@ -169,6 +169,50 @@ public void setDeleteUsage(Boolean deleteUsage) { this.deleteUsage = deleteUsage; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PlanReservation instance itself + */ + public PlanReservation putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -184,12 +228,13 @@ public boolean equals(Object o) { Objects.equals(this.usingNextPlanFrom, planReservation.usingNextPlanFrom) && Objects.equals(this.nextPlanTaxRateId, planReservation.nextPlanTaxRateId) && Objects.equals(this.prorationBehavior, planReservation.prorationBehavior) && - Objects.equals(this.deleteUsage, planReservation.deleteUsage); + Objects.equals(this.deleteUsage, planReservation.deleteUsage)&& + Objects.equals(this.additionalProperties, planReservation.additionalProperties); } @Override public int hashCode() { - return Objects.hash(nextPlanId, usingNextPlanFrom, nextPlanTaxRateId, prorationBehavior, deleteUsage); + return Objects.hash(nextPlanId, usingNextPlanFrom, nextPlanTaxRateId, prorationBehavior, deleteUsage, additionalProperties); } @Override @@ -201,6 +246,7 @@ public String toString() { sb.append(" nextPlanTaxRateId: ").append(toIndentedString(nextPlanTaxRateId)).append("\n"); sb.append(" prorationBehavior: ").append(toIndentedString(prorationBehavior)).append("\n"); sb.append(" deleteUsage: ").append(toIndentedString(deleteUsage)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -245,14 +291,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format("The required field(s) %s in PlanReservation is not found in the empty JSON string", PlanReservation.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PlanReservation.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PlanReservation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("next_plan_id") != null && !jsonObj.get("next_plan_id").isJsonNull()) && !jsonObj.get("next_plan_id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `next_plan_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("next_plan_id").toString())); @@ -281,6 +319,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PlanReservation value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -288,7 +343,28 @@ public void write(JsonWriter out, PlanReservation value) throws IOException { public PlanReservation read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PlanReservation instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/RecaptchaProps.java b/src/main/java/saasus/sdk/auth/models/RecaptchaProps.java index d794e96d..d12caabc 100644 --- a/src/main/java/saasus/sdk/auth/models/RecaptchaProps.java +++ b/src/main/java/saasus/sdk/auth/models/RecaptchaProps.java @@ -49,7 +49,7 @@ /** * reCAPTCHA authentication settings ※ This function is not yet provided, so it cannot be changed or saved. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class RecaptchaProps { public static final String SERIALIZED_NAME_SITE_KEY = "site_key"; @SerializedName(SERIALIZED_NAME_SITE_KEY) @@ -99,6 +99,50 @@ public void setSecretKey(String secretKey) { this.secretKey = secretKey; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RecaptchaProps instance itself + */ + public RecaptchaProps putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } RecaptchaProps recaptchaProps = (RecaptchaProps) o; return Objects.equals(this.siteKey, recaptchaProps.siteKey) && - Objects.equals(this.secretKey, recaptchaProps.secretKey); + Objects.equals(this.secretKey, recaptchaProps.secretKey)&& + Objects.equals(this.additionalProperties, recaptchaProps.additionalProperties); } @Override public int hashCode() { - return Objects.hash(siteKey, secretKey); + return Objects.hash(siteKey, secretKey, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class RecaptchaProps {\n"); sb.append(" siteKey: ").append(toIndentedString(siteKey)).append("\n"); sb.append(" secretKey: ").append(toIndentedString(secretKey)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!RecaptchaProps.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RecaptchaProps` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : RecaptchaProps.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, RecaptchaProps value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, RecaptchaProps value) throws IOException { public RecaptchaProps read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RecaptchaProps instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/RequestEmailUpdateParam.java b/src/main/java/saasus/sdk/auth/models/RequestEmailUpdateParam.java index 32164901..ee350464 100644 --- a/src/main/java/saasus/sdk/auth/models/RequestEmailUpdateParam.java +++ b/src/main/java/saasus/sdk/auth/models/RequestEmailUpdateParam.java @@ -49,7 +49,7 @@ /** * RequestEmailUpdateParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class RequestEmailUpdateParam { public static final String SERIALIZED_NAME_EMAIL = "email"; @SerializedName(SERIALIZED_NAME_EMAIL) @@ -99,6 +99,50 @@ public void setAccessToken(String accessToken) { this.accessToken = accessToken; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RequestEmailUpdateParam instance itself + */ + public RequestEmailUpdateParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } RequestEmailUpdateParam requestEmailUpdateParam = (RequestEmailUpdateParam) o; return Objects.equals(this.email, requestEmailUpdateParam.email) && - Objects.equals(this.accessToken, requestEmailUpdateParam.accessToken); + Objects.equals(this.accessToken, requestEmailUpdateParam.accessToken)&& + Objects.equals(this.additionalProperties, requestEmailUpdateParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(email, accessToken); + return Objects.hash(email, accessToken, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class RequestEmailUpdateParam {\n"); sb.append(" email: ").append(toIndentedString(email)).append("\n"); sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!RequestEmailUpdateParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RequestEmailUpdateParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : RequestEmailUpdateParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, RequestEmailUpdateParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, RequestEmailUpdateParam value) throws IOExcept public RequestEmailUpdateParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RequestEmailUpdateParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/RequestExternalUserLinkParam.java b/src/main/java/saasus/sdk/auth/models/RequestExternalUserLinkParam.java index 6fc420d8..1e49c32f 100644 --- a/src/main/java/saasus/sdk/auth/models/RequestExternalUserLinkParam.java +++ b/src/main/java/saasus/sdk/auth/models/RequestExternalUserLinkParam.java @@ -49,7 +49,7 @@ /** * RequestExternalUserLinkParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class RequestExternalUserLinkParam { public static final String SERIALIZED_NAME_ACCESS_TOKEN = "access_token"; @SerializedName(SERIALIZED_NAME_ACCESS_TOKEN) @@ -76,6 +76,50 @@ public void setAccessToken(String accessToken) { this.accessToken = accessToken; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RequestExternalUserLinkParam instance itself + */ + public RequestExternalUserLinkParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } RequestExternalUserLinkParam requestExternalUserLinkParam = (RequestExternalUserLinkParam) o; - return Objects.equals(this.accessToken, requestExternalUserLinkParam.accessToken); + return Objects.equals(this.accessToken, requestExternalUserLinkParam.accessToken)&& + Objects.equals(this.additionalProperties, requestExternalUserLinkParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(accessToken); + return Objects.hash(accessToken, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class RequestExternalUserLinkParam {\n"); sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!RequestExternalUserLinkParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RequestExternalUserLinkParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : RequestExternalUserLinkParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, RequestExternalUserLinkParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, RequestExternalUserLinkParam value) throws IOE public RequestExternalUserLinkParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RequestExternalUserLinkParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/ResendSignUpConfirmationEmailParam.java b/src/main/java/saasus/sdk/auth/models/ResendSignUpConfirmationEmailParam.java index fb8738ff..de0e5ef7 100644 --- a/src/main/java/saasus/sdk/auth/models/ResendSignUpConfirmationEmailParam.java +++ b/src/main/java/saasus/sdk/auth/models/ResendSignUpConfirmationEmailParam.java @@ -49,7 +49,7 @@ /** * ResendSignUpConfirmationEmailParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class ResendSignUpConfirmationEmailParam { public static final String SERIALIZED_NAME_EMAIL = "email"; @SerializedName(SERIALIZED_NAME_EMAIL) @@ -76,6 +76,50 @@ public void setEmail(String email) { this.email = email; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ResendSignUpConfirmationEmailParam instance itself + */ + public ResendSignUpConfirmationEmailParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } ResendSignUpConfirmationEmailParam resendSignUpConfirmationEmailParam = (ResendSignUpConfirmationEmailParam) o; - return Objects.equals(this.email, resendSignUpConfirmationEmailParam.email); + return Objects.equals(this.email, resendSignUpConfirmationEmailParam.email)&& + Objects.equals(this.additionalProperties, resendSignUpConfirmationEmailParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(email); + return Objects.hash(email, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ResendSignUpConfirmationEmailParam {\n"); sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ResendSignUpConfirmationEmailParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ResendSignUpConfirmationEmailParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : ResendSignUpConfirmationEmailParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ResendSignUpConfirmationEmailParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, ResendSignUpConfirmationEmailParam value) thro public ResendSignUpConfirmationEmailParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ResendSignUpConfirmationEmailParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/Role.java b/src/main/java/saasus/sdk/auth/models/Role.java index d6e5d7b5..3d5f07a1 100644 --- a/src/main/java/saasus/sdk/auth/models/Role.java +++ b/src/main/java/saasus/sdk/auth/models/Role.java @@ -49,7 +49,7 @@ /** * role info */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class Role { public static final String SERIALIZED_NAME_ROLE_NAME = "role_name"; @SerializedName(SERIALIZED_NAME_ROLE_NAME) @@ -99,6 +99,50 @@ public void setDisplayName(String displayName) { this.displayName = displayName; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Role instance itself + */ + public Role putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } Role role = (Role) o; return Objects.equals(this.roleName, role.roleName) && - Objects.equals(this.displayName, role.displayName); + Objects.equals(this.displayName, role.displayName)&& + Objects.equals(this.additionalProperties, role.additionalProperties); } @Override public int hashCode() { - return Objects.hash(roleName, displayName); + return Objects.hash(roleName, displayName, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class Role {\n"); sb.append(" roleName: ").append(toIndentedString(roleName)).append("\n"); sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Role.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Role` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Role.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Role value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, Role value) throws IOException { public Role read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Role instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/Roles.java b/src/main/java/saasus/sdk/auth/models/Roles.java index d86a3831..a819c09a 100644 --- a/src/main/java/saasus/sdk/auth/models/Roles.java +++ b/src/main/java/saasus/sdk/auth/models/Roles.java @@ -52,7 +52,7 @@ /** * Roles */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class Roles { public static final String SERIALIZED_NAME_ROLES = "roles"; @SerializedName(SERIALIZED_NAME_ROLES) @@ -87,6 +87,50 @@ public void setRoles(List roles) { this.roles = roles; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Roles instance itself + */ + public Roles putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } Roles roles = (Roles) o; - return Objects.equals(this.roles, roles.roles); + return Objects.equals(this.roles, roles.roles)&& + Objects.equals(this.additionalProperties, roles.additionalProperties); } @Override public int hashCode() { - return Objects.hash(roles); + return Objects.hash(roles, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Roles {\n"); sb.append(" roles: ").append(toIndentedString(roles)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Roles.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Roles` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Roles.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Roles value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, Roles value) throws IOException { public Roles read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Roles instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/SaasId.java b/src/main/java/saasus/sdk/auth/models/SaasId.java index c0afecb3..3dfbf682 100644 --- a/src/main/java/saasus/sdk/auth/models/SaasId.java +++ b/src/main/java/saasus/sdk/auth/models/SaasId.java @@ -49,7 +49,7 @@ /** * SaasId */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class SaasId { public static final String SERIALIZED_NAME_TENANT_ID = "tenant_id"; @SerializedName(SERIALIZED_NAME_TENANT_ID) @@ -122,6 +122,50 @@ public void setSaasId(String saasId) { this.saasId = saasId; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SaasId instance itself + */ + public SaasId putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -135,12 +179,13 @@ public boolean equals(Object o) { SaasId saasId = (SaasId) o; return Objects.equals(this.tenantId, saasId.tenantId) && Objects.equals(this.envId, saasId.envId) && - Objects.equals(this.saasId, saasId.saasId); + Objects.equals(this.saasId, saasId.saasId)&& + Objects.equals(this.additionalProperties, saasId.additionalProperties); } @Override public int hashCode() { - return Objects.hash(tenantId, envId, saasId); + return Objects.hash(tenantId, envId, saasId, additionalProperties); } @Override @@ -150,6 +195,7 @@ public String toString() { sb.append(" tenantId: ").append(toIndentedString(tenantId)).append("\n"); sb.append(" envId: ").append(toIndentedString(envId)).append("\n"); sb.append(" saasId: ").append(toIndentedString(saasId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -196,14 +242,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SaasId.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaasId` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : SaasId.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -234,6 +272,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, SaasId value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -241,7 +296,28 @@ public void write(JsonWriter out, SaasId value) throws IOException { public SaasId read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SaasId instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/SaasUser.java b/src/main/java/saasus/sdk/auth/models/SaasUser.java index 667a6648..485ce708 100644 --- a/src/main/java/saasus/sdk/auth/models/SaasUser.java +++ b/src/main/java/saasus/sdk/auth/models/SaasUser.java @@ -21,6 +21,8 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -49,7 +51,7 @@ /** * SaasUser */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class SaasUser { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -59,6 +61,10 @@ public class SaasUser { @SerializedName(SERIALIZED_NAME_EMAIL) private String email; + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private Map attributes = new HashMap<>(); + public SaasUser() { } @@ -100,6 +106,77 @@ public void setEmail(String email) { } + public SaasUser attributes(Map attributes) { + this.attributes = attributes; + return this; + } + + public SaasUser putAttributesItem(String key, Object attributesItem) { + if (this.attributes == null) { + this.attributes = new HashMap<>(); + } + this.attributes.put(key, attributesItem); + return this; + } + + /** + * Attribute information + * @return attributes + **/ + @javax.annotation.Nonnull + public Map getAttributes() { + return attributes; + } + + public void setAttributes(Map attributes) { + this.attributes = attributes; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SaasUser instance itself + */ + public SaasUser putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + @Override public boolean equals(Object o) { @@ -111,12 +188,14 @@ public boolean equals(Object o) { } SaasUser saasUser = (SaasUser) o; return Objects.equals(this.id, saasUser.id) && - Objects.equals(this.email, saasUser.email); + Objects.equals(this.email, saasUser.email) && + Objects.equals(this.attributes, saasUser.attributes)&& + Objects.equals(this.additionalProperties, saasUser.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, email); + return Objects.hash(id, email, attributes, additionalProperties); } @Override @@ -125,6 +204,8 @@ public String toString() { sb.append("class SaasUser {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -149,11 +230,13 @@ private String toIndentedString(Object o) { openapiFields = new HashSet(); openapiFields.add("id"); openapiFields.add("email"); + openapiFields.add("attributes"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); openapiRequiredFields.add("id"); openapiRequiredFields.add("email"); + openapiRequiredFields.add("attributes"); } /** @@ -169,14 +252,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SaasUser.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaasUser` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : SaasUser.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +282,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, SaasUser value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +306,28 @@ public void write(JsonWriter out, SaasUser value) throws IOException { public SaasUser read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SaasUser instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/SaasUsers.java b/src/main/java/saasus/sdk/auth/models/SaasUsers.java index 473d92d6..51ce1d64 100644 --- a/src/main/java/saasus/sdk/auth/models/SaasUsers.java +++ b/src/main/java/saasus/sdk/auth/models/SaasUsers.java @@ -52,7 +52,7 @@ /** * SaasUsers */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class SaasUsers { public static final String SERIALIZED_NAME_USERS = "users"; @SerializedName(SERIALIZED_NAME_USERS) @@ -87,6 +87,50 @@ public void setUsers(List users) { this.users = users; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SaasUsers instance itself + */ + public SaasUsers putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } SaasUsers saasUsers = (SaasUsers) o; - return Objects.equals(this.users, saasUsers.users); + return Objects.equals(this.users, saasUsers.users)&& + Objects.equals(this.additionalProperties, saasUsers.additionalProperties); } @Override public int hashCode() { - return Objects.hash(users); + return Objects.hash(users, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SaasUsers {\n"); sb.append(" users: ").append(toIndentedString(users)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SaasUsers.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaasUsers` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : SaasUsers.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, SaasUsers value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, SaasUsers value) throws IOException { public SaasUsers read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SaasUsers instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/SelfRegist.java b/src/main/java/saasus/sdk/auth/models/SelfRegist.java index 0961c75f..e6a6094c 100644 --- a/src/main/java/saasus/sdk/auth/models/SelfRegist.java +++ b/src/main/java/saasus/sdk/auth/models/SelfRegist.java @@ -49,7 +49,7 @@ /** * self sign-up permission */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class SelfRegist { public static final String SERIALIZED_NAME_ENABLE = "enable"; @SerializedName(SERIALIZED_NAME_ENABLE) @@ -76,6 +76,50 @@ public void setEnable(Boolean enable) { this.enable = enable; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SelfRegist instance itself + */ + public SelfRegist putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } SelfRegist selfRegist = (SelfRegist) o; - return Objects.equals(this.enable, selfRegist.enable); + return Objects.equals(this.enable, selfRegist.enable)&& + Objects.equals(this.additionalProperties, selfRegist.additionalProperties); } @Override public int hashCode() { - return Objects.hash(enable); + return Objects.hash(enable, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SelfRegist {\n"); sb.append(" enable: ").append(toIndentedString(enable)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SelfRegist.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SelfRegist` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : SelfRegist.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -174,6 +212,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, SelfRegist value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -181,7 +236,28 @@ public void write(JsonWriter out, SelfRegist value) throws IOException { public SelfRegist read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SelfRegist instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/SignInSettings.java b/src/main/java/saasus/sdk/auth/models/SignInSettings.java index 632c83c3..929fb498 100644 --- a/src/main/java/saasus/sdk/auth/models/SignInSettings.java +++ b/src/main/java/saasus/sdk/auth/models/SignInSettings.java @@ -56,7 +56,7 @@ /** * SignInSettings */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class SignInSettings { public static final String SERIALIZED_NAME_PASSWORD_POLICY = "password_policy"; @SerializedName(SERIALIZED_NAME_PASSWORD_POLICY) @@ -221,6 +221,50 @@ public void setIdentityProviderConfiguration(IdentityProviderConfiguration ident this.identityProviderConfiguration = identityProviderConfiguration; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SignInSettings instance itself + */ + public SignInSettings putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -238,12 +282,13 @@ public boolean equals(Object o) { Objects.equals(this.recaptchaProps, signInSettings.recaptchaProps) && Objects.equals(this.accountVerification, signInSettings.accountVerification) && Objects.equals(this.selfRegist, signInSettings.selfRegist) && - Objects.equals(this.identityProviderConfiguration, signInSettings.identityProviderConfiguration); + Objects.equals(this.identityProviderConfiguration, signInSettings.identityProviderConfiguration)&& + Objects.equals(this.additionalProperties, signInSettings.additionalProperties); } @Override public int hashCode() { - return Objects.hash(passwordPolicy, deviceConfiguration, mfaConfiguration, recaptchaProps, accountVerification, selfRegist, identityProviderConfiguration); + return Objects.hash(passwordPolicy, deviceConfiguration, mfaConfiguration, recaptchaProps, accountVerification, selfRegist, identityProviderConfiguration, additionalProperties); } @Override @@ -257,6 +302,7 @@ public String toString() { sb.append(" accountVerification: ").append(toIndentedString(accountVerification)).append("\n"); sb.append(" selfRegist: ").append(toIndentedString(selfRegist)).append("\n"); sb.append(" identityProviderConfiguration: ").append(toIndentedString(identityProviderConfiguration)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -311,14 +357,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SignInSettings.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SignInSettings` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : SignInSettings.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -357,6 +395,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, SignInSettings value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -364,7 +419,28 @@ public void write(JsonWriter out, SignInSettings value) throws IOException { public SignInSettings read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SignInSettings instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/SignUpParam.java b/src/main/java/saasus/sdk/auth/models/SignUpParam.java index f86b0337..09d92ed7 100644 --- a/src/main/java/saasus/sdk/auth/models/SignUpParam.java +++ b/src/main/java/saasus/sdk/auth/models/SignUpParam.java @@ -49,7 +49,7 @@ /** * SignUpParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class SignUpParam { public static final String SERIALIZED_NAME_EMAIL = "email"; @SerializedName(SERIALIZED_NAME_EMAIL) @@ -76,6 +76,50 @@ public void setEmail(String email) { this.email = email; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SignUpParam instance itself + */ + public SignUpParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } SignUpParam signUpParam = (SignUpParam) o; - return Objects.equals(this.email, signUpParam.email); + return Objects.equals(this.email, signUpParam.email)&& + Objects.equals(this.additionalProperties, signUpParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(email); + return Objects.hash(email, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SignUpParam {\n"); sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SignUpParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SignUpParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : SignUpParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, SignUpParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, SignUpParam value) throws IOException { public SignUpParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SignUpParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/SignUpWithAwsMarketplaceParam.java b/src/main/java/saasus/sdk/auth/models/SignUpWithAwsMarketplaceParam.java index 5fdf29f4..a92e577a 100644 --- a/src/main/java/saasus/sdk/auth/models/SignUpWithAwsMarketplaceParam.java +++ b/src/main/java/saasus/sdk/auth/models/SignUpWithAwsMarketplaceParam.java @@ -49,7 +49,7 @@ /** * SignUpWithAwsMarketplaceParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class SignUpWithAwsMarketplaceParam { public static final String SERIALIZED_NAME_EMAIL = "email"; @SerializedName(SERIALIZED_NAME_EMAIL) @@ -99,6 +99,50 @@ public void setRegistrationToken(String registrationToken) { this.registrationToken = registrationToken; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SignUpWithAwsMarketplaceParam instance itself + */ + public SignUpWithAwsMarketplaceParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } SignUpWithAwsMarketplaceParam signUpWithAwsMarketplaceParam = (SignUpWithAwsMarketplaceParam) o; return Objects.equals(this.email, signUpWithAwsMarketplaceParam.email) && - Objects.equals(this.registrationToken, signUpWithAwsMarketplaceParam.registrationToken); + Objects.equals(this.registrationToken, signUpWithAwsMarketplaceParam.registrationToken)&& + Objects.equals(this.additionalProperties, signUpWithAwsMarketplaceParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(email, registrationToken); + return Objects.hash(email, registrationToken, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class SignUpWithAwsMarketplaceParam {\n"); sb.append(" email: ").append(toIndentedString(email)).append("\n"); sb.append(" registrationToken: ").append(toIndentedString(registrationToken)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SignUpWithAwsMarketplaceParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SignUpWithAwsMarketplaceParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : SignUpWithAwsMarketplaceParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, SignUpWithAwsMarketplaceParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, SignUpWithAwsMarketplaceParam value) throws IO public SignUpWithAwsMarketplaceParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SignUpWithAwsMarketplaceParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/SingleTenantSettings.java b/src/main/java/saasus/sdk/auth/models/SingleTenantSettings.java index 12f29bc8..b2c43a9c 100644 --- a/src/main/java/saasus/sdk/auth/models/SingleTenantSettings.java +++ b/src/main/java/saasus/sdk/auth/models/SingleTenantSettings.java @@ -49,7 +49,7 @@ /** * SingleTenantSettings */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class SingleTenantSettings { public static final String SERIALIZED_NAME_ENABLED = "enabled"; @SerializedName(SERIALIZED_NAME_ENABLED) @@ -168,6 +168,50 @@ public void setRoleExternalId(String roleExternalId) { this.roleExternalId = roleExternalId; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SingleTenantSettings instance itself + */ + public SingleTenantSettings putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -183,12 +227,13 @@ public boolean equals(Object o) { Objects.equals(this.roleArn, singleTenantSettings.roleArn) && Objects.equals(this.cloudformationTemplateUrl, singleTenantSettings.cloudformationTemplateUrl) && Objects.equals(this.ddlTemplateUrl, singleTenantSettings.ddlTemplateUrl) && - Objects.equals(this.roleExternalId, singleTenantSettings.roleExternalId); + Objects.equals(this.roleExternalId, singleTenantSettings.roleExternalId)&& + Objects.equals(this.additionalProperties, singleTenantSettings.additionalProperties); } @Override public int hashCode() { - return Objects.hash(enabled, roleArn, cloudformationTemplateUrl, ddlTemplateUrl, roleExternalId); + return Objects.hash(enabled, roleArn, cloudformationTemplateUrl, ddlTemplateUrl, roleExternalId, additionalProperties); } @Override @@ -200,6 +245,7 @@ public String toString() { sb.append(" cloudformationTemplateUrl: ").append(toIndentedString(cloudformationTemplateUrl)).append("\n"); sb.append(" ddlTemplateUrl: ").append(toIndentedString(ddlTemplateUrl)).append("\n"); sb.append(" roleExternalId: ").append(toIndentedString(roleExternalId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -250,14 +296,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SingleTenantSettings.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SingleTenantSettings` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : SingleTenantSettings.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -294,6 +332,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, SingleTenantSettings value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -301,7 +356,28 @@ public void write(JsonWriter out, SingleTenantSettings value) throws IOException public SingleTenantSettings read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SingleTenantSettings instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/SoftwareTokenSecretCode.java b/src/main/java/saasus/sdk/auth/models/SoftwareTokenSecretCode.java index d7959558..28ac1123 100644 --- a/src/main/java/saasus/sdk/auth/models/SoftwareTokenSecretCode.java +++ b/src/main/java/saasus/sdk/auth/models/SoftwareTokenSecretCode.java @@ -49,7 +49,7 @@ /** * SoftwareTokenSecretCode */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class SoftwareTokenSecretCode { public static final String SERIALIZED_NAME_SECRET_CODE = "secret_code"; @SerializedName(SERIALIZED_NAME_SECRET_CODE) @@ -76,6 +76,50 @@ public void setSecretCode(String secretCode) { this.secretCode = secretCode; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SoftwareTokenSecretCode instance itself + */ + public SoftwareTokenSecretCode putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } SoftwareTokenSecretCode softwareTokenSecretCode = (SoftwareTokenSecretCode) o; - return Objects.equals(this.secretCode, softwareTokenSecretCode.secretCode); + return Objects.equals(this.secretCode, softwareTokenSecretCode.secretCode)&& + Objects.equals(this.additionalProperties, softwareTokenSecretCode.additionalProperties); } @Override public int hashCode() { - return Objects.hash(secretCode); + return Objects.hash(secretCode, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SoftwareTokenSecretCode {\n"); sb.append(" secretCode: ").append(toIndentedString(secretCode)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SoftwareTokenSecretCode.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SoftwareTokenSecretCode` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : SoftwareTokenSecretCode.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, SoftwareTokenSecretCode value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, SoftwareTokenSecretCode value) throws IOExcept public SoftwareTokenSecretCode read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SoftwareTokenSecretCode instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/Tenant.java b/src/main/java/saasus/sdk/auth/models/Tenant.java index a624083c..84def97f 100644 --- a/src/main/java/saasus/sdk/auth/models/Tenant.java +++ b/src/main/java/saasus/sdk/auth/models/Tenant.java @@ -56,7 +56,7 @@ /** * Tenant */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class Tenant { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -352,6 +352,50 @@ public void setBillingInfo(BillingInfo billingInfo) { this.billingInfo = billingInfo; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tenant instance itself + */ + public Tenant putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -374,12 +418,13 @@ public boolean equals(Object o) { Objects.equals(this.planHistories, tenant.planHistories) && Objects.equals(this.id, tenant.id) && Objects.equals(this.planId, tenant.planId) && - Objects.equals(this.billingInfo, tenant.billingInfo); + Objects.equals(this.billingInfo, tenant.billingInfo)&& + Objects.equals(this.additionalProperties, tenant.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, attributes, backOfficeStaffEmail, nextPlanId, usingNextPlanFrom, nextPlanTaxRateId, prorationBehavior, deleteUsage, planHistories, id, planId, billingInfo); + return Objects.hash(name, attributes, backOfficeStaffEmail, nextPlanId, usingNextPlanFrom, nextPlanTaxRateId, prorationBehavior, deleteUsage, planHistories, id, planId, billingInfo, additionalProperties); } @Override @@ -398,6 +443,7 @@ public String toString() { sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" planId: ").append(toIndentedString(planId)).append("\n"); sb.append(" billingInfo: ").append(toIndentedString(billingInfo)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -455,14 +501,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Tenant.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Tenant` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Tenant.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -523,6 +561,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Tenant value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -530,7 +585,28 @@ public void write(JsonWriter out, Tenant value) throws IOException { public Tenant read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Tenant instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/TenantAttributes.java b/src/main/java/saasus/sdk/auth/models/TenantAttributes.java index 1acec223..70a4ca47 100644 --- a/src/main/java/saasus/sdk/auth/models/TenantAttributes.java +++ b/src/main/java/saasus/sdk/auth/models/TenantAttributes.java @@ -52,7 +52,7 @@ /** * TenantAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class TenantAttributes { public static final String SERIALIZED_NAME_TENANT_ATTRIBUTES = "tenant_attributes"; @SerializedName(SERIALIZED_NAME_TENANT_ATTRIBUTES) @@ -87,6 +87,50 @@ public void setTenantAttributes(List tenantAttributes) { this.tenantAttributes = tenantAttributes; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TenantAttributes instance itself + */ + public TenantAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } TenantAttributes tenantAttributes = (TenantAttributes) o; - return Objects.equals(this.tenantAttributes, tenantAttributes.tenantAttributes); + return Objects.equals(this.tenantAttributes, tenantAttributes.tenantAttributes)&& + Objects.equals(this.additionalProperties, tenantAttributes.additionalProperties); } @Override public int hashCode() { - return Objects.hash(tenantAttributes); + return Objects.hash(tenantAttributes, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TenantAttributes {\n"); sb.append(" tenantAttributes: ").append(toIndentedString(tenantAttributes)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!TenantAttributes.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TenantAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : TenantAttributes.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, TenantAttributes value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, TenantAttributes value) throws IOException { public TenantAttributes read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TenantAttributes instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/TenantDetail.java b/src/main/java/saasus/sdk/auth/models/TenantDetail.java index e421f458..82922aa2 100644 --- a/src/main/java/saasus/sdk/auth/models/TenantDetail.java +++ b/src/main/java/saasus/sdk/auth/models/TenantDetail.java @@ -56,7 +56,7 @@ /** * TenantDetail */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class TenantDetail { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -398,6 +398,50 @@ public void setCurrentPlanPeriodEnd(Integer currentPlanPeriodEnd) { this.currentPlanPeriodEnd = currentPlanPeriodEnd; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TenantDetail instance itself + */ + public TenantDetail putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -422,12 +466,13 @@ public boolean equals(Object o) { Objects.equals(this.deleteUsage, tenantDetail.deleteUsage) && Objects.equals(this.planHistories, tenantDetail.planHistories) && Objects.equals(this.currentPlanPeriodStart, tenantDetail.currentPlanPeriodStart) && - Objects.equals(this.currentPlanPeriodEnd, tenantDetail.currentPlanPeriodEnd); + Objects.equals(this.currentPlanPeriodEnd, tenantDetail.currentPlanPeriodEnd)&& + Objects.equals(this.additionalProperties, tenantDetail.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, planId, billingInfo, name, attributes, backOfficeStaffEmail, nextPlanId, usingNextPlanFrom, nextPlanTaxRateId, prorationBehavior, deleteUsage, planHistories, currentPlanPeriodStart, currentPlanPeriodEnd); + return Objects.hash(id, planId, billingInfo, name, attributes, backOfficeStaffEmail, nextPlanId, usingNextPlanFrom, nextPlanTaxRateId, prorationBehavior, deleteUsage, planHistories, currentPlanPeriodStart, currentPlanPeriodEnd, additionalProperties); } @Override @@ -448,6 +493,7 @@ public String toString() { sb.append(" planHistories: ").append(toIndentedString(planHistories)).append("\n"); sb.append(" currentPlanPeriodStart: ").append(toIndentedString(currentPlanPeriodStart)).append("\n"); sb.append(" currentPlanPeriodEnd: ").append(toIndentedString(currentPlanPeriodEnd)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -507,14 +553,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!TenantDetail.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TenantDetail` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : TenantDetail.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -575,6 +613,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, TenantDetail value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -582,7 +637,28 @@ public void write(JsonWriter out, TenantDetail value) throws IOException { public TenantDetail read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TenantDetail instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/TenantIdentityProviderProps.java b/src/main/java/saasus/sdk/auth/models/TenantIdentityProviderProps.java index 4f2b6eec..8d90c2c6 100644 --- a/src/main/java/saasus/sdk/auth/models/TenantIdentityProviderProps.java +++ b/src/main/java/saasus/sdk/auth/models/TenantIdentityProviderProps.java @@ -58,7 +58,7 @@ import saasus.sdk.auth.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class TenantIdentityProviderProps extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(TenantIdentityProviderProps.class.getName()); diff --git a/src/main/java/saasus/sdk/auth/models/TenantIdentityProviders.java b/src/main/java/saasus/sdk/auth/models/TenantIdentityProviders.java index eb73d682..d04e2fce 100644 --- a/src/main/java/saasus/sdk/auth/models/TenantIdentityProviders.java +++ b/src/main/java/saasus/sdk/auth/models/TenantIdentityProviders.java @@ -50,7 +50,7 @@ /** * TenantIdentityProviders */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class TenantIdentityProviders { public static final String SERIALIZED_NAME_SAML = "saml"; @SerializedName(SERIALIZED_NAME_SAML) @@ -77,6 +77,50 @@ public void setSaml(TenantIdentityProvidersSaml saml) { this.saml = saml; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TenantIdentityProviders instance itself + */ + public TenantIdentityProviders putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -88,12 +132,13 @@ public boolean equals(Object o) { return false; } TenantIdentityProviders tenantIdentityProviders = (TenantIdentityProviders) o; - return Objects.equals(this.saml, tenantIdentityProviders.saml); + return Objects.equals(this.saml, tenantIdentityProviders.saml)&& + Objects.equals(this.additionalProperties, tenantIdentityProviders.additionalProperties); } @Override public int hashCode() { - return Objects.hash(saml); + return Objects.hash(saml, additionalProperties); } @Override @@ -101,6 +146,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TenantIdentityProviders {\n"); sb.append(" saml: ").append(toIndentedString(saml)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -141,14 +187,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format("The required field(s) %s in TenantIdentityProviders is not found in the empty JSON string", TenantIdentityProviders.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!TenantIdentityProviders.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TenantIdentityProviders` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); // validate the optional field `saml` if (jsonObj.get("saml") != null && !jsonObj.get("saml").isJsonNull()) { @@ -171,6 +209,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, TenantIdentityProviders value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -178,7 +233,28 @@ public void write(JsonWriter out, TenantIdentityProviders value) throws IOExcept public TenantIdentityProviders read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TenantIdentityProviders instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/TenantIdentityProvidersSaml.java b/src/main/java/saasus/sdk/auth/models/TenantIdentityProvidersSaml.java index 3304b80c..a7691fd4 100644 --- a/src/main/java/saasus/sdk/auth/models/TenantIdentityProvidersSaml.java +++ b/src/main/java/saasus/sdk/auth/models/TenantIdentityProvidersSaml.java @@ -49,7 +49,7 @@ /** * TenantIdentityProvidersSaml */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class TenantIdentityProvidersSaml { public static final String SERIALIZED_NAME_METADATA_URL = "metadata_url"; @SerializedName(SERIALIZED_NAME_METADATA_URL) @@ -122,6 +122,50 @@ public void setSignInUrl(String signInUrl) { this.signInUrl = signInUrl; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TenantIdentityProvidersSaml instance itself + */ + public TenantIdentityProvidersSaml putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -135,12 +179,13 @@ public boolean equals(Object o) { TenantIdentityProvidersSaml tenantIdentityProvidersSaml = (TenantIdentityProvidersSaml) o; return Objects.equals(this.metadataUrl, tenantIdentityProvidersSaml.metadataUrl) && Objects.equals(this.emailAttribute, tenantIdentityProvidersSaml.emailAttribute) && - Objects.equals(this.signInUrl, tenantIdentityProvidersSaml.signInUrl); + Objects.equals(this.signInUrl, tenantIdentityProvidersSaml.signInUrl)&& + Objects.equals(this.additionalProperties, tenantIdentityProvidersSaml.additionalProperties); } @Override public int hashCode() { - return Objects.hash(metadataUrl, emailAttribute, signInUrl); + return Objects.hash(metadataUrl, emailAttribute, signInUrl, additionalProperties); } @Override @@ -150,6 +195,7 @@ public String toString() { sb.append(" metadataUrl: ").append(toIndentedString(metadataUrl)).append("\n"); sb.append(" emailAttribute: ").append(toIndentedString(emailAttribute)).append("\n"); sb.append(" signInUrl: ").append(toIndentedString(signInUrl)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -196,14 +242,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!TenantIdentityProvidersSaml.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TenantIdentityProvidersSaml` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : TenantIdentityProvidersSaml.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -237,6 +275,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, TenantIdentityProvidersSaml value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -244,7 +299,28 @@ public void write(JsonWriter out, TenantIdentityProvidersSaml value) throws IOEx public TenantIdentityProvidersSaml read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TenantIdentityProvidersSaml instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/TenantProps.java b/src/main/java/saasus/sdk/auth/models/TenantProps.java index 53f6e6bd..fc500313 100644 --- a/src/main/java/saasus/sdk/auth/models/TenantProps.java +++ b/src/main/java/saasus/sdk/auth/models/TenantProps.java @@ -51,7 +51,7 @@ /** * TenantProps */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class TenantProps { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -132,6 +132,50 @@ public void setBackOfficeStaffEmail(String backOfficeStaffEmail) { this.backOfficeStaffEmail = backOfficeStaffEmail; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TenantProps instance itself + */ + public TenantProps putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -145,12 +189,13 @@ public boolean equals(Object o) { TenantProps tenantProps = (TenantProps) o; return Objects.equals(this.name, tenantProps.name) && Objects.equals(this.attributes, tenantProps.attributes) && - Objects.equals(this.backOfficeStaffEmail, tenantProps.backOfficeStaffEmail); + Objects.equals(this.backOfficeStaffEmail, tenantProps.backOfficeStaffEmail)&& + Objects.equals(this.additionalProperties, tenantProps.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, attributes, backOfficeStaffEmail); + return Objects.hash(name, attributes, backOfficeStaffEmail, additionalProperties); } @Override @@ -160,6 +205,7 @@ public String toString() { sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); sb.append(" backOfficeStaffEmail: ").append(toIndentedString(backOfficeStaffEmail)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -206,14 +252,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!TenantProps.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TenantProps` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : TenantProps.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -244,6 +282,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, TenantProps value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -251,7 +306,28 @@ public void write(JsonWriter out, TenantProps value) throws IOException { public TenantProps read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TenantProps instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/Tenants.java b/src/main/java/saasus/sdk/auth/models/Tenants.java index 17a9e737..cdd55e0c 100644 --- a/src/main/java/saasus/sdk/auth/models/Tenants.java +++ b/src/main/java/saasus/sdk/auth/models/Tenants.java @@ -52,7 +52,7 @@ /** * Tenant Info */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class Tenants { public static final String SERIALIZED_NAME_TENANTS = "tenants"; @SerializedName(SERIALIZED_NAME_TENANTS) @@ -87,6 +87,50 @@ public void setTenants(List tenants) { this.tenants = tenants; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tenants instance itself + */ + public Tenants putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } Tenants tenants = (Tenants) o; - return Objects.equals(this.tenants, tenants.tenants); + return Objects.equals(this.tenants, tenants.tenants)&& + Objects.equals(this.additionalProperties, tenants.additionalProperties); } @Override public int hashCode() { - return Objects.hash(tenants); + return Objects.hash(tenants, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Tenants {\n"); sb.append(" tenants: ").append(toIndentedString(tenants)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Tenants.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Tenants` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Tenants.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Tenants value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, Tenants value) throws IOException { public Tenants read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Tenants instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/UpdateBasicInfoParam.java b/src/main/java/saasus/sdk/auth/models/UpdateBasicInfoParam.java index 5c8b9206..a0eba8a6 100644 --- a/src/main/java/saasus/sdk/auth/models/UpdateBasicInfoParam.java +++ b/src/main/java/saasus/sdk/auth/models/UpdateBasicInfoParam.java @@ -49,7 +49,7 @@ /** * UpdateBasicInfoParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class UpdateBasicInfoParam { public static final String SERIALIZED_NAME_DOMAIN_NAME = "domain_name"; @SerializedName(SERIALIZED_NAME_DOMAIN_NAME) @@ -122,6 +122,50 @@ public void setReplyEmailAddress(String replyEmailAddress) { this.replyEmailAddress = replyEmailAddress; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateBasicInfoParam instance itself + */ + public UpdateBasicInfoParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -135,12 +179,13 @@ public boolean equals(Object o) { UpdateBasicInfoParam updateBasicInfoParam = (UpdateBasicInfoParam) o; return Objects.equals(this.domainName, updateBasicInfoParam.domainName) && Objects.equals(this.fromEmailAddress, updateBasicInfoParam.fromEmailAddress) && - Objects.equals(this.replyEmailAddress, updateBasicInfoParam.replyEmailAddress); + Objects.equals(this.replyEmailAddress, updateBasicInfoParam.replyEmailAddress)&& + Objects.equals(this.additionalProperties, updateBasicInfoParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(domainName, fromEmailAddress, replyEmailAddress); + return Objects.hash(domainName, fromEmailAddress, replyEmailAddress, additionalProperties); } @Override @@ -150,6 +195,7 @@ public String toString() { sb.append(" domainName: ").append(toIndentedString(domainName)).append("\n"); sb.append(" fromEmailAddress: ").append(toIndentedString(fromEmailAddress)).append("\n"); sb.append(" replyEmailAddress: ").append(toIndentedString(replyEmailAddress)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -195,14 +241,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateBasicInfoParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateBasicInfoParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UpdateBasicInfoParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -236,6 +274,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateBasicInfoParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -243,7 +298,28 @@ public void write(JsonWriter out, UpdateBasicInfoParam value) throws IOException public UpdateBasicInfoParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateBasicInfoParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/UpdateCustomizePageSettingsParam.java b/src/main/java/saasus/sdk/auth/models/UpdateCustomizePageSettingsParam.java index e2b30016..58b7addb 100644 --- a/src/main/java/saasus/sdk/auth/models/UpdateCustomizePageSettingsParam.java +++ b/src/main/java/saasus/sdk/auth/models/UpdateCustomizePageSettingsParam.java @@ -49,7 +49,7 @@ /** * UpdateCustomizePageSettingsParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class UpdateCustomizePageSettingsParam { public static final String SERIALIZED_NAME_TITLE = "title"; @SerializedName(SERIALIZED_NAME_TITLE) @@ -191,6 +191,50 @@ public void setFavicon(String favicon) { this.favicon = favicon; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateCustomizePageSettingsParam instance itself + */ + public UpdateCustomizePageSettingsParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -207,12 +251,13 @@ public boolean equals(Object o) { Objects.equals(this.privacyPolicyUrl, updateCustomizePageSettingsParam.privacyPolicyUrl) && Objects.equals(this.googleTagManagerContainerId, updateCustomizePageSettingsParam.googleTagManagerContainerId) && Objects.equals(this.icon, updateCustomizePageSettingsParam.icon) && - Objects.equals(this.favicon, updateCustomizePageSettingsParam.favicon); + Objects.equals(this.favicon, updateCustomizePageSettingsParam.favicon)&& + Objects.equals(this.additionalProperties, updateCustomizePageSettingsParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(title, termsOfServiceUrl, privacyPolicyUrl, googleTagManagerContainerId, icon, favicon); + return Objects.hash(title, termsOfServiceUrl, privacyPolicyUrl, googleTagManagerContainerId, icon, favicon, additionalProperties); } @Override @@ -225,6 +270,7 @@ public String toString() { sb.append(" googleTagManagerContainerId: ").append(toIndentedString(googleTagManagerContainerId)).append("\n"); sb.append(" icon: ").append(toIndentedString(icon)).append("\n"); sb.append(" favicon: ").append(toIndentedString(favicon)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -277,14 +323,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateCustomizePageSettingsParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateCustomizePageSettingsParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UpdateCustomizePageSettingsParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -327,6 +365,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateCustomizePageSettingsParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -334,7 +389,28 @@ public void write(JsonWriter out, UpdateCustomizePageSettingsParam value) throws public UpdateCustomizePageSettingsParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateCustomizePageSettingsParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/UpdateCustomizePagesParam.java b/src/main/java/saasus/sdk/auth/models/UpdateCustomizePagesParam.java index e2829561..c5b6728f 100644 --- a/src/main/java/saasus/sdk/auth/models/UpdateCustomizePagesParam.java +++ b/src/main/java/saasus/sdk/auth/models/UpdateCustomizePagesParam.java @@ -50,7 +50,7 @@ /** * UpdateCustomizePagesParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class UpdateCustomizePagesParam { public static final String SERIALIZED_NAME_SIGN_UP_PAGE = "sign_up_page"; @SerializedName(SERIALIZED_NAME_SIGN_UP_PAGE) @@ -123,6 +123,50 @@ public void setPasswordResetPage(CustomizePageProps passwordResetPage) { this.passwordResetPage = passwordResetPage; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateCustomizePagesParam instance itself + */ + public UpdateCustomizePagesParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -136,12 +180,13 @@ public boolean equals(Object o) { UpdateCustomizePagesParam updateCustomizePagesParam = (UpdateCustomizePagesParam) o; return Objects.equals(this.signUpPage, updateCustomizePagesParam.signUpPage) && Objects.equals(this.signInPage, updateCustomizePagesParam.signInPage) && - Objects.equals(this.passwordResetPage, updateCustomizePagesParam.passwordResetPage); + Objects.equals(this.passwordResetPage, updateCustomizePagesParam.passwordResetPage)&& + Objects.equals(this.additionalProperties, updateCustomizePagesParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(signUpPage, signInPage, passwordResetPage); + return Objects.hash(signUpPage, signInPage, passwordResetPage, additionalProperties); } @Override @@ -151,6 +196,7 @@ public String toString() { sb.append(" signUpPage: ").append(toIndentedString(signUpPage)).append("\n"); sb.append(" signInPage: ").append(toIndentedString(signInPage)).append("\n"); sb.append(" passwordResetPage: ").append(toIndentedString(passwordResetPage)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -193,14 +239,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateCustomizePagesParam is not found in the empty JSON string", UpdateCustomizePagesParam.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateCustomizePagesParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateCustomizePagesParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); // validate the optional field `sign_up_page` if (jsonObj.get("sign_up_page") != null && !jsonObj.get("sign_up_page").isJsonNull()) { @@ -231,6 +269,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateCustomizePagesParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -238,7 +293,28 @@ public void write(JsonWriter out, UpdateCustomizePagesParam value) throws IOExce public UpdateCustomizePagesParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateCustomizePagesParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/UpdateEnvParam.java b/src/main/java/saasus/sdk/auth/models/UpdateEnvParam.java index 72bf95a2..e6c9958c 100644 --- a/src/main/java/saasus/sdk/auth/models/UpdateEnvParam.java +++ b/src/main/java/saasus/sdk/auth/models/UpdateEnvParam.java @@ -49,7 +49,7 @@ /** * UpdateEnvParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class UpdateEnvParam { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -99,6 +99,50 @@ public void setDisplayName(String displayName) { this.displayName = displayName; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateEnvParam instance itself + */ + public UpdateEnvParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } UpdateEnvParam updateEnvParam = (UpdateEnvParam) o; return Objects.equals(this.name, updateEnvParam.name) && - Objects.equals(this.displayName, updateEnvParam.displayName); + Objects.equals(this.displayName, updateEnvParam.displayName)&& + Objects.equals(this.additionalProperties, updateEnvParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, displayName); + return Objects.hash(name, displayName, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class UpdateEnvParam {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -168,14 +214,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateEnvParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateEnvParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UpdateEnvParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -206,6 +244,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateEnvParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -213,7 +268,28 @@ public void write(JsonWriter out, UpdateEnvParam value) throws IOException { public UpdateEnvParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateEnvParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/UpdateIdentityProviderParam.java b/src/main/java/saasus/sdk/auth/models/UpdateIdentityProviderParam.java index f372ff2b..f9fac239 100644 --- a/src/main/java/saasus/sdk/auth/models/UpdateIdentityProviderParam.java +++ b/src/main/java/saasus/sdk/auth/models/UpdateIdentityProviderParam.java @@ -51,7 +51,7 @@ /** * UpdateIdentityProviderParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class UpdateIdentityProviderParam { public static final String SERIALIZED_NAME_PROVIDER = "provider"; @SerializedName(SERIALIZED_NAME_PROVIDER) @@ -101,6 +101,50 @@ public void setIdentityProviderProps(IdentityProviderProps identityProviderProps this.identityProviderProps = identityProviderProps; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateIdentityProviderParam instance itself + */ + public UpdateIdentityProviderParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -113,12 +157,13 @@ public boolean equals(Object o) { } UpdateIdentityProviderParam updateIdentityProviderParam = (UpdateIdentityProviderParam) o; return Objects.equals(this.provider, updateIdentityProviderParam.provider) && - Objects.equals(this.identityProviderProps, updateIdentityProviderParam.identityProviderProps); + Objects.equals(this.identityProviderProps, updateIdentityProviderParam.identityProviderProps)&& + Objects.equals(this.additionalProperties, updateIdentityProviderParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(provider, identityProviderProps); + return Objects.hash(provider, identityProviderProps, additionalProperties); } @Override @@ -127,6 +172,7 @@ public String toString() { sb.append("class UpdateIdentityProviderParam {\n"); sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); sb.append(" identityProviderProps: ").append(toIndentedString(identityProviderProps)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -170,14 +216,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateIdentityProviderParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateIdentityProviderParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UpdateIdentityProviderParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -208,6 +246,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateIdentityProviderParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -215,7 +270,28 @@ public void write(JsonWriter out, UpdateIdentityProviderParam value) throws IOEx public UpdateIdentityProviderParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateIdentityProviderParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/UpdateNotificationMessagesParam.java b/src/main/java/saasus/sdk/auth/models/UpdateNotificationMessagesParam.java index ae7195a1..fdbe6b07 100644 --- a/src/main/java/saasus/sdk/auth/models/UpdateNotificationMessagesParam.java +++ b/src/main/java/saasus/sdk/auth/models/UpdateNotificationMessagesParam.java @@ -50,7 +50,7 @@ /** * UpdateNotificationMessagesParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class UpdateNotificationMessagesParam { public static final String SERIALIZED_NAME_SIGN_UP = "sign_up"; @SerializedName(SERIALIZED_NAME_SIGN_UP) @@ -261,6 +261,50 @@ public void setVerifyExternalUser(MessageTemplate verifyExternalUser) { this.verifyExternalUser = verifyExternalUser; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateNotificationMessagesParam instance itself + */ + public UpdateNotificationMessagesParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -280,12 +324,13 @@ public boolean equals(Object o) { Objects.equals(this.verifyUserAttribute, updateNotificationMessagesParam.verifyUserAttribute) && Objects.equals(this.authenticationMfa, updateNotificationMessagesParam.authenticationMfa) && Objects.equals(this.inviteTenantUser, updateNotificationMessagesParam.inviteTenantUser) && - Objects.equals(this.verifyExternalUser, updateNotificationMessagesParam.verifyExternalUser); + Objects.equals(this.verifyExternalUser, updateNotificationMessagesParam.verifyExternalUser)&& + Objects.equals(this.additionalProperties, updateNotificationMessagesParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(signUp, createUser, resendCode, forgotPassword, updateUserAttribute, verifyUserAttribute, authenticationMfa, inviteTenantUser, verifyExternalUser); + return Objects.hash(signUp, createUser, resendCode, forgotPassword, updateUserAttribute, verifyUserAttribute, authenticationMfa, inviteTenantUser, verifyExternalUser, additionalProperties); } @Override @@ -301,6 +346,7 @@ public String toString() { sb.append(" authenticationMfa: ").append(toIndentedString(authenticationMfa)).append("\n"); sb.append(" inviteTenantUser: ").append(toIndentedString(inviteTenantUser)).append("\n"); sb.append(" verifyExternalUser: ").append(toIndentedString(verifyExternalUser)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -349,14 +395,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateNotificationMessagesParam is not found in the empty JSON string", UpdateNotificationMessagesParam.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateNotificationMessagesParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateNotificationMessagesParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); // validate the optional field `sign_up` if (jsonObj.get("sign_up") != null && !jsonObj.get("sign_up").isJsonNull()) { @@ -411,6 +449,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateNotificationMessagesParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -418,7 +473,28 @@ public void write(JsonWriter out, UpdateNotificationMessagesParam value) throws public UpdateNotificationMessagesParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateNotificationMessagesParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/UpdateSaasUserAttributesParam.java b/src/main/java/saasus/sdk/auth/models/UpdateSaasUserAttributesParam.java new file mode 100644 index 00000000..30bd0348 --- /dev/null +++ b/src/main/java/saasus/sdk/auth/models/UpdateSaasUserAttributesParam.java @@ -0,0 +1,297 @@ +/* + * SaaSus Auth API Schema + * Schema + * + * 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 saasus.sdk.auth.models; + +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.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import saasus.sdk.auth.JSON; + +/** + * UpdateSaasUserAttributesParam + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") +public class UpdateSaasUserAttributesParam { + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + private Map attributes = new HashMap<>(); + + public UpdateSaasUserAttributesParam() { + } + + public UpdateSaasUserAttributesParam attributes(Map attributes) { + this.attributes = attributes; + return this; + } + + public UpdateSaasUserAttributesParam putAttributesItem(String key, Object attributesItem) { + if (this.attributes == null) { + this.attributes = new HashMap<>(); + } + this.attributes.put(key, attributesItem); + return this; + } + + /** + * Attribute information + * @return attributes + **/ + @javax.annotation.Nonnull + public Map getAttributes() { + return attributes; + } + + public void setAttributes(Map attributes) { + this.attributes = attributes; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateSaasUserAttributesParam instance itself + */ + public UpdateSaasUserAttributesParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSaasUserAttributesParam updateSaasUserAttributesParam = (UpdateSaasUserAttributesParam) o; + return Objects.equals(this.attributes, updateSaasUserAttributesParam.attributes)&& + Objects.equals(this.additionalProperties, updateSaasUserAttributesParam.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSaasUserAttributesParam {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("attributes"); + } + + /** + * 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 UpdateSaasUserAttributesParam + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSaasUserAttributesParam.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSaasUserAttributesParam is not found in the empty JSON string", UpdateSaasUserAttributesParam.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateSaasUserAttributesParam.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSaasUserAttributesParam.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSaasUserAttributesParam' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSaasUserAttributesParam.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSaasUserAttributesParam value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdateSaasUserAttributesParam read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateSaasUserAttributesParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSaasUserAttributesParam given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSaasUserAttributesParam + * @throws IOException if the JSON string is invalid with respect to UpdateSaasUserAttributesParam + */ + public static UpdateSaasUserAttributesParam fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSaasUserAttributesParam.class); + } + + /** + * Convert an instance of UpdateSaasUserAttributesParam to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/saasus/sdk/auth/models/UpdateSaasUserEmailParam.java b/src/main/java/saasus/sdk/auth/models/UpdateSaasUserEmailParam.java index 69dd7f51..4ea28cba 100644 --- a/src/main/java/saasus/sdk/auth/models/UpdateSaasUserEmailParam.java +++ b/src/main/java/saasus/sdk/auth/models/UpdateSaasUserEmailParam.java @@ -49,7 +49,7 @@ /** * UpdateSaasUserEmailParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class UpdateSaasUserEmailParam { public static final String SERIALIZED_NAME_EMAIL = "email"; @SerializedName(SERIALIZED_NAME_EMAIL) @@ -76,6 +76,50 @@ public void setEmail(String email) { this.email = email; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateSaasUserEmailParam instance itself + */ + public UpdateSaasUserEmailParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } UpdateSaasUserEmailParam updateSaasUserEmailParam = (UpdateSaasUserEmailParam) o; - return Objects.equals(this.email, updateSaasUserEmailParam.email); + return Objects.equals(this.email, updateSaasUserEmailParam.email)&& + Objects.equals(this.additionalProperties, updateSaasUserEmailParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(email); + return Objects.hash(email, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class UpdateSaasUserEmailParam {\n"); sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateSaasUserEmailParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSaasUserEmailParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UpdateSaasUserEmailParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateSaasUserEmailParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, UpdateSaasUserEmailParam value) throws IOExcep public UpdateSaasUserEmailParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateSaasUserEmailParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/UpdateSaasUserPasswordParam.java b/src/main/java/saasus/sdk/auth/models/UpdateSaasUserPasswordParam.java index 5f29d297..72255b0b 100644 --- a/src/main/java/saasus/sdk/auth/models/UpdateSaasUserPasswordParam.java +++ b/src/main/java/saasus/sdk/auth/models/UpdateSaasUserPasswordParam.java @@ -49,7 +49,7 @@ /** * UpdateSaasUserPasswordParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class UpdateSaasUserPasswordParam { public static final String SERIALIZED_NAME_PASSWORD = "password"; @SerializedName(SERIALIZED_NAME_PASSWORD) @@ -76,6 +76,50 @@ public void setPassword(String password) { this.password = password; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateSaasUserPasswordParam instance itself + */ + public UpdateSaasUserPasswordParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } UpdateSaasUserPasswordParam updateSaasUserPasswordParam = (UpdateSaasUserPasswordParam) o; - return Objects.equals(this.password, updateSaasUserPasswordParam.password); + return Objects.equals(this.password, updateSaasUserPasswordParam.password)&& + Objects.equals(this.additionalProperties, updateSaasUserPasswordParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(password); + return Objects.hash(password, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class UpdateSaasUserPasswordParam {\n"); sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateSaasUserPasswordParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSaasUserPasswordParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UpdateSaasUserPasswordParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateSaasUserPasswordParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, UpdateSaasUserPasswordParam value) throws IOEx public UpdateSaasUserPasswordParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateSaasUserPasswordParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/UpdateSignInSettingsParam.java b/src/main/java/saasus/sdk/auth/models/UpdateSignInSettingsParam.java index 1181fe09..f9c0829e 100644 --- a/src/main/java/saasus/sdk/auth/models/UpdateSignInSettingsParam.java +++ b/src/main/java/saasus/sdk/auth/models/UpdateSignInSettingsParam.java @@ -55,7 +55,7 @@ /** * UpdateSignInSettingsParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class UpdateSignInSettingsParam { public static final String SERIALIZED_NAME_PASSWORD_POLICY = "password_policy"; @SerializedName(SERIALIZED_NAME_PASSWORD_POLICY) @@ -197,6 +197,50 @@ public void setSelfRegist(SelfRegist selfRegist) { this.selfRegist = selfRegist; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateSignInSettingsParam instance itself + */ + public UpdateSignInSettingsParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -213,12 +257,13 @@ public boolean equals(Object o) { Objects.equals(this.mfaConfiguration, updateSignInSettingsParam.mfaConfiguration) && Objects.equals(this.recaptchaProps, updateSignInSettingsParam.recaptchaProps) && Objects.equals(this.accountVerification, updateSignInSettingsParam.accountVerification) && - Objects.equals(this.selfRegist, updateSignInSettingsParam.selfRegist); + Objects.equals(this.selfRegist, updateSignInSettingsParam.selfRegist)&& + Objects.equals(this.additionalProperties, updateSignInSettingsParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(passwordPolicy, deviceConfiguration, mfaConfiguration, recaptchaProps, accountVerification, selfRegist); + return Objects.hash(passwordPolicy, deviceConfiguration, mfaConfiguration, recaptchaProps, accountVerification, selfRegist, additionalProperties); } @Override @@ -231,6 +276,7 @@ public String toString() { sb.append(" recaptchaProps: ").append(toIndentedString(recaptchaProps)).append("\n"); sb.append(" accountVerification: ").append(toIndentedString(accountVerification)).append("\n"); sb.append(" selfRegist: ").append(toIndentedString(selfRegist)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -276,14 +322,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSignInSettingsParam is not found in the empty JSON string", UpdateSignInSettingsParam.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateSignInSettingsParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSignInSettingsParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); // validate the optional field `password_policy` if (jsonObj.get("password_policy") != null && !jsonObj.get("password_policy").isJsonNull()) { @@ -326,6 +364,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateSignInSettingsParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -333,7 +388,28 @@ public void write(JsonWriter out, UpdateSignInSettingsParam value) throws IOExce public UpdateSignInSettingsParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateSignInSettingsParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/UpdateSingleTenantSettingsParam.java b/src/main/java/saasus/sdk/auth/models/UpdateSingleTenantSettingsParam.java index 6483fda4..f03a582a 100644 --- a/src/main/java/saasus/sdk/auth/models/UpdateSingleTenantSettingsParam.java +++ b/src/main/java/saasus/sdk/auth/models/UpdateSingleTenantSettingsParam.java @@ -49,7 +49,7 @@ /** * UpdateSingleTenantSettingsParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class UpdateSingleTenantSettingsParam { public static final String SERIALIZED_NAME_ENABLED = "enabled"; @SerializedName(SERIALIZED_NAME_ENABLED) @@ -168,6 +168,50 @@ public void setRoleExternalId(String roleExternalId) { this.roleExternalId = roleExternalId; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateSingleTenantSettingsParam instance itself + */ + public UpdateSingleTenantSettingsParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -183,12 +227,13 @@ public boolean equals(Object o) { Objects.equals(this.roleArn, updateSingleTenantSettingsParam.roleArn) && Objects.equals(this.cloudformationTemplate, updateSingleTenantSettingsParam.cloudformationTemplate) && Objects.equals(this.ddlTemplate, updateSingleTenantSettingsParam.ddlTemplate) && - Objects.equals(this.roleExternalId, updateSingleTenantSettingsParam.roleExternalId); + Objects.equals(this.roleExternalId, updateSingleTenantSettingsParam.roleExternalId)&& + Objects.equals(this.additionalProperties, updateSingleTenantSettingsParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(enabled, roleArn, cloudformationTemplate, ddlTemplate, roleExternalId); + return Objects.hash(enabled, roleArn, cloudformationTemplate, ddlTemplate, roleExternalId, additionalProperties); } @Override @@ -200,6 +245,7 @@ public String toString() { sb.append(" cloudformationTemplate: ").append(toIndentedString(cloudformationTemplate)).append("\n"); sb.append(" ddlTemplate: ").append(toIndentedString(ddlTemplate)).append("\n"); sb.append(" roleExternalId: ").append(toIndentedString(roleExternalId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -244,14 +290,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSingleTenantSettingsParam is not found in the empty JSON string", UpdateSingleTenantSettingsParam.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateSingleTenantSettingsParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSingleTenantSettingsParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("role_arn") != null && !jsonObj.get("role_arn").isJsonNull()) && !jsonObj.get("role_arn").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `role_arn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("role_arn").toString())); @@ -282,6 +320,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateSingleTenantSettingsParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -289,7 +344,28 @@ public void write(JsonWriter out, UpdateSingleTenantSettingsParam value) throws public UpdateSingleTenantSettingsParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateSingleTenantSettingsParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/UpdateSoftwareTokenParam.java b/src/main/java/saasus/sdk/auth/models/UpdateSoftwareTokenParam.java index 92f6b44d..a393d772 100644 --- a/src/main/java/saasus/sdk/auth/models/UpdateSoftwareTokenParam.java +++ b/src/main/java/saasus/sdk/auth/models/UpdateSoftwareTokenParam.java @@ -49,7 +49,7 @@ /** * UpdateSoftwareTokenParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class UpdateSoftwareTokenParam { public static final String SERIALIZED_NAME_ACCESS_TOKEN = "access_token"; @SerializedName(SERIALIZED_NAME_ACCESS_TOKEN) @@ -99,6 +99,50 @@ public void setVerificationCode(String verificationCode) { this.verificationCode = verificationCode; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateSoftwareTokenParam instance itself + */ + public UpdateSoftwareTokenParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } UpdateSoftwareTokenParam updateSoftwareTokenParam = (UpdateSoftwareTokenParam) o; return Objects.equals(this.accessToken, updateSoftwareTokenParam.accessToken) && - Objects.equals(this.verificationCode, updateSoftwareTokenParam.verificationCode); + Objects.equals(this.verificationCode, updateSoftwareTokenParam.verificationCode)&& + Objects.equals(this.additionalProperties, updateSoftwareTokenParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(accessToken, verificationCode); + return Objects.hash(accessToken, verificationCode, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class UpdateSoftwareTokenParam {\n"); sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); sb.append(" verificationCode: ").append(toIndentedString(verificationCode)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateSoftwareTokenParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSoftwareTokenParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UpdateSoftwareTokenParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateSoftwareTokenParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, UpdateSoftwareTokenParam value) throws IOExcep public UpdateSoftwareTokenParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateSoftwareTokenParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/UpdateTenantIdentityProviderParam.java b/src/main/java/saasus/sdk/auth/models/UpdateTenantIdentityProviderParam.java index f7a1049e..5c2d01d5 100644 --- a/src/main/java/saasus/sdk/auth/models/UpdateTenantIdentityProviderParam.java +++ b/src/main/java/saasus/sdk/auth/models/UpdateTenantIdentityProviderParam.java @@ -51,7 +51,7 @@ /** * If identity_provider_props is null, the sign-in information for the external identity provider specified in provider_type is disabled. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class UpdateTenantIdentityProviderParam { public static final String SERIALIZED_NAME_PROVIDER_TYPE = "provider_type"; @SerializedName(SERIALIZED_NAME_PROVIDER_TYPE) @@ -101,6 +101,50 @@ public void setIdentityProviderProps(TenantIdentityProviderProps identityProvide this.identityProviderProps = identityProviderProps; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateTenantIdentityProviderParam instance itself + */ + public UpdateTenantIdentityProviderParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -113,12 +157,13 @@ public boolean equals(Object o) { } UpdateTenantIdentityProviderParam updateTenantIdentityProviderParam = (UpdateTenantIdentityProviderParam) o; return Objects.equals(this.providerType, updateTenantIdentityProviderParam.providerType) && - Objects.equals(this.identityProviderProps, updateTenantIdentityProviderParam.identityProviderProps); + Objects.equals(this.identityProviderProps, updateTenantIdentityProviderParam.identityProviderProps)&& + Objects.equals(this.additionalProperties, updateTenantIdentityProviderParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(providerType, identityProviderProps); + return Objects.hash(providerType, identityProviderProps, additionalProperties); } @Override @@ -127,6 +172,7 @@ public String toString() { sb.append("class UpdateTenantIdentityProviderParam {\n"); sb.append(" providerType: ").append(toIndentedString(providerType)).append("\n"); sb.append(" identityProviderProps: ").append(toIndentedString(identityProviderProps)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -170,14 +216,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateTenantIdentityProviderParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateTenantIdentityProviderParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UpdateTenantIdentityProviderParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -208,6 +246,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateTenantIdentityProviderParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -215,7 +270,28 @@ public void write(JsonWriter out, UpdateTenantIdentityProviderParam value) throw public UpdateTenantIdentityProviderParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateTenantIdentityProviderParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/UpdateTenantUserParam.java b/src/main/java/saasus/sdk/auth/models/UpdateTenantUserParam.java index e5ca2657..6796961b 100644 --- a/src/main/java/saasus/sdk/auth/models/UpdateTenantUserParam.java +++ b/src/main/java/saasus/sdk/auth/models/UpdateTenantUserParam.java @@ -51,7 +51,7 @@ /** * UpdateTenantUserParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class UpdateTenantUserParam { public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; @SerializedName(SERIALIZED_NAME_ATTRIBUTES) @@ -86,6 +86,50 @@ public void setAttributes(Map attributes) { this.attributes = attributes; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateTenantUserParam instance itself + */ + public UpdateTenantUserParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -97,12 +141,13 @@ public boolean equals(Object o) { return false; } UpdateTenantUserParam updateTenantUserParam = (UpdateTenantUserParam) o; - return Objects.equals(this.attributes, updateTenantUserParam.attributes); + return Objects.equals(this.attributes, updateTenantUserParam.attributes)&& + Objects.equals(this.additionalProperties, updateTenantUserParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(attributes); + return Objects.hash(attributes, additionalProperties); } @Override @@ -110,6 +155,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class UpdateTenantUserParam {\n"); sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -152,14 +198,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateTenantUserParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateTenantUserParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UpdateTenantUserParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -184,6 +222,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateTenantUserParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -191,7 +246,28 @@ public void write(JsonWriter out, UpdateTenantUserParam value) throws IOExceptio public UpdateTenantUserParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateTenantUserParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/User.java b/src/main/java/saasus/sdk/auth/models/User.java index 97705c13..3ca506a3 100644 --- a/src/main/java/saasus/sdk/auth/models/User.java +++ b/src/main/java/saasus/sdk/auth/models/User.java @@ -54,7 +54,7 @@ /** * User */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class User { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -212,6 +212,50 @@ public void setEnvs(List envs) { this.envs = envs; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the User instance itself + */ + public User putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -228,12 +272,13 @@ public boolean equals(Object o) { Objects.equals(this.tenantName, user.tenantName) && Objects.equals(this.email, user.email) && Objects.equals(this.attributes, user.attributes) && - Objects.equals(this.envs, user.envs); + Objects.equals(this.envs, user.envs)&& + Objects.equals(this.additionalProperties, user.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, tenantId, tenantName, email, attributes, envs); + return Objects.hash(id, tenantId, tenantName, email, attributes, envs, additionalProperties); } @Override @@ -246,6 +291,7 @@ public String toString() { sb.append(" email: ").append(toIndentedString(email)).append("\n"); sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); sb.append(" envs: ").append(toIndentedString(envs)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -298,14 +344,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!User.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `User` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : User.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -352,6 +390,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, User value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -359,7 +414,28 @@ public void write(JsonWriter out, User value) throws IOException { public User read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + User instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/UserAttributes.java b/src/main/java/saasus/sdk/auth/models/UserAttributes.java index 6d90e4fd..dcb12e9f 100644 --- a/src/main/java/saasus/sdk/auth/models/UserAttributes.java +++ b/src/main/java/saasus/sdk/auth/models/UserAttributes.java @@ -52,7 +52,7 @@ /** * UserAttributes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class UserAttributes { public static final String SERIALIZED_NAME_USER_ATTRIBUTES = "user_attributes"; @SerializedName(SERIALIZED_NAME_USER_ATTRIBUTES) @@ -87,6 +87,50 @@ public void setUserAttributes(List userAttributes) { this.userAttributes = userAttributes; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UserAttributes instance itself + */ + public UserAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } UserAttributes userAttributes = (UserAttributes) o; - return Objects.equals(this.userAttributes, userAttributes.userAttributes); + return Objects.equals(this.userAttributes, userAttributes.userAttributes)&& + Objects.equals(this.additionalProperties, userAttributes.additionalProperties); } @Override public int hashCode() { - return Objects.hash(userAttributes); + return Objects.hash(userAttributes, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class UserAttributes {\n"); sb.append(" userAttributes: ").append(toIndentedString(userAttributes)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UserAttributes.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserAttributes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UserAttributes.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UserAttributes value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, UserAttributes value) throws IOException { public UserAttributes read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UserAttributes instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/UserAvailableEnv.java b/src/main/java/saasus/sdk/auth/models/UserAvailableEnv.java index b60694a7..cf89e601 100644 --- a/src/main/java/saasus/sdk/auth/models/UserAvailableEnv.java +++ b/src/main/java/saasus/sdk/auth/models/UserAvailableEnv.java @@ -52,7 +52,7 @@ /** * UserAvailableEnv */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class UserAvailableEnv { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -156,6 +156,50 @@ public void setRoles(List roles) { this.roles = roles; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UserAvailableEnv instance itself + */ + public UserAvailableEnv putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -170,12 +214,13 @@ public boolean equals(Object o) { return Objects.equals(this.id, userAvailableEnv.id) && Objects.equals(this.name, userAvailableEnv.name) && Objects.equals(this.displayName, userAvailableEnv.displayName) && - Objects.equals(this.roles, userAvailableEnv.roles); + Objects.equals(this.roles, userAvailableEnv.roles)&& + Objects.equals(this.additionalProperties, userAvailableEnv.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, name, displayName, roles); + return Objects.hash(id, name, displayName, roles, additionalProperties); } @Override @@ -186,6 +231,7 @@ public String toString() { sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); sb.append(" roles: ").append(toIndentedString(roles)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -233,14 +279,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UserAvailableEnv.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserAvailableEnv` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UserAvailableEnv.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -281,6 +319,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UserAvailableEnv value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -288,7 +343,28 @@ public void write(JsonWriter out, UserAvailableEnv value) throws IOException { public UserAvailableEnv read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UserAvailableEnv instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/UserAvailableTenant.java b/src/main/java/saasus/sdk/auth/models/UserAvailableTenant.java index 7464aacf..232dbf4a 100644 --- a/src/main/java/saasus/sdk/auth/models/UserAvailableTenant.java +++ b/src/main/java/saasus/sdk/auth/models/UserAvailableTenant.java @@ -54,7 +54,7 @@ /** * UserAvailableTenant */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class UserAvailableTenant { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -258,6 +258,50 @@ public void setIsPaid(Boolean isPaid) { this.isPaid = isPaid; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UserAvailableTenant instance itself + */ + public UserAvailableTenant putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -276,12 +320,13 @@ public boolean equals(Object o) { Objects.equals(this.userAttribute, userAvailableTenant.userAttribute) && Objects.equals(this.backOfficeStaffEmail, userAvailableTenant.backOfficeStaffEmail) && Objects.equals(this.planId, userAvailableTenant.planId) && - Objects.equals(this.isPaid, userAvailableTenant.isPaid); + Objects.equals(this.isPaid, userAvailableTenant.isPaid)&& + Objects.equals(this.additionalProperties, userAvailableTenant.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, name, completedSignUp, envs, userAttribute, backOfficeStaffEmail, planId, isPaid); + return Objects.hash(id, name, completedSignUp, envs, userAttribute, backOfficeStaffEmail, planId, isPaid, additionalProperties); } @Override @@ -296,6 +341,7 @@ public String toString() { sb.append(" backOfficeStaffEmail: ").append(toIndentedString(backOfficeStaffEmail)).append("\n"); sb.append(" planId: ").append(toIndentedString(planId)).append("\n"); sb.append(" isPaid: ").append(toIndentedString(isPaid)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -350,14 +396,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UserAvailableTenant.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserAvailableTenant` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UserAvailableTenant.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -404,6 +442,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UserAvailableTenant value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -411,7 +466,28 @@ public void write(JsonWriter out, UserAvailableTenant value) throws IOException public UserAvailableTenant read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UserAvailableTenant instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/UserInfo.java b/src/main/java/saasus/sdk/auth/models/UserInfo.java index 920bd0b6..1eae17ed 100644 --- a/src/main/java/saasus/sdk/auth/models/UserInfo.java +++ b/src/main/java/saasus/sdk/auth/models/UserInfo.java @@ -22,7 +22,9 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; +import java.util.Map; import saasus.sdk.auth.models.UserAvailableTenant; import com.google.gson.Gson; @@ -52,7 +54,7 @@ /** * UserInfo */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class UserInfo { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -62,6 +64,10 @@ public class UserInfo { @SerializedName(SERIALIZED_NAME_EMAIL) private String email; + public static final String SERIALIZED_NAME_USER_ATTRIBUTE = "user_attribute"; + @SerializedName(SERIALIZED_NAME_USER_ATTRIBUTE) + private Map userAttribute = new HashMap<>(); + public static final String SERIALIZED_NAME_TENANTS = "tenants"; @SerializedName(SERIALIZED_NAME_TENANTS) private List tenants = new ArrayList<>(); @@ -107,6 +113,33 @@ public void setEmail(String email) { } + public UserInfo userAttribute(Map userAttribute) { + this.userAttribute = userAttribute; + return this; + } + + public UserInfo putUserAttributeItem(String key, Object userAttributeItem) { + if (this.userAttribute == null) { + this.userAttribute = new HashMap<>(); + } + this.userAttribute.put(key, userAttributeItem); + return this; + } + + /** + * user additional attributes + * @return userAttribute + **/ + @javax.annotation.Nonnull + public Map getUserAttribute() { + return userAttribute; + } + + public void setUserAttribute(Map userAttribute) { + this.userAttribute = userAttribute; + } + + public UserInfo tenants(List tenants) { this.tenants = tenants; return this; @@ -133,6 +166,50 @@ public void setTenants(List tenants) { this.tenants = tenants; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UserInfo instance itself + */ + public UserInfo putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -146,12 +223,14 @@ public boolean equals(Object o) { UserInfo userInfo = (UserInfo) o; return Objects.equals(this.id, userInfo.id) && Objects.equals(this.email, userInfo.email) && - Objects.equals(this.tenants, userInfo.tenants); + Objects.equals(this.userAttribute, userInfo.userAttribute) && + Objects.equals(this.tenants, userInfo.tenants)&& + Objects.equals(this.additionalProperties, userInfo.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, email, tenants); + return Objects.hash(id, email, userAttribute, tenants, additionalProperties); } @Override @@ -160,7 +239,9 @@ public String toString() { sb.append("class UserInfo {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" userAttribute: ").append(toIndentedString(userAttribute)).append("\n"); sb.append(" tenants: ").append(toIndentedString(tenants)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -185,12 +266,14 @@ private String toIndentedString(Object o) { openapiFields = new HashSet(); openapiFields.add("id"); openapiFields.add("email"); + openapiFields.add("user_attribute"); openapiFields.add("tenants"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); openapiRequiredFields.add("id"); openapiRequiredFields.add("email"); + openapiRequiredFields.add("user_attribute"); openapiRequiredFields.add("tenants"); } @@ -207,14 +290,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UserInfo.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserInfo` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UserInfo.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -255,6 +330,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UserInfo value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -262,7 +354,28 @@ public void write(JsonWriter out, UserInfo value) throws IOException { public UserInfo read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UserInfo instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/Users.java b/src/main/java/saasus/sdk/auth/models/Users.java index 26ca2dc8..f9968e57 100644 --- a/src/main/java/saasus/sdk/auth/models/Users.java +++ b/src/main/java/saasus/sdk/auth/models/Users.java @@ -52,7 +52,7 @@ /** * Users */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class Users { public static final String SERIALIZED_NAME_USERS = "users"; @SerializedName(SERIALIZED_NAME_USERS) @@ -87,6 +87,50 @@ public void setUsers(List users) { this.users = users; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Users instance itself + */ + public Users putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } Users users = (Users) o; - return Objects.equals(this.users, users.users); + return Objects.equals(this.users, users.users)&& + Objects.equals(this.additionalProperties, users.additionalProperties); } @Override public int hashCode() { - return Objects.hash(users); + return Objects.hash(users, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Users {\n"); sb.append(" users: ").append(toIndentedString(users)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Users.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Users` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Users.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Users value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, Users value) throws IOException { public Users read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Users instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/auth/models/ValidateInvitationParam.java b/src/main/java/saasus/sdk/auth/models/ValidateInvitationParam.java index fadc6061..fc20d3c6 100644 --- a/src/main/java/saasus/sdk/auth/models/ValidateInvitationParam.java +++ b/src/main/java/saasus/sdk/auth/models/ValidateInvitationParam.java @@ -49,7 +49,7 @@ /** * Access token is required for existing users, and email and password is required for new users. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:40.674090509Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:19.017419721Z[Etc/UTC]") public class ValidateInvitationParam { public static final String SERIALIZED_NAME_ACCESS_TOKEN = "access_token"; @SerializedName(SERIALIZED_NAME_ACCESS_TOKEN) @@ -122,6 +122,50 @@ public void setPassword(String password) { this.password = password; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ValidateInvitationParam instance itself + */ + public ValidateInvitationParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -135,12 +179,13 @@ public boolean equals(Object o) { ValidateInvitationParam validateInvitationParam = (ValidateInvitationParam) o; return Objects.equals(this.accessToken, validateInvitationParam.accessToken) && Objects.equals(this.email, validateInvitationParam.email) && - Objects.equals(this.password, validateInvitationParam.password); + Objects.equals(this.password, validateInvitationParam.password)&& + Objects.equals(this.additionalProperties, validateInvitationParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(accessToken, email, password); + return Objects.hash(accessToken, email, password, additionalProperties); } @Override @@ -150,6 +195,7 @@ public String toString() { sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); sb.append(" email: ").append(toIndentedString(email)).append("\n"); sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -192,14 +238,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format("The required field(s) %s in ValidateInvitationParam is not found in the empty JSON string", ValidateInvitationParam.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ValidateInvitationParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ValidateInvitationParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("access_token") != null && !jsonObj.get("access_token").isJsonNull()) && !jsonObj.get("access_token").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `access_token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("access_token").toString())); @@ -227,6 +265,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, ValidateInvitationParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -234,7 +289,28 @@ public void write(JsonWriter out, ValidateInvitationParam value) throws IOExcept public ValidateInvitationParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ValidateInvitationParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/awsmarketplace/ApiException.java b/src/main/java/saasus/sdk/awsmarketplace/ApiException.java index caef24a2..4239d98f 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/ApiException.java +++ b/src/main/java/saasus/sdk/awsmarketplace/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/src/main/java/saasus/sdk/awsmarketplace/Configuration.java b/src/main/java/saasus/sdk/awsmarketplace/Configuration.java index 396045c3..dfbde69b 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/Configuration.java +++ b/src/main/java/saasus/sdk/awsmarketplace/Configuration.java @@ -13,7 +13,7 @@ package saasus.sdk.awsmarketplace; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/src/main/java/saasus/sdk/awsmarketplace/Pair.java b/src/main/java/saasus/sdk/awsmarketplace/Pair.java index 065f0d40..9848680e 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/Pair.java +++ b/src/main/java/saasus/sdk/awsmarketplace/Pair.java @@ -13,7 +13,7 @@ package saasus.sdk.awsmarketplace; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class Pair { private String name = ""; private String value = ""; diff --git a/src/main/java/saasus/sdk/awsmarketplace/StringUtil.java b/src/main/java/saasus/sdk/awsmarketplace/StringUtil.java index d9875444..ba12793a 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/StringUtil.java +++ b/src/main/java/saasus/sdk/awsmarketplace/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/src/main/java/saasus/sdk/awsmarketplace/auth/ApiKeyAuth.java b/src/main/java/saasus/sdk/awsmarketplace/auth/ApiKeyAuth.java index 7016b247..236b209e 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/auth/ApiKeyAuth.java +++ b/src/main/java/saasus/sdk/awsmarketplace/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/src/main/java/saasus/sdk/awsmarketplace/auth/HttpBearerAuth.java b/src/main/java/saasus/sdk/awsmarketplace/auth/HttpBearerAuth.java index 4ff9d594..fc2cb8ad 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/auth/HttpBearerAuth.java +++ b/src/main/java/saasus/sdk/awsmarketplace/auth/HttpBearerAuth.java @@ -22,7 +22,7 @@ import java.util.Optional; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class HttpBearerAuth implements Authentication { private final String scheme; private Supplier tokenSupplier; diff --git a/src/main/java/saasus/sdk/awsmarketplace/models/AbstractOpenApiSchema.java b/src/main/java/saasus/sdk/awsmarketplace/models/AbstractOpenApiSchema.java index e6f31e01..52c3a187 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/models/AbstractOpenApiSchema.java +++ b/src/main/java/saasus/sdk/awsmarketplace/models/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/src/main/java/saasus/sdk/awsmarketplace/models/CatalogEntityVisibility.java b/src/main/java/saasus/sdk/awsmarketplace/models/CatalogEntityVisibility.java index 2ce46166..07811ace 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/models/CatalogEntityVisibility.java +++ b/src/main/java/saasus/sdk/awsmarketplace/models/CatalogEntityVisibility.java @@ -50,7 +50,7 @@ /** * CatalogEntityVisibility */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class CatalogEntityVisibility { public static final String SERIALIZED_NAME_VISIBILITY = "visibility"; @SerializedName(SERIALIZED_NAME_VISIBILITY) @@ -77,6 +77,50 @@ public void setVisibility(VisibilityStatus visibility) { this.visibility = visibility; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CatalogEntityVisibility instance itself + */ + public CatalogEntityVisibility putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -88,12 +132,13 @@ public boolean equals(Object o) { return false; } CatalogEntityVisibility catalogEntityVisibility = (CatalogEntityVisibility) o; - return Objects.equals(this.visibility, catalogEntityVisibility.visibility); + return Objects.equals(this.visibility, catalogEntityVisibility.visibility)&& + Objects.equals(this.additionalProperties, catalogEntityVisibility.additionalProperties); } @Override public int hashCode() { - return Objects.hash(visibility); + return Objects.hash(visibility, additionalProperties); } @Override @@ -101,6 +146,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CatalogEntityVisibility {\n"); sb.append(" visibility: ").append(toIndentedString(visibility)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -143,14 +189,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CatalogEntityVisibility.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CatalogEntityVisibility` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CatalogEntityVisibility.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, CatalogEntityVisibility value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, CatalogEntityVisibility value) throws IOExcept public CatalogEntityVisibility read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CatalogEntityVisibility instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/awsmarketplace/models/CloudFormationLaunchStackLink.java b/src/main/java/saasus/sdk/awsmarketplace/models/CloudFormationLaunchStackLink.java index 28bcfd44..59f151ef 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/models/CloudFormationLaunchStackLink.java +++ b/src/main/java/saasus/sdk/awsmarketplace/models/CloudFormationLaunchStackLink.java @@ -49,7 +49,7 @@ /** * CloudFormationLaunchStackLink */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class CloudFormationLaunchStackLink { public static final String SERIALIZED_NAME_LINK = "link"; @SerializedName(SERIALIZED_NAME_LINK) @@ -76,6 +76,50 @@ public void setLink(String link) { this.link = link; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CloudFormationLaunchStackLink instance itself + */ + public CloudFormationLaunchStackLink putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } CloudFormationLaunchStackLink cloudFormationLaunchStackLink = (CloudFormationLaunchStackLink) o; - return Objects.equals(this.link, cloudFormationLaunchStackLink.link); + return Objects.equals(this.link, cloudFormationLaunchStackLink.link)&& + Objects.equals(this.additionalProperties, cloudFormationLaunchStackLink.additionalProperties); } @Override public int hashCode() { - return Objects.hash(link); + return Objects.hash(link, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CloudFormationLaunchStackLink {\n"); sb.append(" link: ").append(toIndentedString(link)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CloudFormationLaunchStackLink.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CloudFormationLaunchStackLink` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CloudFormationLaunchStackLink.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, CloudFormationLaunchStackLink value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, CloudFormationLaunchStackLink value) throws IO public CloudFormationLaunchStackLink read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CloudFormationLaunchStackLink instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/awsmarketplace/models/CreateCustomerParam.java b/src/main/java/saasus/sdk/awsmarketplace/models/CreateCustomerParam.java index 5ce37cb4..ab2cc7e1 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/models/CreateCustomerParam.java +++ b/src/main/java/saasus/sdk/awsmarketplace/models/CreateCustomerParam.java @@ -49,7 +49,7 @@ /** * CreateCustomerParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class CreateCustomerParam { public static final String SERIALIZED_NAME_TENANT_ID = "tenant_id"; @SerializedName(SERIALIZED_NAME_TENANT_ID) @@ -99,6 +99,50 @@ public void setRegistrationToken(String registrationToken) { this.registrationToken = registrationToken; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateCustomerParam instance itself + */ + public CreateCustomerParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } CreateCustomerParam createCustomerParam = (CreateCustomerParam) o; return Objects.equals(this.tenantId, createCustomerParam.tenantId) && - Objects.equals(this.registrationToken, createCustomerParam.registrationToken); + Objects.equals(this.registrationToken, createCustomerParam.registrationToken)&& + Objects.equals(this.additionalProperties, createCustomerParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(tenantId, registrationToken); + return Objects.hash(tenantId, registrationToken, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class CreateCustomerParam {\n"); sb.append(" tenantId: ").append(toIndentedString(tenantId)).append("\n"); sb.append(" registrationToken: ").append(toIndentedString(registrationToken)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreateCustomerParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateCustomerParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreateCustomerParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, CreateCustomerParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, CreateCustomerParam value) throws IOException public CreateCustomerParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateCustomerParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/awsmarketplace/models/Customer.java b/src/main/java/saasus/sdk/awsmarketplace/models/Customer.java index a8a79300..c7819b4b 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/models/Customer.java +++ b/src/main/java/saasus/sdk/awsmarketplace/models/Customer.java @@ -49,7 +49,7 @@ /** * Customer */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class Customer { public static final String SERIALIZED_NAME_CUSTOMER_IDENTIFIER = "customer_identifier"; @SerializedName(SERIALIZED_NAME_CUSTOMER_IDENTIFIER) @@ -122,6 +122,50 @@ public void setTenantId(String tenantId) { this.tenantId = tenantId; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Customer instance itself + */ + public Customer putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -135,12 +179,13 @@ public boolean equals(Object o) { Customer customer = (Customer) o; return Objects.equals(this.customerIdentifier, customer.customerIdentifier) && Objects.equals(this.customerAwsAccountId, customer.customerAwsAccountId) && - Objects.equals(this.tenantId, customer.tenantId); + Objects.equals(this.tenantId, customer.tenantId)&& + Objects.equals(this.additionalProperties, customer.additionalProperties); } @Override public int hashCode() { - return Objects.hash(customerIdentifier, customerAwsAccountId, tenantId); + return Objects.hash(customerIdentifier, customerAwsAccountId, tenantId, additionalProperties); } @Override @@ -150,6 +195,7 @@ public String toString() { sb.append(" customerIdentifier: ").append(toIndentedString(customerIdentifier)).append("\n"); sb.append(" customerAwsAccountId: ").append(toIndentedString(customerAwsAccountId)).append("\n"); sb.append(" tenantId: ").append(toIndentedString(tenantId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -196,14 +242,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Customer.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Customer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Customer.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -237,6 +275,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Customer value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -244,7 +299,28 @@ public void write(JsonWriter out, Customer value) throws IOException { public Customer read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Customer instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/awsmarketplace/models/Customers.java b/src/main/java/saasus/sdk/awsmarketplace/models/Customers.java index d597f8a6..542c2ebd 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/models/Customers.java +++ b/src/main/java/saasus/sdk/awsmarketplace/models/Customers.java @@ -52,7 +52,7 @@ /** * Customers */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class Customers { public static final String SERIALIZED_NAME_CUSTOMERS = "customers"; @SerializedName(SERIALIZED_NAME_CUSTOMERS) @@ -87,6 +87,50 @@ public void setCustomers(List customers) { this.customers = customers; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Customers instance itself + */ + public Customers putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } Customers customers = (Customers) o; - return Objects.equals(this.customers, customers.customers); + return Objects.equals(this.customers, customers.customers)&& + Objects.equals(this.additionalProperties, customers.additionalProperties); } @Override public int hashCode() { - return Objects.hash(customers); + return Objects.hash(customers, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Customers {\n"); sb.append(" customers: ").append(toIndentedString(customers)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Customers.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Customers` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Customers.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Customers value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, Customers value) throws IOException { public Customers read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Customers instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/awsmarketplace/models/Error.java b/src/main/java/saasus/sdk/awsmarketplace/models/Error.java index f7d8ff3c..1a2cc5ca 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/models/Error.java +++ b/src/main/java/saasus/sdk/awsmarketplace/models/Error.java @@ -49,7 +49,7 @@ /** * Error */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class Error { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @@ -99,6 +99,50 @@ public void setMessage(String message) { this.message = message; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Error instance itself + */ + public Error putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } Error error = (Error) o; return Objects.equals(this.type, error.type) && - Objects.equals(this.message, error.message); + Objects.equals(this.message, error.message)&& + Objects.equals(this.additionalProperties, error.additionalProperties); } @Override public int hashCode() { - return Objects.hash(type, message); + return Objects.hash(type, message, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class Error {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Error.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Error` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Error.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Error value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, Error value) throws IOException { public Error read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Error instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/awsmarketplace/models/GetListingStatusResult.java b/src/main/java/saasus/sdk/awsmarketplace/models/GetListingStatusResult.java index 5d05b1b1..bb53f134 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/models/GetListingStatusResult.java +++ b/src/main/java/saasus/sdk/awsmarketplace/models/GetListingStatusResult.java @@ -50,7 +50,7 @@ /** * GetListingStatusResult */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class GetListingStatusResult { public static final String SERIALIZED_NAME_LISTING_STATUS = "listing_status"; @SerializedName(SERIALIZED_NAME_LISTING_STATUS) @@ -77,6 +77,50 @@ public void setListingStatus(ListingStatus listingStatus) { this.listingStatus = listingStatus; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the GetListingStatusResult instance itself + */ + public GetListingStatusResult putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -88,12 +132,13 @@ public boolean equals(Object o) { return false; } GetListingStatusResult getListingStatusResult = (GetListingStatusResult) o; - return Objects.equals(this.listingStatus, getListingStatusResult.listingStatus); + return Objects.equals(this.listingStatus, getListingStatusResult.listingStatus)&& + Objects.equals(this.additionalProperties, getListingStatusResult.additionalProperties); } @Override public int hashCode() { - return Objects.hash(listingStatus); + return Objects.hash(listingStatus, additionalProperties); } @Override @@ -101,6 +146,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class GetListingStatusResult {\n"); sb.append(" listingStatus: ").append(toIndentedString(listingStatus)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -143,14 +189,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!GetListingStatusResult.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetListingStatusResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : GetListingStatusResult.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, GetListingStatusResult value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, GetListingStatusResult value) throws IOExcepti public GetListingStatusResult read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + GetListingStatusResult instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/awsmarketplace/models/Plan.java b/src/main/java/saasus/sdk/awsmarketplace/models/Plan.java index da216342..73589fdd 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/models/Plan.java +++ b/src/main/java/saasus/sdk/awsmarketplace/models/Plan.java @@ -49,7 +49,7 @@ /** * Plan */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class Plan { public static final String SERIALIZED_NAME_PLAN_ID = "plan_id"; @SerializedName(SERIALIZED_NAME_PLAN_ID) @@ -99,6 +99,50 @@ public void setPlanName(String planName) { this.planName = planName; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Plan instance itself + */ + public Plan putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } Plan plan = (Plan) o; return Objects.equals(this.planId, plan.planId) && - Objects.equals(this.planName, plan.planName); + Objects.equals(this.planName, plan.planName)&& + Objects.equals(this.additionalProperties, plan.additionalProperties); } @Override public int hashCode() { - return Objects.hash(planId, planName); + return Objects.hash(planId, planName, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class Plan {\n"); sb.append(" planId: ").append(toIndentedString(planId)).append("\n"); sb.append(" planName: ").append(toIndentedString(planName)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Plan.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Plan` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Plan.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Plan value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, Plan value) throws IOException { public Plan read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Plan instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/awsmarketplace/models/Plans.java b/src/main/java/saasus/sdk/awsmarketplace/models/Plans.java index b3e0eb18..84a153e2 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/models/Plans.java +++ b/src/main/java/saasus/sdk/awsmarketplace/models/Plans.java @@ -52,7 +52,7 @@ /** * Plans */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class Plans { public static final String SERIALIZED_NAME_PLANS = "plans"; @SerializedName(SERIALIZED_NAME_PLANS) @@ -87,6 +87,50 @@ public void setPlans(List plans) { this.plans = plans; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Plans instance itself + */ + public Plans putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } Plans plans = (Plans) o; - return Objects.equals(this.plans, plans.plans); + return Objects.equals(this.plans, plans.plans)&& + Objects.equals(this.additionalProperties, plans.additionalProperties); } @Override public int hashCode() { - return Objects.hash(plans); + return Objects.hash(plans, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Plans {\n"); sb.append(" plans: ").append(toIndentedString(plans)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Plans.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Plans` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Plans.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Plans value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, Plans value) throws IOException { public Plans read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Plans instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/awsmarketplace/models/SavePlanParam.java b/src/main/java/saasus/sdk/awsmarketplace/models/SavePlanParam.java index f1a112d7..3520c21e 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/models/SavePlanParam.java +++ b/src/main/java/saasus/sdk/awsmarketplace/models/SavePlanParam.java @@ -49,7 +49,7 @@ /** * SavePlanParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class SavePlanParam { public static final String SERIALIZED_NAME_PLAN_ID = "plan_id"; @SerializedName(SERIALIZED_NAME_PLAN_ID) @@ -99,6 +99,50 @@ public void setPlanName(String planName) { this.planName = planName; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SavePlanParam instance itself + */ + public SavePlanParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } SavePlanParam savePlanParam = (SavePlanParam) o; return Objects.equals(this.planId, savePlanParam.planId) && - Objects.equals(this.planName, savePlanParam.planName); + Objects.equals(this.planName, savePlanParam.planName)&& + Objects.equals(this.additionalProperties, savePlanParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(planId, planName); + return Objects.hash(planId, planName, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class SavePlanParam {\n"); sb.append(" planId: ").append(toIndentedString(planId)).append("\n"); sb.append(" planName: ").append(toIndentedString(planName)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SavePlanParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SavePlanParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : SavePlanParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, SavePlanParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, SavePlanParam value) throws IOException { public SavePlanParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SavePlanParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/awsmarketplace/models/Settings.java b/src/main/java/saasus/sdk/awsmarketplace/models/Settings.java index 015fff81..b22db8db 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/models/Settings.java +++ b/src/main/java/saasus/sdk/awsmarketplace/models/Settings.java @@ -49,7 +49,7 @@ /** * Settings */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class Settings { public static final String SERIALIZED_NAME_PRODUCT_CODE = "product_code"; @SerializedName(SERIALIZED_NAME_PRODUCT_CODE) @@ -260,6 +260,50 @@ public void setSqsArn(String sqsArn) { this.sqsArn = sqsArn; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Settings instance itself + */ + public Settings putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -279,12 +323,13 @@ public boolean equals(Object o) { Objects.equals(this.casSnsTopicArn, settings.casSnsTopicArn) && Objects.equals(this.sellerSnsTopicArn, settings.sellerSnsTopicArn) && Objects.equals(this.redirectSignUpPageFunctionUrl, settings.redirectSignUpPageFunctionUrl) && - Objects.equals(this.sqsArn, settings.sqsArn); + Objects.equals(this.sqsArn, settings.sqsArn)&& + Objects.equals(this.additionalProperties, settings.additionalProperties); } @Override public int hashCode() { - return Objects.hash(productCode, roleArn, roleExternalId, snsTopicArn, casBucketName, casSnsTopicArn, sellerSnsTopicArn, redirectSignUpPageFunctionUrl, sqsArn); + return Objects.hash(productCode, roleArn, roleExternalId, snsTopicArn, casBucketName, casSnsTopicArn, sellerSnsTopicArn, redirectSignUpPageFunctionUrl, sqsArn, additionalProperties); } @Override @@ -300,6 +345,7 @@ public String toString() { sb.append(" sellerSnsTopicArn: ").append(toIndentedString(sellerSnsTopicArn)).append("\n"); sb.append(" redirectSignUpPageFunctionUrl: ").append(toIndentedString(redirectSignUpPageFunctionUrl)).append("\n"); sb.append(" sqsArn: ").append(toIndentedString(sqsArn)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -358,14 +404,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Settings.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Settings` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Settings.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -417,6 +455,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Settings value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -424,7 +479,28 @@ public void write(JsonWriter out, Settings value) throws IOException { public Settings read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Settings instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/awsmarketplace/models/UpdateListingStatusParam.java b/src/main/java/saasus/sdk/awsmarketplace/models/UpdateListingStatusParam.java index ed4f5a02..5ecf57f6 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/models/UpdateListingStatusParam.java +++ b/src/main/java/saasus/sdk/awsmarketplace/models/UpdateListingStatusParam.java @@ -50,7 +50,7 @@ /** * UpdateListingStatusParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class UpdateListingStatusParam { public static final String SERIALIZED_NAME_LISTING_STATUS = "listing_status"; @SerializedName(SERIALIZED_NAME_LISTING_STATUS) @@ -77,6 +77,50 @@ public void setListingStatus(ListingStatus listingStatus) { this.listingStatus = listingStatus; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateListingStatusParam instance itself + */ + public UpdateListingStatusParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -88,12 +132,13 @@ public boolean equals(Object o) { return false; } UpdateListingStatusParam updateListingStatusParam = (UpdateListingStatusParam) o; - return Objects.equals(this.listingStatus, updateListingStatusParam.listingStatus); + return Objects.equals(this.listingStatus, updateListingStatusParam.listingStatus)&& + Objects.equals(this.additionalProperties, updateListingStatusParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(listingStatus); + return Objects.hash(listingStatus, additionalProperties); } @Override @@ -101,6 +146,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class UpdateListingStatusParam {\n"); sb.append(" listingStatus: ").append(toIndentedString(listingStatus)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -143,14 +189,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateListingStatusParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateListingStatusParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UpdateListingStatusParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateListingStatusParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, UpdateListingStatusParam value) throws IOExcep public UpdateListingStatusParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateListingStatusParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/awsmarketplace/models/UpdateSettingsParam.java b/src/main/java/saasus/sdk/awsmarketplace/models/UpdateSettingsParam.java index 5b431078..faf0261b 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/models/UpdateSettingsParam.java +++ b/src/main/java/saasus/sdk/awsmarketplace/models/UpdateSettingsParam.java @@ -49,7 +49,7 @@ /** * UpdateSettingsParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class UpdateSettingsParam { public static final String SERIALIZED_NAME_PRODUCT_CODE = "product_code"; @SerializedName(SERIALIZED_NAME_PRODUCT_CODE) @@ -237,6 +237,50 @@ public void setSqsArn(String sqsArn) { this.sqsArn = sqsArn; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateSettingsParam instance itself + */ + public UpdateSettingsParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -255,12 +299,13 @@ public boolean equals(Object o) { Objects.equals(this.casBucketName, updateSettingsParam.casBucketName) && Objects.equals(this.casSnsTopicArn, updateSettingsParam.casSnsTopicArn) && Objects.equals(this.sellerSnsTopicArn, updateSettingsParam.sellerSnsTopicArn) && - Objects.equals(this.sqsArn, updateSettingsParam.sqsArn); + Objects.equals(this.sqsArn, updateSettingsParam.sqsArn)&& + Objects.equals(this.additionalProperties, updateSettingsParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(productCode, roleArn, roleExternalId, snsTopicArn, casBucketName, casSnsTopicArn, sellerSnsTopicArn, sqsArn); + return Objects.hash(productCode, roleArn, roleExternalId, snsTopicArn, casBucketName, casSnsTopicArn, sellerSnsTopicArn, sqsArn, additionalProperties); } @Override @@ -275,6 +320,7 @@ public String toString() { sb.append(" casSnsTopicArn: ").append(toIndentedString(casSnsTopicArn)).append("\n"); sb.append(" sellerSnsTopicArn: ").append(toIndentedString(sellerSnsTopicArn)).append("\n"); sb.append(" sqsArn: ").append(toIndentedString(sqsArn)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -322,14 +368,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSettingsParam is not found in the empty JSON string", UpdateSettingsParam.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateSettingsParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSettingsParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("product_code") != null && !jsonObj.get("product_code").isJsonNull()) && !jsonObj.get("product_code").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `product_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("product_code").toString())); @@ -372,6 +410,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateSettingsParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -379,7 +434,28 @@ public void write(JsonWriter out, UpdateSettingsParam value) throws IOException public UpdateSettingsParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateSettingsParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/awsmarketplace/models/VerifyRegistrationTokenParam.java b/src/main/java/saasus/sdk/awsmarketplace/models/VerifyRegistrationTokenParam.java index 459404f1..0bcd6c04 100644 --- a/src/main/java/saasus/sdk/awsmarketplace/models/VerifyRegistrationTokenParam.java +++ b/src/main/java/saasus/sdk/awsmarketplace/models/VerifyRegistrationTokenParam.java @@ -49,7 +49,7 @@ /** * VerifyRegistrationTokenParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:52.731282631Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:32.192425921Z[Etc/UTC]") public class VerifyRegistrationTokenParam { public static final String SERIALIZED_NAME_REGISTRATION_TOKEN = "registration_token"; @SerializedName(SERIALIZED_NAME_REGISTRATION_TOKEN) @@ -76,6 +76,50 @@ public void setRegistrationToken(String registrationToken) { this.registrationToken = registrationToken; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the VerifyRegistrationTokenParam instance itself + */ + public VerifyRegistrationTokenParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } VerifyRegistrationTokenParam verifyRegistrationTokenParam = (VerifyRegistrationTokenParam) o; - return Objects.equals(this.registrationToken, verifyRegistrationTokenParam.registrationToken); + return Objects.equals(this.registrationToken, verifyRegistrationTokenParam.registrationToken)&& + Objects.equals(this.additionalProperties, verifyRegistrationTokenParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(registrationToken); + return Objects.hash(registrationToken, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class VerifyRegistrationTokenParam {\n"); sb.append(" registrationToken: ").append(toIndentedString(registrationToken)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!VerifyRegistrationTokenParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `VerifyRegistrationTokenParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : VerifyRegistrationTokenParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, VerifyRegistrationTokenParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, VerifyRegistrationTokenParam value) throws IOE public VerifyRegistrationTokenParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VerifyRegistrationTokenParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/billing/ApiException.java b/src/main/java/saasus/sdk/billing/ApiException.java index 19d0c68f..a03fd303 100644 --- a/src/main/java/saasus/sdk/billing/ApiException.java +++ b/src/main/java/saasus/sdk/billing/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:50.006193588Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:28.313412961Z[Etc/UTC]") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/src/main/java/saasus/sdk/billing/Configuration.java b/src/main/java/saasus/sdk/billing/Configuration.java index 0a1dc622..247a0d34 100644 --- a/src/main/java/saasus/sdk/billing/Configuration.java +++ b/src/main/java/saasus/sdk/billing/Configuration.java @@ -13,7 +13,7 @@ package saasus.sdk.billing; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:50.006193588Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:28.313412961Z[Etc/UTC]") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/src/main/java/saasus/sdk/billing/Pair.java b/src/main/java/saasus/sdk/billing/Pair.java index 342e06d1..f9008b8c 100644 --- a/src/main/java/saasus/sdk/billing/Pair.java +++ b/src/main/java/saasus/sdk/billing/Pair.java @@ -13,7 +13,7 @@ package saasus.sdk.billing; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:50.006193588Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:28.313412961Z[Etc/UTC]") public class Pair { private String name = ""; private String value = ""; diff --git a/src/main/java/saasus/sdk/billing/StringUtil.java b/src/main/java/saasus/sdk/billing/StringUtil.java index 17f06e6d..8025e288 100644 --- a/src/main/java/saasus/sdk/billing/StringUtil.java +++ b/src/main/java/saasus/sdk/billing/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:50.006193588Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:28.313412961Z[Etc/UTC]") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/src/main/java/saasus/sdk/billing/auth/ApiKeyAuth.java b/src/main/java/saasus/sdk/billing/auth/ApiKeyAuth.java index 47044868..b0f33b5e 100644 --- a/src/main/java/saasus/sdk/billing/auth/ApiKeyAuth.java +++ b/src/main/java/saasus/sdk/billing/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:50.006193588Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:28.313412961Z[Etc/UTC]") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/src/main/java/saasus/sdk/billing/auth/HttpBearerAuth.java b/src/main/java/saasus/sdk/billing/auth/HttpBearerAuth.java index 59e81a2c..c82004d7 100644 --- a/src/main/java/saasus/sdk/billing/auth/HttpBearerAuth.java +++ b/src/main/java/saasus/sdk/billing/auth/HttpBearerAuth.java @@ -22,7 +22,7 @@ import java.util.Optional; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:50.006193588Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:28.313412961Z[Etc/UTC]") public class HttpBearerAuth implements Authentication { private final String scheme; private Supplier tokenSupplier; diff --git a/src/main/java/saasus/sdk/billing/models/AbstractOpenApiSchema.java b/src/main/java/saasus/sdk/billing/models/AbstractOpenApiSchema.java index 08349859..777e8187 100644 --- a/src/main/java/saasus/sdk/billing/models/AbstractOpenApiSchema.java +++ b/src/main/java/saasus/sdk/billing/models/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:50.006193588Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:28.313412961Z[Etc/UTC]") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/src/main/java/saasus/sdk/billing/models/Error.java b/src/main/java/saasus/sdk/billing/models/Error.java index 6b7d2356..558e8899 100644 --- a/src/main/java/saasus/sdk/billing/models/Error.java +++ b/src/main/java/saasus/sdk/billing/models/Error.java @@ -49,7 +49,7 @@ /** * Error */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:50.006193588Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:28.313412961Z[Etc/UTC]") public class Error { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @@ -99,6 +99,50 @@ public void setMessage(String message) { this.message = message; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Error instance itself + */ + public Error putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } Error error = (Error) o; return Objects.equals(this.type, error.type) && - Objects.equals(this.message, error.message); + Objects.equals(this.message, error.message)&& + Objects.equals(this.additionalProperties, error.additionalProperties); } @Override public int hashCode() { - return Objects.hash(type, message); + return Objects.hash(type, message, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class Error {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Error.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Error` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Error.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Error value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, Error value) throws IOException { public Error read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Error instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/billing/models/StripeInfo.java b/src/main/java/saasus/sdk/billing/models/StripeInfo.java index 40b23f7c..24b3e374 100644 --- a/src/main/java/saasus/sdk/billing/models/StripeInfo.java +++ b/src/main/java/saasus/sdk/billing/models/StripeInfo.java @@ -49,7 +49,7 @@ /** * StripeInfo */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:50.006193588Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:28.313412961Z[Etc/UTC]") public class StripeInfo { public static final String SERIALIZED_NAME_IS_REGISTERED = "is_registered"; @SerializedName(SERIALIZED_NAME_IS_REGISTERED) @@ -76,6 +76,50 @@ public void setIsRegistered(Boolean isRegistered) { this.isRegistered = isRegistered; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the StripeInfo instance itself + */ + public StripeInfo putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } StripeInfo stripeInfo = (StripeInfo) o; - return Objects.equals(this.isRegistered, stripeInfo.isRegistered); + return Objects.equals(this.isRegistered, stripeInfo.isRegistered)&& + Objects.equals(this.additionalProperties, stripeInfo.additionalProperties); } @Override public int hashCode() { - return Objects.hash(isRegistered); + return Objects.hash(isRegistered, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class StripeInfo {\n"); sb.append(" isRegistered: ").append(toIndentedString(isRegistered)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!StripeInfo.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StripeInfo` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : StripeInfo.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -174,6 +212,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, StripeInfo value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -181,7 +236,28 @@ public void write(JsonWriter out, StripeInfo value) throws IOException { public StripeInfo read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + StripeInfo instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/billing/models/UpdateStripeInfoParam.java b/src/main/java/saasus/sdk/billing/models/UpdateStripeInfoParam.java index 799fb0bf..705fc8a3 100644 --- a/src/main/java/saasus/sdk/billing/models/UpdateStripeInfoParam.java +++ b/src/main/java/saasus/sdk/billing/models/UpdateStripeInfoParam.java @@ -49,7 +49,7 @@ /** * UpdateStripeInfoParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:50.006193588Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:28.313412961Z[Etc/UTC]") public class UpdateStripeInfoParam { public static final String SERIALIZED_NAME_SECRET_KEY = "secret_key"; @SerializedName(SERIALIZED_NAME_SECRET_KEY) @@ -76,6 +76,50 @@ public void setSecretKey(String secretKey) { this.secretKey = secretKey; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateStripeInfoParam instance itself + */ + public UpdateStripeInfoParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } UpdateStripeInfoParam updateStripeInfoParam = (UpdateStripeInfoParam) o; - return Objects.equals(this.secretKey, updateStripeInfoParam.secretKey); + return Objects.equals(this.secretKey, updateStripeInfoParam.secretKey)&& + Objects.equals(this.additionalProperties, updateStripeInfoParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(secretKey); + return Objects.hash(secretKey, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class UpdateStripeInfoParam {\n"); sb.append(" secretKey: ").append(toIndentedString(secretKey)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateStripeInfoParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateStripeInfoParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UpdateStripeInfoParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateStripeInfoParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, UpdateStripeInfoParam value) throws IOExceptio public UpdateStripeInfoParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateStripeInfoParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/communication/ApiException.java b/src/main/java/saasus/sdk/communication/ApiException.java index 75d2ff13..6e6cc4bf 100644 --- a/src/main/java/saasus/sdk/communication/ApiException.java +++ b/src/main/java/saasus/sdk/communication/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/src/main/java/saasus/sdk/communication/Configuration.java b/src/main/java/saasus/sdk/communication/Configuration.java index 55da8537..c413549d 100644 --- a/src/main/java/saasus/sdk/communication/Configuration.java +++ b/src/main/java/saasus/sdk/communication/Configuration.java @@ -13,7 +13,7 @@ package saasus.sdk.communication; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/src/main/java/saasus/sdk/communication/Pair.java b/src/main/java/saasus/sdk/communication/Pair.java index c6375375..cd01a60d 100644 --- a/src/main/java/saasus/sdk/communication/Pair.java +++ b/src/main/java/saasus/sdk/communication/Pair.java @@ -13,7 +13,7 @@ package saasus.sdk.communication; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class Pair { private String name = ""; private String value = ""; diff --git a/src/main/java/saasus/sdk/communication/StringUtil.java b/src/main/java/saasus/sdk/communication/StringUtil.java index b7e2fea7..1c0a6ba4 100644 --- a/src/main/java/saasus/sdk/communication/StringUtil.java +++ b/src/main/java/saasus/sdk/communication/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/src/main/java/saasus/sdk/communication/auth/ApiKeyAuth.java b/src/main/java/saasus/sdk/communication/auth/ApiKeyAuth.java index efc49fd0..3565c826 100644 --- a/src/main/java/saasus/sdk/communication/auth/ApiKeyAuth.java +++ b/src/main/java/saasus/sdk/communication/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/src/main/java/saasus/sdk/communication/auth/HttpBearerAuth.java b/src/main/java/saasus/sdk/communication/auth/HttpBearerAuth.java index 39f0a7a0..43d7c2c9 100644 --- a/src/main/java/saasus/sdk/communication/auth/HttpBearerAuth.java +++ b/src/main/java/saasus/sdk/communication/auth/HttpBearerAuth.java @@ -22,7 +22,7 @@ import java.util.Optional; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class HttpBearerAuth implements Authentication { private final String scheme; private Supplier tokenSupplier; diff --git a/src/main/java/saasus/sdk/communication/models/AbstractOpenApiSchema.java b/src/main/java/saasus/sdk/communication/models/AbstractOpenApiSchema.java index 6cce413c..fccfb613 100644 --- a/src/main/java/saasus/sdk/communication/models/AbstractOpenApiSchema.java +++ b/src/main/java/saasus/sdk/communication/models/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/src/main/java/saasus/sdk/communication/models/Comment.java b/src/main/java/saasus/sdk/communication/models/Comment.java index 6f9392b3..c41a43c4 100644 --- a/src/main/java/saasus/sdk/communication/models/Comment.java +++ b/src/main/java/saasus/sdk/communication/models/Comment.java @@ -49,7 +49,7 @@ /** * Comment */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class Comment { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -122,6 +122,50 @@ public void setBody(String body) { this.body = body; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Comment instance itself + */ + public Comment putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -135,12 +179,13 @@ public boolean equals(Object o) { Comment comment = (Comment) o; return Objects.equals(this.id, comment.id) && Objects.equals(this.createdAt, comment.createdAt) && - Objects.equals(this.body, comment.body); + Objects.equals(this.body, comment.body)&& + Objects.equals(this.additionalProperties, comment.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, createdAt, body); + return Objects.hash(id, createdAt, body, additionalProperties); } @Override @@ -150,6 +195,7 @@ public String toString() { sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); sb.append(" body: ").append(toIndentedString(body)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -196,14 +242,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Comment.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Comment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Comment.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -234,6 +272,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Comment value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -241,7 +296,28 @@ public void write(JsonWriter out, Comment value) throws IOException { public Comment read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Comment instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/communication/models/Comments.java b/src/main/java/saasus/sdk/communication/models/Comments.java index a935df93..7887472a 100644 --- a/src/main/java/saasus/sdk/communication/models/Comments.java +++ b/src/main/java/saasus/sdk/communication/models/Comments.java @@ -52,7 +52,7 @@ /** * Comments */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class Comments { public static final String SERIALIZED_NAME_COMMENTS = "comments"; @SerializedName(SERIALIZED_NAME_COMMENTS) @@ -87,6 +87,50 @@ public void setComments(List comments) { this.comments = comments; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Comments instance itself + */ + public Comments putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } Comments comments = (Comments) o; - return Objects.equals(this.comments, comments.comments); + return Objects.equals(this.comments, comments.comments)&& + Objects.equals(this.additionalProperties, comments.additionalProperties); } @Override public int hashCode() { - return Objects.hash(comments); + return Objects.hash(comments, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Comments {\n"); sb.append(" comments: ").append(toIndentedString(comments)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Comments.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Comments` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Comments.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Comments value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, Comments value) throws IOException { public Comments read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Comments instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/communication/models/CreateFeedbackCommentParam.java b/src/main/java/saasus/sdk/communication/models/CreateFeedbackCommentParam.java index 714aa92e..2ba64341 100644 --- a/src/main/java/saasus/sdk/communication/models/CreateFeedbackCommentParam.java +++ b/src/main/java/saasus/sdk/communication/models/CreateFeedbackCommentParam.java @@ -49,7 +49,7 @@ /** * CreateFeedbackCommentParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class CreateFeedbackCommentParam { public static final String SERIALIZED_NAME_BODY = "body"; @SerializedName(SERIALIZED_NAME_BODY) @@ -76,6 +76,50 @@ public void setBody(String body) { this.body = body; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateFeedbackCommentParam instance itself + */ + public CreateFeedbackCommentParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } CreateFeedbackCommentParam createFeedbackCommentParam = (CreateFeedbackCommentParam) o; - return Objects.equals(this.body, createFeedbackCommentParam.body); + return Objects.equals(this.body, createFeedbackCommentParam.body)&& + Objects.equals(this.additionalProperties, createFeedbackCommentParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(body); + return Objects.hash(body, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreateFeedbackCommentParam {\n"); sb.append(" body: ").append(toIndentedString(body)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreateFeedbackCommentParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateFeedbackCommentParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreateFeedbackCommentParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, CreateFeedbackCommentParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, CreateFeedbackCommentParam value) throws IOExc public CreateFeedbackCommentParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateFeedbackCommentParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/communication/models/CreateFeedbackParam.java b/src/main/java/saasus/sdk/communication/models/CreateFeedbackParam.java index 99d07766..952d8d2e 100644 --- a/src/main/java/saasus/sdk/communication/models/CreateFeedbackParam.java +++ b/src/main/java/saasus/sdk/communication/models/CreateFeedbackParam.java @@ -49,7 +49,7 @@ /** * CreateFeedbackParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class CreateFeedbackParam { public static final String SERIALIZED_NAME_FEEDBACK_TITLE = "feedback_title"; @SerializedName(SERIALIZED_NAME_FEEDBACK_TITLE) @@ -122,6 +122,50 @@ public void setUserId(String userId) { this.userId = userId; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateFeedbackParam instance itself + */ + public CreateFeedbackParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -135,12 +179,13 @@ public boolean equals(Object o) { CreateFeedbackParam createFeedbackParam = (CreateFeedbackParam) o; return Objects.equals(this.feedbackTitle, createFeedbackParam.feedbackTitle) && Objects.equals(this.feedbackDescription, createFeedbackParam.feedbackDescription) && - Objects.equals(this.userId, createFeedbackParam.userId); + Objects.equals(this.userId, createFeedbackParam.userId)&& + Objects.equals(this.additionalProperties, createFeedbackParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(feedbackTitle, feedbackDescription, userId); + return Objects.hash(feedbackTitle, feedbackDescription, userId, additionalProperties); } @Override @@ -150,6 +195,7 @@ public String toString() { sb.append(" feedbackTitle: ").append(toIndentedString(feedbackTitle)).append("\n"); sb.append(" feedbackDescription: ").append(toIndentedString(feedbackDescription)).append("\n"); sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -196,14 +242,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreateFeedbackParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateFeedbackParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreateFeedbackParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -237,6 +275,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, CreateFeedbackParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -244,7 +299,28 @@ public void write(JsonWriter out, CreateFeedbackParam value) throws IOException public CreateFeedbackParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateFeedbackParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/communication/models/CreateVoteUserParam.java b/src/main/java/saasus/sdk/communication/models/CreateVoteUserParam.java index 2d378412..bf997f27 100644 --- a/src/main/java/saasus/sdk/communication/models/CreateVoteUserParam.java +++ b/src/main/java/saasus/sdk/communication/models/CreateVoteUserParam.java @@ -49,7 +49,7 @@ /** * CreateVoteUserParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class CreateVoteUserParam { public static final String SERIALIZED_NAME_USER_ID = "user_id"; @SerializedName(SERIALIZED_NAME_USER_ID) @@ -76,6 +76,50 @@ public void setUserId(String userId) { this.userId = userId; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateVoteUserParam instance itself + */ + public CreateVoteUserParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } CreateVoteUserParam createVoteUserParam = (CreateVoteUserParam) o; - return Objects.equals(this.userId, createVoteUserParam.userId); + return Objects.equals(this.userId, createVoteUserParam.userId)&& + Objects.equals(this.additionalProperties, createVoteUserParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(userId); + return Objects.hash(userId, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreateVoteUserParam {\n"); sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreateVoteUserParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateVoteUserParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreateVoteUserParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, CreateVoteUserParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, CreateVoteUserParam value) throws IOException public CreateVoteUserParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateVoteUserParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/communication/models/Error.java b/src/main/java/saasus/sdk/communication/models/Error.java index 13000f2c..0b2ce1ce 100644 --- a/src/main/java/saasus/sdk/communication/models/Error.java +++ b/src/main/java/saasus/sdk/communication/models/Error.java @@ -49,7 +49,7 @@ /** * Error */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class Error { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @@ -99,6 +99,50 @@ public void setMessage(String message) { this.message = message; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Error instance itself + */ + public Error putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } Error error = (Error) o; return Objects.equals(this.type, error.type) && - Objects.equals(this.message, error.message); + Objects.equals(this.message, error.message)&& + Objects.equals(this.additionalProperties, error.additionalProperties); } @Override public int hashCode() { - return Objects.hash(type, message); + return Objects.hash(type, message, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class Error {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Error.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Error` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Error.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Error value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, Error value) throws IOException { public Error read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Error instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/communication/models/Feedback.java b/src/main/java/saasus/sdk/communication/models/Feedback.java index 198ac0ae..4ae06058 100644 --- a/src/main/java/saasus/sdk/communication/models/Feedback.java +++ b/src/main/java/saasus/sdk/communication/models/Feedback.java @@ -53,7 +53,7 @@ /** * Feedback */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class Feedback { public static final String SERIALIZED_NAME_FEEDBACK_TITLE = "feedback_title"; @SerializedName(SERIALIZED_NAME_FEEDBACK_TITLE) @@ -280,6 +280,50 @@ public void setStatus(Integer status) { this.status = status; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Feedback instance itself + */ + public Feedback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -299,12 +343,13 @@ public boolean equals(Object o) { Objects.equals(this.id, feedback.id) && Objects.equals(this.userId, feedback.userId) && Objects.equals(this.createdAt, feedback.createdAt) && - Objects.equals(this.status, feedback.status); + Objects.equals(this.status, feedback.status)&& + Objects.equals(this.additionalProperties, feedback.additionalProperties); } @Override public int hashCode() { - return Objects.hash(feedbackTitle, feedbackDescription, comments, count, users, id, userId, createdAt, status); + return Objects.hash(feedbackTitle, feedbackDescription, comments, count, users, id, userId, createdAt, status, additionalProperties); } @Override @@ -320,6 +365,7 @@ public String toString() { sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -378,14 +424,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Feedback.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Feedback` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Feedback.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -442,6 +480,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Feedback value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -449,7 +504,28 @@ public void write(JsonWriter out, Feedback value) throws IOException { public Feedback read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Feedback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/communication/models/FeedbackSaveProps.java b/src/main/java/saasus/sdk/communication/models/FeedbackSaveProps.java index 0c4560d9..7655be39 100644 --- a/src/main/java/saasus/sdk/communication/models/FeedbackSaveProps.java +++ b/src/main/java/saasus/sdk/communication/models/FeedbackSaveProps.java @@ -49,7 +49,7 @@ /** * FeedbackSaveProps */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class FeedbackSaveProps { public static final String SERIALIZED_NAME_FEEDBACK_TITLE = "feedback_title"; @SerializedName(SERIALIZED_NAME_FEEDBACK_TITLE) @@ -99,6 +99,50 @@ public void setFeedbackDescription(String feedbackDescription) { this.feedbackDescription = feedbackDescription; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FeedbackSaveProps instance itself + */ + public FeedbackSaveProps putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } FeedbackSaveProps feedbackSaveProps = (FeedbackSaveProps) o; return Objects.equals(this.feedbackTitle, feedbackSaveProps.feedbackTitle) && - Objects.equals(this.feedbackDescription, feedbackSaveProps.feedbackDescription); + Objects.equals(this.feedbackDescription, feedbackSaveProps.feedbackDescription)&& + Objects.equals(this.additionalProperties, feedbackSaveProps.additionalProperties); } @Override public int hashCode() { - return Objects.hash(feedbackTitle, feedbackDescription); + return Objects.hash(feedbackTitle, feedbackDescription, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class FeedbackSaveProps {\n"); sb.append(" feedbackTitle: ").append(toIndentedString(feedbackTitle)).append("\n"); sb.append(" feedbackDescription: ").append(toIndentedString(feedbackDescription)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!FeedbackSaveProps.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FeedbackSaveProps` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : FeedbackSaveProps.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, FeedbackSaveProps value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, FeedbackSaveProps value) throws IOException { public FeedbackSaveProps read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FeedbackSaveProps instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/communication/models/Feedbacks.java b/src/main/java/saasus/sdk/communication/models/Feedbacks.java index de4ad5bb..8d59ce3e 100644 --- a/src/main/java/saasus/sdk/communication/models/Feedbacks.java +++ b/src/main/java/saasus/sdk/communication/models/Feedbacks.java @@ -52,7 +52,7 @@ /** * Feedbacks */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class Feedbacks { public static final String SERIALIZED_NAME_FEEDBACKS = "feedbacks"; @SerializedName(SERIALIZED_NAME_FEEDBACKS) @@ -87,6 +87,50 @@ public void setFeedbacks(List feedbacks) { this.feedbacks = feedbacks; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Feedbacks instance itself + */ + public Feedbacks putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } Feedbacks feedbacks = (Feedbacks) o; - return Objects.equals(this.feedbacks, feedbacks.feedbacks); + return Objects.equals(this.feedbacks, feedbacks.feedbacks)&& + Objects.equals(this.additionalProperties, feedbacks.additionalProperties); } @Override public int hashCode() { - return Objects.hash(feedbacks); + return Objects.hash(feedbacks, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Feedbacks {\n"); sb.append(" feedbacks: ").append(toIndentedString(feedbacks)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Feedbacks.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Feedbacks` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Feedbacks.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Feedbacks value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, Feedbacks value) throws IOException { public Feedbacks read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Feedbacks instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/communication/models/UpdateFeedbackCommentParam.java b/src/main/java/saasus/sdk/communication/models/UpdateFeedbackCommentParam.java index a587fd2e..b261c9f5 100644 --- a/src/main/java/saasus/sdk/communication/models/UpdateFeedbackCommentParam.java +++ b/src/main/java/saasus/sdk/communication/models/UpdateFeedbackCommentParam.java @@ -49,7 +49,7 @@ /** * UpdateFeedbackCommentParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class UpdateFeedbackCommentParam { public static final String SERIALIZED_NAME_BODY = "body"; @SerializedName(SERIALIZED_NAME_BODY) @@ -76,6 +76,50 @@ public void setBody(String body) { this.body = body; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateFeedbackCommentParam instance itself + */ + public UpdateFeedbackCommentParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } UpdateFeedbackCommentParam updateFeedbackCommentParam = (UpdateFeedbackCommentParam) o; - return Objects.equals(this.body, updateFeedbackCommentParam.body); + return Objects.equals(this.body, updateFeedbackCommentParam.body)&& + Objects.equals(this.additionalProperties, updateFeedbackCommentParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(body); + return Objects.hash(body, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class UpdateFeedbackCommentParam {\n"); sb.append(" body: ").append(toIndentedString(body)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateFeedbackCommentParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateFeedbackCommentParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UpdateFeedbackCommentParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateFeedbackCommentParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, UpdateFeedbackCommentParam value) throws IOExc public UpdateFeedbackCommentParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateFeedbackCommentParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/communication/models/UpdateFeedbackParam.java b/src/main/java/saasus/sdk/communication/models/UpdateFeedbackParam.java index 1d848c43..1668a75e 100644 --- a/src/main/java/saasus/sdk/communication/models/UpdateFeedbackParam.java +++ b/src/main/java/saasus/sdk/communication/models/UpdateFeedbackParam.java @@ -49,7 +49,7 @@ /** * UpdateFeedbackParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class UpdateFeedbackParam { public static final String SERIALIZED_NAME_FEEDBACK_TITLE = "feedback_title"; @SerializedName(SERIALIZED_NAME_FEEDBACK_TITLE) @@ -99,6 +99,50 @@ public void setFeedbackDescription(String feedbackDescription) { this.feedbackDescription = feedbackDescription; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateFeedbackParam instance itself + */ + public UpdateFeedbackParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } UpdateFeedbackParam updateFeedbackParam = (UpdateFeedbackParam) o; return Objects.equals(this.feedbackTitle, updateFeedbackParam.feedbackTitle) && - Objects.equals(this.feedbackDescription, updateFeedbackParam.feedbackDescription); + Objects.equals(this.feedbackDescription, updateFeedbackParam.feedbackDescription)&& + Objects.equals(this.additionalProperties, updateFeedbackParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(feedbackTitle, feedbackDescription); + return Objects.hash(feedbackTitle, feedbackDescription, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class UpdateFeedbackParam {\n"); sb.append(" feedbackTitle: ").append(toIndentedString(feedbackTitle)).append("\n"); sb.append(" feedbackDescription: ").append(toIndentedString(feedbackDescription)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateFeedbackParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateFeedbackParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UpdateFeedbackParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateFeedbackParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, UpdateFeedbackParam value) throws IOException public UpdateFeedbackParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateFeedbackParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/communication/models/UpdateFeedbackStatusParam.java b/src/main/java/saasus/sdk/communication/models/UpdateFeedbackStatusParam.java index f1f0a603..5d921720 100644 --- a/src/main/java/saasus/sdk/communication/models/UpdateFeedbackStatusParam.java +++ b/src/main/java/saasus/sdk/communication/models/UpdateFeedbackStatusParam.java @@ -49,7 +49,7 @@ /** * UpdateFeedbackStatusParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class UpdateFeedbackStatusParam { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) @@ -76,6 +76,50 @@ public void setStatus(Integer status) { this.status = status; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateFeedbackStatusParam instance itself + */ + public UpdateFeedbackStatusParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } UpdateFeedbackStatusParam updateFeedbackStatusParam = (UpdateFeedbackStatusParam) o; - return Objects.equals(this.status, updateFeedbackStatusParam.status); + return Objects.equals(this.status, updateFeedbackStatusParam.status)&& + Objects.equals(this.additionalProperties, updateFeedbackStatusParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(status); + return Objects.hash(status, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class UpdateFeedbackStatusParam {\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateFeedbackStatusParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateFeedbackStatusParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UpdateFeedbackStatusParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -174,6 +212,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateFeedbackStatusParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -181,7 +236,28 @@ public void write(JsonWriter out, UpdateFeedbackStatusParam value) throws IOExce public UpdateFeedbackStatusParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateFeedbackStatusParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/communication/models/User.java b/src/main/java/saasus/sdk/communication/models/User.java index f679c591..142fa0e6 100644 --- a/src/main/java/saasus/sdk/communication/models/User.java +++ b/src/main/java/saasus/sdk/communication/models/User.java @@ -49,7 +49,7 @@ /** * User */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class User { public static final String SERIALIZED_NAME_USER_ID = "user_id"; @SerializedName(SERIALIZED_NAME_USER_ID) @@ -76,6 +76,50 @@ public void setUserId(String userId) { this.userId = userId; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the User instance itself + */ + public User putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -87,12 +131,13 @@ public boolean equals(Object o) { return false; } User user = (User) o; - return Objects.equals(this.userId, user.userId); + return Objects.equals(this.userId, user.userId)&& + Objects.equals(this.additionalProperties, user.additionalProperties); } @Override public int hashCode() { - return Objects.hash(userId); + return Objects.hash(userId, additionalProperties); } @Override @@ -100,6 +145,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class User {\n"); sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -142,14 +188,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!User.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `User` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : User.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -177,6 +215,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, User value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -184,7 +239,28 @@ public void write(JsonWriter out, User value) throws IOException { public User read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + User instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/communication/models/Users.java b/src/main/java/saasus/sdk/communication/models/Users.java index 6b56d818..13a9af9b 100644 --- a/src/main/java/saasus/sdk/communication/models/Users.java +++ b/src/main/java/saasus/sdk/communication/models/Users.java @@ -52,7 +52,7 @@ /** * Users */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class Users { public static final String SERIALIZED_NAME_USERS = "users"; @SerializedName(SERIALIZED_NAME_USERS) @@ -87,6 +87,50 @@ public void setUsers(List users) { this.users = users; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Users instance itself + */ + public Users putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } Users users = (Users) o; - return Objects.equals(this.users, users.users); + return Objects.equals(this.users, users.users)&& + Objects.equals(this.additionalProperties, users.additionalProperties); } @Override public int hashCode() { - return Objects.hash(users); + return Objects.hash(users, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Users {\n"); sb.append(" users: ").append(toIndentedString(users)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Users.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Users` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Users.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Users value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, Users value) throws IOException { public Users read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Users instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/communication/models/Votes.java b/src/main/java/saasus/sdk/communication/models/Votes.java index f4f231c6..605a0092 100644 --- a/src/main/java/saasus/sdk/communication/models/Votes.java +++ b/src/main/java/saasus/sdk/communication/models/Votes.java @@ -52,7 +52,7 @@ /** * Votes */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:16:01.642502956Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:42.604951926Z[Etc/UTC]") public class Votes { public static final String SERIALIZED_NAME_USERS = "users"; @SerializedName(SERIALIZED_NAME_USERS) @@ -110,6 +110,50 @@ public void setCount(Integer count) { this.count = count; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Votes instance itself + */ + public Votes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -122,12 +166,13 @@ public boolean equals(Object o) { } Votes votes = (Votes) o; return Objects.equals(this.users, votes.users) && - Objects.equals(this.count, votes.count); + Objects.equals(this.count, votes.count)&& + Objects.equals(this.additionalProperties, votes.additionalProperties); } @Override public int hashCode() { - return Objects.hash(users, count); + return Objects.hash(users, count, additionalProperties); } @Override @@ -136,6 +181,7 @@ public String toString() { sb.append("class Votes {\n"); sb.append(" users: ").append(toIndentedString(users)).append("\n"); sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -180,14 +226,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Votes.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Votes` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Votes.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -222,6 +260,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Votes value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -229,7 +284,28 @@ public void write(JsonWriter out, Votes value) throws IOException { public Votes read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Votes instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/integration/ApiException.java b/src/main/java/saasus/sdk/integration/ApiException.java index 138a8e5e..590d9232 100644 --- a/src/main/java/saasus/sdk/integration/ApiException.java +++ b/src/main/java/saasus/sdk/integration/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:55.811243829Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:36.335936756Z[Etc/UTC]") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/src/main/java/saasus/sdk/integration/Configuration.java b/src/main/java/saasus/sdk/integration/Configuration.java index 715987ad..b24f85fd 100644 --- a/src/main/java/saasus/sdk/integration/Configuration.java +++ b/src/main/java/saasus/sdk/integration/Configuration.java @@ -13,7 +13,7 @@ package saasus.sdk.integration; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:55.811243829Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:36.335936756Z[Etc/UTC]") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/src/main/java/saasus/sdk/integration/Pair.java b/src/main/java/saasus/sdk/integration/Pair.java index 10eee738..5b9b2aea 100644 --- a/src/main/java/saasus/sdk/integration/Pair.java +++ b/src/main/java/saasus/sdk/integration/Pair.java @@ -13,7 +13,7 @@ package saasus.sdk.integration; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:55.811243829Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:36.335936756Z[Etc/UTC]") public class Pair { private String name = ""; private String value = ""; diff --git a/src/main/java/saasus/sdk/integration/StringUtil.java b/src/main/java/saasus/sdk/integration/StringUtil.java index e5c47c45..0c7f8400 100644 --- a/src/main/java/saasus/sdk/integration/StringUtil.java +++ b/src/main/java/saasus/sdk/integration/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:55.811243829Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:36.335936756Z[Etc/UTC]") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/src/main/java/saasus/sdk/integration/auth/ApiKeyAuth.java b/src/main/java/saasus/sdk/integration/auth/ApiKeyAuth.java index 7c84ece9..c1d3f55d 100644 --- a/src/main/java/saasus/sdk/integration/auth/ApiKeyAuth.java +++ b/src/main/java/saasus/sdk/integration/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:55.811243829Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:36.335936756Z[Etc/UTC]") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/src/main/java/saasus/sdk/integration/auth/HttpBearerAuth.java b/src/main/java/saasus/sdk/integration/auth/HttpBearerAuth.java index 9a341987..138108cb 100644 --- a/src/main/java/saasus/sdk/integration/auth/HttpBearerAuth.java +++ b/src/main/java/saasus/sdk/integration/auth/HttpBearerAuth.java @@ -22,7 +22,7 @@ import java.util.Optional; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:55.811243829Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:36.335936756Z[Etc/UTC]") public class HttpBearerAuth implements Authentication { private final String scheme; private Supplier tokenSupplier; diff --git a/src/main/java/saasus/sdk/integration/models/AbstractOpenApiSchema.java b/src/main/java/saasus/sdk/integration/models/AbstractOpenApiSchema.java index 7fba09b3..55395921 100644 --- a/src/main/java/saasus/sdk/integration/models/AbstractOpenApiSchema.java +++ b/src/main/java/saasus/sdk/integration/models/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:55.811243829Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:36.335936756Z[Etc/UTC]") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/src/main/java/saasus/sdk/integration/models/CreateEventBridgeEventParam.java b/src/main/java/saasus/sdk/integration/models/CreateEventBridgeEventParam.java index 966e1bd3..f6d432be 100644 --- a/src/main/java/saasus/sdk/integration/models/CreateEventBridgeEventParam.java +++ b/src/main/java/saasus/sdk/integration/models/CreateEventBridgeEventParam.java @@ -52,7 +52,7 @@ /** * CreateEventBridgeEventParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:55.811243829Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:36.335936756Z[Etc/UTC]") public class CreateEventBridgeEventParam { public static final String SERIALIZED_NAME_EVENT_MESSAGES = "event_messages"; @SerializedName(SERIALIZED_NAME_EVENT_MESSAGES) @@ -87,6 +87,50 @@ public void setEventMessages(List eventMessages) { this.eventMessages = eventMessages; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateEventBridgeEventParam instance itself + */ + public CreateEventBridgeEventParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } CreateEventBridgeEventParam createEventBridgeEventParam = (CreateEventBridgeEventParam) o; - return Objects.equals(this.eventMessages, createEventBridgeEventParam.eventMessages); + return Objects.equals(this.eventMessages, createEventBridgeEventParam.eventMessages)&& + Objects.equals(this.additionalProperties, createEventBridgeEventParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(eventMessages); + return Objects.hash(eventMessages, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreateEventBridgeEventParam {\n"); sb.append(" eventMessages: ").append(toIndentedString(eventMessages)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreateEventBridgeEventParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateEventBridgeEventParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreateEventBridgeEventParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, CreateEventBridgeEventParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, CreateEventBridgeEventParam value) throws IOEx public CreateEventBridgeEventParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateEventBridgeEventParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/integration/models/Error.java b/src/main/java/saasus/sdk/integration/models/Error.java index 32db40bb..c028ebc8 100644 --- a/src/main/java/saasus/sdk/integration/models/Error.java +++ b/src/main/java/saasus/sdk/integration/models/Error.java @@ -49,7 +49,7 @@ /** * Error */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:55.811243829Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:36.335936756Z[Etc/UTC]") public class Error { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @@ -99,6 +99,50 @@ public void setMessage(String message) { this.message = message; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Error instance itself + */ + public Error putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } Error error = (Error) o; return Objects.equals(this.type, error.type) && - Objects.equals(this.message, error.message); + Objects.equals(this.message, error.message)&& + Objects.equals(this.additionalProperties, error.additionalProperties); } @Override public int hashCode() { - return Objects.hash(type, message); + return Objects.hash(type, message, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class Error {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Error.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Error` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Error.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Error value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, Error value) throws IOException { public Error read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Error instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/integration/models/EventBridgeSettings.java b/src/main/java/saasus/sdk/integration/models/EventBridgeSettings.java index e405b97d..dae9e857 100644 --- a/src/main/java/saasus/sdk/integration/models/EventBridgeSettings.java +++ b/src/main/java/saasus/sdk/integration/models/EventBridgeSettings.java @@ -50,7 +50,7 @@ /** * EventBridgeSettings */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:55.811243829Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:36.335936756Z[Etc/UTC]") public class EventBridgeSettings { public static final String SERIALIZED_NAME_AWS_ACCOUNT_ID = "aws_account_id"; @SerializedName(SERIALIZED_NAME_AWS_ACCOUNT_ID) @@ -100,6 +100,50 @@ public void setAwsRegion(AwsRegion awsRegion) { this.awsRegion = awsRegion; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EventBridgeSettings instance itself + */ + public EventBridgeSettings putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -112,12 +156,13 @@ public boolean equals(Object o) { } EventBridgeSettings eventBridgeSettings = (EventBridgeSettings) o; return Objects.equals(this.awsAccountId, eventBridgeSettings.awsAccountId) && - Objects.equals(this.awsRegion, eventBridgeSettings.awsRegion); + Objects.equals(this.awsRegion, eventBridgeSettings.awsRegion)&& + Objects.equals(this.additionalProperties, eventBridgeSettings.additionalProperties); } @Override public int hashCode() { - return Objects.hash(awsAccountId, awsRegion); + return Objects.hash(awsAccountId, awsRegion, additionalProperties); } @Override @@ -126,6 +171,7 @@ public String toString() { sb.append("class EventBridgeSettings {\n"); sb.append(" awsAccountId: ").append(toIndentedString(awsAccountId)).append("\n"); sb.append(" awsRegion: ").append(toIndentedString(awsRegion)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -170,14 +216,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!EventBridgeSettings.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EventBridgeSettings` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : EventBridgeSettings.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, EventBridgeSettings value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, EventBridgeSettings value) throws IOException public EventBridgeSettings read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EventBridgeSettings instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/integration/models/EventMessage.java b/src/main/java/saasus/sdk/integration/models/EventMessage.java index d709a7c7..3faf96ea 100644 --- a/src/main/java/saasus/sdk/integration/models/EventMessage.java +++ b/src/main/java/saasus/sdk/integration/models/EventMessage.java @@ -49,7 +49,7 @@ /** * EventMessage */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:55.811243829Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:36.335936756Z[Etc/UTC]") public class EventMessage { public static final String SERIALIZED_NAME_EVENT_TYPE = "event_type"; @SerializedName(SERIALIZED_NAME_EVENT_TYPE) @@ -122,6 +122,50 @@ public void setMessage(String message) { this.message = message; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EventMessage instance itself + */ + public EventMessage putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -135,12 +179,13 @@ public boolean equals(Object o) { EventMessage eventMessage = (EventMessage) o; return Objects.equals(this.eventType, eventMessage.eventType) && Objects.equals(this.eventDetailType, eventMessage.eventDetailType) && - Objects.equals(this.message, eventMessage.message); + Objects.equals(this.message, eventMessage.message)&& + Objects.equals(this.additionalProperties, eventMessage.additionalProperties); } @Override public int hashCode() { - return Objects.hash(eventType, eventDetailType, message); + return Objects.hash(eventType, eventDetailType, message, additionalProperties); } @Override @@ -150,6 +195,7 @@ public String toString() { sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); sb.append(" eventDetailType: ").append(toIndentedString(eventDetailType)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -196,14 +242,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!EventMessage.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EventMessage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : EventMessage.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -237,6 +275,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, EventMessage value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -244,7 +299,28 @@ public void write(JsonWriter out, EventMessage value) throws IOException { public EventMessage read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EventMessage instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/ApiException.java b/src/main/java/saasus/sdk/pricing/ApiException.java index a91938b9..2c5f68c3 100644 --- a/src/main/java/saasus/sdk/pricing/ApiException.java +++ b/src/main/java/saasus/sdk/pricing/ApiException.java @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/src/main/java/saasus/sdk/pricing/Configuration.java b/src/main/java/saasus/sdk/pricing/Configuration.java index 30d5a963..8fb6f80e 100644 --- a/src/main/java/saasus/sdk/pricing/Configuration.java +++ b/src/main/java/saasus/sdk/pricing/Configuration.java @@ -13,7 +13,7 @@ package saasus.sdk.pricing; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class Configuration { public static final String VERSION = "1.0.0"; diff --git a/src/main/java/saasus/sdk/pricing/Pair.java b/src/main/java/saasus/sdk/pricing/Pair.java index af350914..c45fd100 100644 --- a/src/main/java/saasus/sdk/pricing/Pair.java +++ b/src/main/java/saasus/sdk/pricing/Pair.java @@ -13,7 +13,7 @@ package saasus.sdk.pricing; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class Pair { private String name = ""; private String value = ""; diff --git a/src/main/java/saasus/sdk/pricing/StringUtil.java b/src/main/java/saasus/sdk/pricing/StringUtil.java index 96794aa8..2581754e 100644 --- a/src/main/java/saasus/sdk/pricing/StringUtil.java +++ b/src/main/java/saasus/sdk/pricing/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/src/main/java/saasus/sdk/pricing/auth/ApiKeyAuth.java b/src/main/java/saasus/sdk/pricing/auth/ApiKeyAuth.java index 4678749f..bcbd533f 100644 --- a/src/main/java/saasus/sdk/pricing/auth/ApiKeyAuth.java +++ b/src/main/java/saasus/sdk/pricing/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/src/main/java/saasus/sdk/pricing/auth/HttpBearerAuth.java b/src/main/java/saasus/sdk/pricing/auth/HttpBearerAuth.java index 0f9fa763..e15104db 100644 --- a/src/main/java/saasus/sdk/pricing/auth/HttpBearerAuth.java +++ b/src/main/java/saasus/sdk/pricing/auth/HttpBearerAuth.java @@ -22,7 +22,7 @@ import java.util.Optional; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class HttpBearerAuth implements Authentication { private final String scheme; private Supplier tokenSupplier; diff --git a/src/main/java/saasus/sdk/pricing/models/AbstractOpenApiSchema.java b/src/main/java/saasus/sdk/pricing/models/AbstractOpenApiSchema.java index e0b6ea54..4d924915 100644 --- a/src/main/java/saasus/sdk/pricing/models/AbstractOpenApiSchema.java +++ b/src/main/java/saasus/sdk/pricing/models/AbstractOpenApiSchema.java @@ -21,7 +21,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/src/main/java/saasus/sdk/pricing/models/Error.java b/src/main/java/saasus/sdk/pricing/models/Error.java index 204fa3fe..dcd1b0f9 100644 --- a/src/main/java/saasus/sdk/pricing/models/Error.java +++ b/src/main/java/saasus/sdk/pricing/models/Error.java @@ -49,7 +49,7 @@ /** * Error */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class Error { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @@ -99,6 +99,50 @@ public void setMessage(String message) { this.message = message; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Error instance itself + */ + public Error putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } Error error = (Error) o; return Objects.equals(this.type, error.type) && - Objects.equals(this.message, error.message); + Objects.equals(this.message, error.message)&& + Objects.equals(this.additionalProperties, error.additionalProperties); } @Override public int hashCode() { - return Objects.hash(type, message); + return Objects.hash(type, message, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class Error {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!Error.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Error` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : Error.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, Error value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, Error value) throws IOException { public Error read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Error instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/MeteringUnit.java b/src/main/java/saasus/sdk/pricing/models/MeteringUnit.java index f63a4b0b..38cbc32b 100644 --- a/src/main/java/saasus/sdk/pricing/models/MeteringUnit.java +++ b/src/main/java/saasus/sdk/pricing/models/MeteringUnit.java @@ -50,7 +50,7 @@ /** * MeteringUnit */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class MeteringUnit { public static final String SERIALIZED_NAME_UNIT_NAME = "unit_name"; @SerializedName(SERIALIZED_NAME_UNIT_NAME) @@ -192,6 +192,50 @@ public void setUsed(Boolean used) { this.used = used; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MeteringUnit instance itself + */ + public MeteringUnit putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -208,12 +252,13 @@ public boolean equals(Object o) { Objects.equals(this.displayName, meteringUnit.displayName) && Objects.equals(this.description, meteringUnit.description) && Objects.equals(this.id, meteringUnit.id) && - Objects.equals(this.used, meteringUnit.used); + Objects.equals(this.used, meteringUnit.used)&& + Objects.equals(this.additionalProperties, meteringUnit.additionalProperties); } @Override public int hashCode() { - return Objects.hash(unitName, aggregateUsage, displayName, description, id, used); + return Objects.hash(unitName, aggregateUsage, displayName, description, id, used, additionalProperties); } @Override @@ -226,6 +271,7 @@ public String toString() { sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" used: ").append(toIndentedString(used)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -277,14 +323,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MeteringUnit.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MeteringUnit` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : MeteringUnit.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -325,6 +363,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, MeteringUnit value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -332,7 +387,28 @@ public void write(JsonWriter out, MeteringUnit value) throws IOException { public MeteringUnit read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MeteringUnit instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/MeteringUnitCount.java b/src/main/java/saasus/sdk/pricing/models/MeteringUnitCount.java index d7460656..ae99b4a7 100644 --- a/src/main/java/saasus/sdk/pricing/models/MeteringUnitCount.java +++ b/src/main/java/saasus/sdk/pricing/models/MeteringUnitCount.java @@ -49,7 +49,7 @@ /** * MeteringUnitCount */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class MeteringUnitCount { public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; @SerializedName(SERIALIZED_NAME_TIMESTAMP) @@ -99,6 +99,50 @@ public void setCount(Integer count) { this.count = count; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MeteringUnitCount instance itself + */ + public MeteringUnitCount putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } MeteringUnitCount meteringUnitCount = (MeteringUnitCount) o; return Objects.equals(this.timestamp, meteringUnitCount.timestamp) && - Objects.equals(this.count, meteringUnitCount.count); + Objects.equals(this.count, meteringUnitCount.count)&& + Objects.equals(this.additionalProperties, meteringUnitCount.additionalProperties); } @Override public int hashCode() { - return Objects.hash(timestamp, count); + return Objects.hash(timestamp, count, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class MeteringUnitCount {\n"); sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MeteringUnitCount.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MeteringUnitCount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : MeteringUnitCount.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -201,6 +239,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, MeteringUnitCount value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -208,7 +263,28 @@ public void write(JsonWriter out, MeteringUnitCount value) throws IOException { public MeteringUnitCount read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MeteringUnitCount instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/MeteringUnitDateCount.java b/src/main/java/saasus/sdk/pricing/models/MeteringUnitDateCount.java index 90dc049f..ca214214 100644 --- a/src/main/java/saasus/sdk/pricing/models/MeteringUnitDateCount.java +++ b/src/main/java/saasus/sdk/pricing/models/MeteringUnitDateCount.java @@ -49,7 +49,7 @@ /** * MeteringUnitDateCount */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class MeteringUnitDateCount { public static final String SERIALIZED_NAME_METERING_UNIT_NAME = "metering_unit_name"; @SerializedName(SERIALIZED_NAME_METERING_UNIT_NAME) @@ -122,6 +122,50 @@ public void setCount(Integer count) { this.count = count; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MeteringUnitDateCount instance itself + */ + public MeteringUnitDateCount putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -135,12 +179,13 @@ public boolean equals(Object o) { MeteringUnitDateCount meteringUnitDateCount = (MeteringUnitDateCount) o; return Objects.equals(this.meteringUnitName, meteringUnitDateCount.meteringUnitName) && Objects.equals(this.date, meteringUnitDateCount.date) && - Objects.equals(this.count, meteringUnitDateCount.count); + Objects.equals(this.count, meteringUnitDateCount.count)&& + Objects.equals(this.additionalProperties, meteringUnitDateCount.additionalProperties); } @Override public int hashCode() { - return Objects.hash(meteringUnitName, date, count); + return Objects.hash(meteringUnitName, date, count, additionalProperties); } @Override @@ -150,6 +195,7 @@ public String toString() { sb.append(" meteringUnitName: ").append(toIndentedString(meteringUnitName)).append("\n"); sb.append(" date: ").append(toIndentedString(date)).append("\n"); sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -196,14 +242,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MeteringUnitDateCount.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MeteringUnitDateCount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : MeteringUnitDateCount.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -234,6 +272,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, MeteringUnitDateCount value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -241,7 +296,28 @@ public void write(JsonWriter out, MeteringUnitDateCount value) throws IOExceptio public MeteringUnitDateCount read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MeteringUnitDateCount instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/MeteringUnitDateCounts.java b/src/main/java/saasus/sdk/pricing/models/MeteringUnitDateCounts.java index d1229b79..0f2df2ff 100644 --- a/src/main/java/saasus/sdk/pricing/models/MeteringUnitDateCounts.java +++ b/src/main/java/saasus/sdk/pricing/models/MeteringUnitDateCounts.java @@ -52,7 +52,7 @@ /** * MeteringUnitDateCounts */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class MeteringUnitDateCounts { public static final String SERIALIZED_NAME_COUNTS = "counts"; @SerializedName(SERIALIZED_NAME_COUNTS) @@ -87,6 +87,50 @@ public void setCounts(List counts) { this.counts = counts; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MeteringUnitDateCounts instance itself + */ + public MeteringUnitDateCounts putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } MeteringUnitDateCounts meteringUnitDateCounts = (MeteringUnitDateCounts) o; - return Objects.equals(this.counts, meteringUnitDateCounts.counts); + return Objects.equals(this.counts, meteringUnitDateCounts.counts)&& + Objects.equals(this.additionalProperties, meteringUnitDateCounts.additionalProperties); } @Override public int hashCode() { - return Objects.hash(counts); + return Objects.hash(counts, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class MeteringUnitDateCounts {\n"); sb.append(" counts: ").append(toIndentedString(counts)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MeteringUnitDateCounts.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MeteringUnitDateCounts` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : MeteringUnitDateCounts.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, MeteringUnitDateCounts value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, MeteringUnitDateCounts value) throws IOExcepti public MeteringUnitDateCounts read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MeteringUnitDateCounts instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/MeteringUnitDatePeriodCounts.java b/src/main/java/saasus/sdk/pricing/models/MeteringUnitDatePeriodCounts.java index dcabcbfc..95239dab 100644 --- a/src/main/java/saasus/sdk/pricing/models/MeteringUnitDatePeriodCounts.java +++ b/src/main/java/saasus/sdk/pricing/models/MeteringUnitDatePeriodCounts.java @@ -52,7 +52,7 @@ /** * MeteringUnitDatePeriodCounts */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class MeteringUnitDatePeriodCounts { public static final String SERIALIZED_NAME_METERING_UNIT_NAME = "metering_unit_name"; @SerializedName(SERIALIZED_NAME_METERING_UNIT_NAME) @@ -110,6 +110,50 @@ public void setCounts(List counts) { this.counts = counts; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MeteringUnitDatePeriodCounts instance itself + */ + public MeteringUnitDatePeriodCounts putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -122,12 +166,13 @@ public boolean equals(Object o) { } MeteringUnitDatePeriodCounts meteringUnitDatePeriodCounts = (MeteringUnitDatePeriodCounts) o; return Objects.equals(this.meteringUnitName, meteringUnitDatePeriodCounts.meteringUnitName) && - Objects.equals(this.counts, meteringUnitDatePeriodCounts.counts); + Objects.equals(this.counts, meteringUnitDatePeriodCounts.counts)&& + Objects.equals(this.additionalProperties, meteringUnitDatePeriodCounts.additionalProperties); } @Override public int hashCode() { - return Objects.hash(meteringUnitName, counts); + return Objects.hash(meteringUnitName, counts, additionalProperties); } @Override @@ -136,6 +181,7 @@ public String toString() { sb.append("class MeteringUnitDatePeriodCounts {\n"); sb.append(" meteringUnitName: ").append(toIndentedString(meteringUnitName)).append("\n"); sb.append(" counts: ").append(toIndentedString(counts)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -180,14 +226,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MeteringUnitDatePeriodCounts.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MeteringUnitDatePeriodCounts` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : MeteringUnitDatePeriodCounts.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -225,6 +263,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, MeteringUnitDatePeriodCounts value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -232,7 +287,28 @@ public void write(JsonWriter out, MeteringUnitDatePeriodCounts value) throws IOE public MeteringUnitDatePeriodCounts read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MeteringUnitDatePeriodCounts instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/MeteringUnitMonthCount.java b/src/main/java/saasus/sdk/pricing/models/MeteringUnitMonthCount.java index b1e76ad6..37914805 100644 --- a/src/main/java/saasus/sdk/pricing/models/MeteringUnitMonthCount.java +++ b/src/main/java/saasus/sdk/pricing/models/MeteringUnitMonthCount.java @@ -49,7 +49,7 @@ /** * MeteringUnitMonthCount */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class MeteringUnitMonthCount { public static final String SERIALIZED_NAME_METERING_UNIT_NAME = "metering_unit_name"; @SerializedName(SERIALIZED_NAME_METERING_UNIT_NAME) @@ -122,6 +122,50 @@ public void setCount(Integer count) { this.count = count; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MeteringUnitMonthCount instance itself + */ + public MeteringUnitMonthCount putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -135,12 +179,13 @@ public boolean equals(Object o) { MeteringUnitMonthCount meteringUnitMonthCount = (MeteringUnitMonthCount) o; return Objects.equals(this.meteringUnitName, meteringUnitMonthCount.meteringUnitName) && Objects.equals(this.month, meteringUnitMonthCount.month) && - Objects.equals(this.count, meteringUnitMonthCount.count); + Objects.equals(this.count, meteringUnitMonthCount.count)&& + Objects.equals(this.additionalProperties, meteringUnitMonthCount.additionalProperties); } @Override public int hashCode() { - return Objects.hash(meteringUnitName, month, count); + return Objects.hash(meteringUnitName, month, count, additionalProperties); } @Override @@ -150,6 +195,7 @@ public String toString() { sb.append(" meteringUnitName: ").append(toIndentedString(meteringUnitName)).append("\n"); sb.append(" month: ").append(toIndentedString(month)).append("\n"); sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -196,14 +242,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MeteringUnitMonthCount.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MeteringUnitMonthCount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : MeteringUnitMonthCount.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -234,6 +272,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, MeteringUnitMonthCount value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -241,7 +296,28 @@ public void write(JsonWriter out, MeteringUnitMonthCount value) throws IOExcepti public MeteringUnitMonthCount read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MeteringUnitMonthCount instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/MeteringUnitMonthCounts.java b/src/main/java/saasus/sdk/pricing/models/MeteringUnitMonthCounts.java index 1ade0119..d17eb662 100644 --- a/src/main/java/saasus/sdk/pricing/models/MeteringUnitMonthCounts.java +++ b/src/main/java/saasus/sdk/pricing/models/MeteringUnitMonthCounts.java @@ -52,7 +52,7 @@ /** * MeteringUnitMonthCounts */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class MeteringUnitMonthCounts { public static final String SERIALIZED_NAME_COUNTS = "counts"; @SerializedName(SERIALIZED_NAME_COUNTS) @@ -87,6 +87,50 @@ public void setCounts(List counts) { this.counts = counts; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MeteringUnitMonthCounts instance itself + */ + public MeteringUnitMonthCounts putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } MeteringUnitMonthCounts meteringUnitMonthCounts = (MeteringUnitMonthCounts) o; - return Objects.equals(this.counts, meteringUnitMonthCounts.counts); + return Objects.equals(this.counts, meteringUnitMonthCounts.counts)&& + Objects.equals(this.additionalProperties, meteringUnitMonthCounts.additionalProperties); } @Override public int hashCode() { - return Objects.hash(counts); + return Objects.hash(counts, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class MeteringUnitMonthCounts {\n"); sb.append(" counts: ").append(toIndentedString(counts)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MeteringUnitMonthCounts.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MeteringUnitMonthCounts` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : MeteringUnitMonthCounts.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, MeteringUnitMonthCounts value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, MeteringUnitMonthCounts value) throws IOExcept public MeteringUnitMonthCounts read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MeteringUnitMonthCounts instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/MeteringUnitProps.java b/src/main/java/saasus/sdk/pricing/models/MeteringUnitProps.java index a7c78f97..17e9c922 100644 --- a/src/main/java/saasus/sdk/pricing/models/MeteringUnitProps.java +++ b/src/main/java/saasus/sdk/pricing/models/MeteringUnitProps.java @@ -50,7 +50,7 @@ /** * MeteringUnitProps */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class MeteringUnitProps { public static final String SERIALIZED_NAME_UNIT_NAME = "unit_name"; @SerializedName(SERIALIZED_NAME_UNIT_NAME) @@ -146,6 +146,50 @@ public void setDescription(String description) { this.description = description; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MeteringUnitProps instance itself + */ + public MeteringUnitProps putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -160,12 +204,13 @@ public boolean equals(Object o) { return Objects.equals(this.unitName, meteringUnitProps.unitName) && Objects.equals(this.aggregateUsage, meteringUnitProps.aggregateUsage) && Objects.equals(this.displayName, meteringUnitProps.displayName) && - Objects.equals(this.description, meteringUnitProps.description); + Objects.equals(this.description, meteringUnitProps.description)&& + Objects.equals(this.additionalProperties, meteringUnitProps.additionalProperties); } @Override public int hashCode() { - return Objects.hash(unitName, aggregateUsage, displayName, description); + return Objects.hash(unitName, aggregateUsage, displayName, description, additionalProperties); } @Override @@ -176,6 +221,7 @@ public String toString() { sb.append(" aggregateUsage: ").append(toIndentedString(aggregateUsage)).append("\n"); sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -223,14 +269,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MeteringUnitProps.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MeteringUnitProps` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : MeteringUnitProps.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -268,6 +306,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, MeteringUnitProps value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -275,7 +330,28 @@ public void write(JsonWriter out, MeteringUnitProps value) throws IOException { public MeteringUnitProps read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MeteringUnitProps instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/MeteringUnitTimestampCount.java b/src/main/java/saasus/sdk/pricing/models/MeteringUnitTimestampCount.java index 9c8f8f87..6475239d 100644 --- a/src/main/java/saasus/sdk/pricing/models/MeteringUnitTimestampCount.java +++ b/src/main/java/saasus/sdk/pricing/models/MeteringUnitTimestampCount.java @@ -49,7 +49,7 @@ /** * MeteringUnitTimestampCount */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class MeteringUnitTimestampCount { public static final String SERIALIZED_NAME_METERING_UNIT_NAME = "metering_unit_name"; @SerializedName(SERIALIZED_NAME_METERING_UNIT_NAME) @@ -122,6 +122,50 @@ public void setCount(Integer count) { this.count = count; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MeteringUnitTimestampCount instance itself + */ + public MeteringUnitTimestampCount putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -135,12 +179,13 @@ public boolean equals(Object o) { MeteringUnitTimestampCount meteringUnitTimestampCount = (MeteringUnitTimestampCount) o; return Objects.equals(this.meteringUnitName, meteringUnitTimestampCount.meteringUnitName) && Objects.equals(this.timestamp, meteringUnitTimestampCount.timestamp) && - Objects.equals(this.count, meteringUnitTimestampCount.count); + Objects.equals(this.count, meteringUnitTimestampCount.count)&& + Objects.equals(this.additionalProperties, meteringUnitTimestampCount.additionalProperties); } @Override public int hashCode() { - return Objects.hash(meteringUnitName, timestamp, count); + return Objects.hash(meteringUnitName, timestamp, count, additionalProperties); } @Override @@ -150,6 +195,7 @@ public String toString() { sb.append(" meteringUnitName: ").append(toIndentedString(meteringUnitName)).append("\n"); sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -196,14 +242,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MeteringUnitTimestampCount.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MeteringUnitTimestampCount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : MeteringUnitTimestampCount.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -231,6 +269,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, MeteringUnitTimestampCount value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -238,7 +293,28 @@ public void write(JsonWriter out, MeteringUnitTimestampCount value) throws IOExc public MeteringUnitTimestampCount read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MeteringUnitTimestampCount instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/MeteringUnits.java b/src/main/java/saasus/sdk/pricing/models/MeteringUnits.java index e53c784a..895ecdf5 100644 --- a/src/main/java/saasus/sdk/pricing/models/MeteringUnits.java +++ b/src/main/java/saasus/sdk/pricing/models/MeteringUnits.java @@ -52,7 +52,7 @@ /** * MeteringUnits */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class MeteringUnits { public static final String SERIALIZED_NAME_UNITS = "units"; @SerializedName(SERIALIZED_NAME_UNITS) @@ -87,6 +87,50 @@ public void setUnits(List units) { this.units = units; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MeteringUnits instance itself + */ + public MeteringUnits putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } MeteringUnits meteringUnits = (MeteringUnits) o; - return Objects.equals(this.units, meteringUnits.units); + return Objects.equals(this.units, meteringUnits.units)&& + Objects.equals(this.additionalProperties, meteringUnits.additionalProperties); } @Override public int hashCode() { - return Objects.hash(units); + return Objects.hash(units, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class MeteringUnits {\n"); sb.append(" units: ").append(toIndentedString(units)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MeteringUnits.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MeteringUnits` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : MeteringUnits.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, MeteringUnits value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, MeteringUnits value) throws IOException { public MeteringUnits read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MeteringUnits instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/PricingFixedUnit.java b/src/main/java/saasus/sdk/pricing/models/PricingFixedUnit.java index 5655fb56..c9552c0f 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingFixedUnit.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingFixedUnit.java @@ -52,7 +52,7 @@ /** * PricingFixedUnit */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class PricingFixedUnit { public static final String SERIALIZED_NAME_UNIT_AMOUNT = "unit_amount"; @SerializedName(SERIALIZED_NAME_UNIT_AMOUNT) @@ -263,6 +263,50 @@ public void setUsed(Boolean used) { this.used = used; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PricingFixedUnit instance itself + */ + public PricingFixedUnit putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -282,12 +326,13 @@ public boolean equals(Object o) { Objects.equals(this.type, pricingFixedUnit.type) && Objects.equals(this.currency, pricingFixedUnit.currency) && Objects.equals(this.id, pricingFixedUnit.id) && - Objects.equals(this.used, pricingFixedUnit.used); + Objects.equals(this.used, pricingFixedUnit.used)&& + Objects.equals(this.additionalProperties, pricingFixedUnit.additionalProperties); } @Override public int hashCode() { - return Objects.hash(unitAmount, recurringInterval, name, displayName, description, type, currency, id, used); + return Objects.hash(unitAmount, recurringInterval, name, displayName, description, type, currency, id, used, additionalProperties); } @Override @@ -303,6 +348,7 @@ public String toString() { sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" used: ").append(toIndentedString(used)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -361,14 +407,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PricingFixedUnit.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingFixedUnit` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PricingFixedUnit.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -411,6 +449,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PricingFixedUnit value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -418,7 +473,28 @@ public void write(JsonWriter out, PricingFixedUnit value) throws IOException { public PricingFixedUnit read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PricingFixedUnit instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/PricingFixedUnitForSave.java b/src/main/java/saasus/sdk/pricing/models/PricingFixedUnitForSave.java index 588f3ba7..d8aa7da2 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingFixedUnitForSave.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingFixedUnitForSave.java @@ -52,7 +52,7 @@ /** * PricingFixedUnitForSave */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class PricingFixedUnitForSave { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -217,6 +217,50 @@ public void setRecurringInterval(RecurringInterval recurringInterval) { this.recurringInterval = recurringInterval; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PricingFixedUnitForSave instance itself + */ + public PricingFixedUnitForSave putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -234,12 +278,13 @@ public boolean equals(Object o) { Objects.equals(this.type, pricingFixedUnitForSave.type) && Objects.equals(this.currency, pricingFixedUnitForSave.currency) && Objects.equals(this.unitAmount, pricingFixedUnitForSave.unitAmount) && - Objects.equals(this.recurringInterval, pricingFixedUnitForSave.recurringInterval); + Objects.equals(this.recurringInterval, pricingFixedUnitForSave.recurringInterval)&& + Objects.equals(this.additionalProperties, pricingFixedUnitForSave.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, displayName, description, type, currency, unitAmount, recurringInterval); + return Objects.hash(name, displayName, description, type, currency, unitAmount, recurringInterval, additionalProperties); } @Override @@ -253,6 +298,7 @@ public String toString() { sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); sb.append(" unitAmount: ").append(toIndentedString(unitAmount)).append("\n"); sb.append(" recurringInterval: ").append(toIndentedString(recurringInterval)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -307,14 +353,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PricingFixedUnitForSave.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingFixedUnitForSave` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PricingFixedUnitForSave.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -354,6 +392,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PricingFixedUnitForSave value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -361,7 +416,28 @@ public void write(JsonWriter out, PricingFixedUnitForSave value) throws IOExcept public PricingFixedUnitForSave read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PricingFixedUnitForSave instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/PricingMenu.java b/src/main/java/saasus/sdk/pricing/models/PricingMenu.java index 157d20d4..f85a9140 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingMenu.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingMenu.java @@ -52,7 +52,7 @@ /** * PricingMenu */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class PricingMenu { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -202,6 +202,50 @@ public void setId(String id) { this.id = id; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PricingMenu instance itself + */ + public PricingMenu putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -218,12 +262,13 @@ public boolean equals(Object o) { Objects.equals(this.description, pricingMenu.description) && Objects.equals(this.used, pricingMenu.used) && Objects.equals(this.units, pricingMenu.units) && - Objects.equals(this.id, pricingMenu.id); + Objects.equals(this.id, pricingMenu.id)&& + Objects.equals(this.additionalProperties, pricingMenu.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, displayName, description, used, units, id); + return Objects.hash(name, displayName, description, used, units, id, additionalProperties); } @Override @@ -236,6 +281,7 @@ public String toString() { sb.append(" used: ").append(toIndentedString(used)).append("\n"); sb.append(" units: ").append(toIndentedString(units)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -288,14 +334,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PricingMenu.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingMenu` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PricingMenu.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -342,6 +380,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PricingMenu value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -349,7 +404,28 @@ public void write(JsonWriter out, PricingMenu value) throws IOException { public PricingMenu read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PricingMenu instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/PricingMenuProps.java b/src/main/java/saasus/sdk/pricing/models/PricingMenuProps.java index f2a22669..a4890f6b 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingMenuProps.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingMenuProps.java @@ -52,7 +52,7 @@ /** * PricingMenuProps */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class PricingMenuProps { public static final String SERIALIZED_NAME_UNITS = "units"; @SerializedName(SERIALIZED_NAME_UNITS) @@ -179,6 +179,50 @@ public void setUsed(Boolean used) { this.used = used; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PricingMenuProps instance itself + */ + public PricingMenuProps putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -194,12 +238,13 @@ public boolean equals(Object o) { Objects.equals(this.name, pricingMenuProps.name) && Objects.equals(this.displayName, pricingMenuProps.displayName) && Objects.equals(this.description, pricingMenuProps.description) && - Objects.equals(this.used, pricingMenuProps.used); + Objects.equals(this.used, pricingMenuProps.used)&& + Objects.equals(this.additionalProperties, pricingMenuProps.additionalProperties); } @Override public int hashCode() { - return Objects.hash(units, name, displayName, description, used); + return Objects.hash(units, name, displayName, description, used, additionalProperties); } @Override @@ -211,6 +256,7 @@ public String toString() { sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" used: ").append(toIndentedString(used)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -261,14 +307,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PricingMenuProps.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingMenuProps` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PricingMenuProps.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -312,6 +350,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PricingMenuProps value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -319,7 +374,28 @@ public void write(JsonWriter out, PricingMenuProps value) throws IOException { public PricingMenuProps read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PricingMenuProps instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/PricingMenus.java b/src/main/java/saasus/sdk/pricing/models/PricingMenus.java index bb45ead1..a2b359a1 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingMenus.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingMenus.java @@ -52,7 +52,7 @@ /** * PricingMenus */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class PricingMenus { public static final String SERIALIZED_NAME_PRICING_MENUS = "pricing_menus"; @SerializedName(SERIALIZED_NAME_PRICING_MENUS) @@ -87,6 +87,50 @@ public void setPricingMenus(List pricingMenus) { this.pricingMenus = pricingMenus; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PricingMenus instance itself + */ + public PricingMenus putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } PricingMenus pricingMenus = (PricingMenus) o; - return Objects.equals(this.pricingMenus, pricingMenus.pricingMenus); + return Objects.equals(this.pricingMenus, pricingMenus.pricingMenus)&& + Objects.equals(this.additionalProperties, pricingMenus.additionalProperties); } @Override public int hashCode() { - return Objects.hash(pricingMenus); + return Objects.hash(pricingMenus, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PricingMenus {\n"); sb.append(" pricingMenus: ").append(toIndentedString(pricingMenus)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PricingMenus.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingMenus` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PricingMenus.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PricingMenus value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, PricingMenus value) throws IOException { public PricingMenus read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PricingMenus instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/PricingPlan.java b/src/main/java/saasus/sdk/pricing/models/PricingPlan.java index 4b6365f8..3b3975d9 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingPlan.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingPlan.java @@ -52,7 +52,7 @@ /** * PricingPlan */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class PricingPlan { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -202,6 +202,50 @@ public void setId(String id) { this.id = id; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PricingPlan instance itself + */ + public PricingPlan putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -218,12 +262,13 @@ public boolean equals(Object o) { Objects.equals(this.description, pricingPlan.description) && Objects.equals(this.used, pricingPlan.used) && Objects.equals(this.pricingMenus, pricingPlan.pricingMenus) && - Objects.equals(this.id, pricingPlan.id); + Objects.equals(this.id, pricingPlan.id)&& + Objects.equals(this.additionalProperties, pricingPlan.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, displayName, description, used, pricingMenus, id); + return Objects.hash(name, displayName, description, used, pricingMenus, id, additionalProperties); } @Override @@ -236,6 +281,7 @@ public String toString() { sb.append(" used: ").append(toIndentedString(used)).append("\n"); sb.append(" pricingMenus: ").append(toIndentedString(pricingMenus)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -288,14 +334,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PricingPlan.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingPlan` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PricingPlan.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -342,6 +380,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PricingPlan value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -349,7 +404,28 @@ public void write(JsonWriter out, PricingPlan value) throws IOException { public PricingPlan read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PricingPlan instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/PricingPlanProps.java b/src/main/java/saasus/sdk/pricing/models/PricingPlanProps.java index 51fffad1..3bcf530a 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingPlanProps.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingPlanProps.java @@ -52,7 +52,7 @@ /** * PricingPlanProps */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class PricingPlanProps { public static final String SERIALIZED_NAME_PRICING_MENUS = "pricing_menus"; @SerializedName(SERIALIZED_NAME_PRICING_MENUS) @@ -179,6 +179,50 @@ public void setUsed(Boolean used) { this.used = used; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PricingPlanProps instance itself + */ + public PricingPlanProps putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -194,12 +238,13 @@ public boolean equals(Object o) { Objects.equals(this.name, pricingPlanProps.name) && Objects.equals(this.displayName, pricingPlanProps.displayName) && Objects.equals(this.description, pricingPlanProps.description) && - Objects.equals(this.used, pricingPlanProps.used); + Objects.equals(this.used, pricingPlanProps.used)&& + Objects.equals(this.additionalProperties, pricingPlanProps.additionalProperties); } @Override public int hashCode() { - return Objects.hash(pricingMenus, name, displayName, description, used); + return Objects.hash(pricingMenus, name, displayName, description, used, additionalProperties); } @Override @@ -211,6 +256,7 @@ public String toString() { sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" used: ").append(toIndentedString(used)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -261,14 +307,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PricingPlanProps.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingPlanProps` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PricingPlanProps.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -312,6 +350,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PricingPlanProps value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -319,7 +374,28 @@ public void write(JsonWriter out, PricingPlanProps value) throws IOException { public PricingPlanProps read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PricingPlanProps instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/PricingPlans.java b/src/main/java/saasus/sdk/pricing/models/PricingPlans.java index b2006241..1f76ef8d 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingPlans.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingPlans.java @@ -52,7 +52,7 @@ /** * PricingPlans */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class PricingPlans { public static final String SERIALIZED_NAME_PRICING_PLANS = "pricing_plans"; @SerializedName(SERIALIZED_NAME_PRICING_PLANS) @@ -87,6 +87,50 @@ public void setPricingPlans(List pricingPlans) { this.pricingPlans = pricingPlans; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PricingPlans instance itself + */ + public PricingPlans putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } PricingPlans pricingPlans = (PricingPlans) o; - return Objects.equals(this.pricingPlans, pricingPlans.pricingPlans); + return Objects.equals(this.pricingPlans, pricingPlans.pricingPlans)&& + Objects.equals(this.additionalProperties, pricingPlans.additionalProperties); } @Override public int hashCode() { - return Objects.hash(pricingPlans); + return Objects.hash(pricingPlans, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PricingPlans {\n"); sb.append(" pricingPlans: ").append(toIndentedString(pricingPlans)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PricingPlans.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingPlans` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PricingPlans.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PricingPlans value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, PricingPlans value) throws IOException { public PricingPlans read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PricingPlans instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/PricingTier.java b/src/main/java/saasus/sdk/pricing/models/PricingTier.java index 0bbe458f..17ed7852 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingTier.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingTier.java @@ -49,7 +49,7 @@ /** * PricingTier */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class PricingTier { public static final String SERIALIZED_NAME_UP_TO = "up_to"; @SerializedName(SERIALIZED_NAME_UP_TO) @@ -145,6 +145,50 @@ public void setInf(Boolean inf) { this.inf = inf; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PricingTier instance itself + */ + public PricingTier putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -159,12 +203,13 @@ public boolean equals(Object o) { return Objects.equals(this.upTo, pricingTier.upTo) && Objects.equals(this.unitAmount, pricingTier.unitAmount) && Objects.equals(this.flatAmount, pricingTier.flatAmount) && - Objects.equals(this.inf, pricingTier.inf); + Objects.equals(this.inf, pricingTier.inf)&& + Objects.equals(this.additionalProperties, pricingTier.additionalProperties); } @Override public int hashCode() { - return Objects.hash(upTo, unitAmount, flatAmount, inf); + return Objects.hash(upTo, unitAmount, flatAmount, inf, additionalProperties); } @Override @@ -175,6 +220,7 @@ public String toString() { sb.append(" unitAmount: ").append(toIndentedString(unitAmount)).append("\n"); sb.append(" flatAmount: ").append(toIndentedString(flatAmount)).append("\n"); sb.append(" inf: ").append(toIndentedString(inf)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -223,14 +269,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PricingTier.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingTier` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PricingTier.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -255,6 +293,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PricingTier value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -262,7 +317,28 @@ public void write(JsonWriter out, PricingTier value) throws IOException { public PricingTier read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PricingTier instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/PricingTieredUnit.java b/src/main/java/saasus/sdk/pricing/models/PricingTieredUnit.java index 51744feb..aedb9d1a 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingTieredUnit.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingTieredUnit.java @@ -56,7 +56,7 @@ /** * PricingTieredUnit */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class PricingTieredUnit { public static final String SERIALIZED_NAME_UPPER_COUNT = "upper_count"; @SerializedName(SERIALIZED_NAME_UPPER_COUNT) @@ -367,6 +367,50 @@ public void setUsed(Boolean used) { this.used = used; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PricingTieredUnit instance itself + */ + public PricingTieredUnit putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -390,12 +434,13 @@ public boolean equals(Object o) { Objects.equals(this.id, pricingTieredUnit.id) && Objects.equals(this.meteringUnitId, pricingTieredUnit.meteringUnitId) && Objects.equals(this.recurringInterval, pricingTieredUnit.recurringInterval) && - Objects.equals(this.used, pricingTieredUnit.used); + Objects.equals(this.used, pricingTieredUnit.used)&& + Objects.equals(this.additionalProperties, pricingTieredUnit.additionalProperties); } @Override public int hashCode() { - return Objects.hash(upperCount, meteringUnitName, aggregateUsage, name, displayName, description, type, currency, tiers, id, meteringUnitId, recurringInterval, used); + return Objects.hash(upperCount, meteringUnitName, aggregateUsage, name, displayName, description, type, currency, tiers, id, meteringUnitId, recurringInterval, used, additionalProperties); } @Override @@ -415,6 +460,7 @@ public String toString() { sb.append(" meteringUnitId: ").append(toIndentedString(meteringUnitId)).append("\n"); sb.append(" recurringInterval: ").append(toIndentedString(recurringInterval)).append("\n"); sb.append(" used: ").append(toIndentedString(used)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -480,14 +526,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PricingTieredUnit.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingTieredUnit` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PricingTieredUnit.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -550,6 +588,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PricingTieredUnit value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -557,7 +612,28 @@ public void write(JsonWriter out, PricingTieredUnit value) throws IOException { public PricingTieredUnit read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PricingTieredUnit instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/PricingTieredUnitForSave.java b/src/main/java/saasus/sdk/pricing/models/PricingTieredUnitForSave.java index b1c5998d..10e1a9b5 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingTieredUnitForSave.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingTieredUnitForSave.java @@ -55,7 +55,7 @@ /** * PricingTieredUnitForSave */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class PricingTieredUnitForSave { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -274,6 +274,50 @@ public void setAggregateUsage(AggregateUsage aggregateUsage) { this.aggregateUsage = aggregateUsage; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PricingTieredUnitForSave instance itself + */ + public PricingTieredUnitForSave putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -293,12 +337,13 @@ public boolean equals(Object o) { Objects.equals(this.tiers, pricingTieredUnitForSave.tiers) && Objects.equals(this.upperCount, pricingTieredUnitForSave.upperCount) && Objects.equals(this.meteringUnitName, pricingTieredUnitForSave.meteringUnitName) && - Objects.equals(this.aggregateUsage, pricingTieredUnitForSave.aggregateUsage); + Objects.equals(this.aggregateUsage, pricingTieredUnitForSave.aggregateUsage)&& + Objects.equals(this.additionalProperties, pricingTieredUnitForSave.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, displayName, description, type, currency, tiers, upperCount, meteringUnitName, aggregateUsage); + return Objects.hash(name, displayName, description, type, currency, tiers, upperCount, meteringUnitName, aggregateUsage, additionalProperties); } @Override @@ -314,6 +359,7 @@ public String toString() { sb.append(" upperCount: ").append(toIndentedString(upperCount)).append("\n"); sb.append(" meteringUnitName: ").append(toIndentedString(meteringUnitName)).append("\n"); sb.append(" aggregateUsage: ").append(toIndentedString(aggregateUsage)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -371,14 +417,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PricingTieredUnitForSave.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingTieredUnitForSave` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PricingTieredUnitForSave.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -433,6 +471,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PricingTieredUnitForSave value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -440,7 +495,28 @@ public void write(JsonWriter out, PricingTieredUnitForSave value) throws IOExcep public PricingTieredUnitForSave read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PricingTieredUnitForSave instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/PricingTieredUsageUnit.java b/src/main/java/saasus/sdk/pricing/models/PricingTieredUsageUnit.java index b0c3addd..5370ed6b 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingTieredUsageUnit.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingTieredUsageUnit.java @@ -56,7 +56,7 @@ /** * PricingTieredUsageUnit */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class PricingTieredUsageUnit { public static final String SERIALIZED_NAME_UPPER_COUNT = "upper_count"; @SerializedName(SERIALIZED_NAME_UPPER_COUNT) @@ -367,6 +367,50 @@ public void setUsed(Boolean used) { this.used = used; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PricingTieredUsageUnit instance itself + */ + public PricingTieredUsageUnit putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -390,12 +434,13 @@ public boolean equals(Object o) { Objects.equals(this.id, pricingTieredUsageUnit.id) && Objects.equals(this.meteringUnitId, pricingTieredUsageUnit.meteringUnitId) && Objects.equals(this.recurringInterval, pricingTieredUsageUnit.recurringInterval) && - Objects.equals(this.used, pricingTieredUsageUnit.used); + Objects.equals(this.used, pricingTieredUsageUnit.used)&& + Objects.equals(this.additionalProperties, pricingTieredUsageUnit.additionalProperties); } @Override public int hashCode() { - return Objects.hash(upperCount, meteringUnitName, aggregateUsage, name, displayName, description, type, currency, tiers, id, meteringUnitId, recurringInterval, used); + return Objects.hash(upperCount, meteringUnitName, aggregateUsage, name, displayName, description, type, currency, tiers, id, meteringUnitId, recurringInterval, used, additionalProperties); } @Override @@ -415,6 +460,7 @@ public String toString() { sb.append(" meteringUnitId: ").append(toIndentedString(meteringUnitId)).append("\n"); sb.append(" recurringInterval: ").append(toIndentedString(recurringInterval)).append("\n"); sb.append(" used: ").append(toIndentedString(used)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -480,14 +526,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PricingTieredUsageUnit.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingTieredUsageUnit` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PricingTieredUsageUnit.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -550,6 +588,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PricingTieredUsageUnit value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -557,7 +612,28 @@ public void write(JsonWriter out, PricingTieredUsageUnit value) throws IOExcepti public PricingTieredUsageUnit read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PricingTieredUsageUnit instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/PricingTieredUsageUnitForSave.java b/src/main/java/saasus/sdk/pricing/models/PricingTieredUsageUnitForSave.java index c3b0e76d..44a1970d 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingTieredUsageUnitForSave.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingTieredUsageUnitForSave.java @@ -55,7 +55,7 @@ /** * PricingTieredUsageUnitForSave */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class PricingTieredUsageUnitForSave { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -274,6 +274,50 @@ public void setAggregateUsage(AggregateUsage aggregateUsage) { this.aggregateUsage = aggregateUsage; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PricingTieredUsageUnitForSave instance itself + */ + public PricingTieredUsageUnitForSave putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -293,12 +337,13 @@ public boolean equals(Object o) { Objects.equals(this.tiers, pricingTieredUsageUnitForSave.tiers) && Objects.equals(this.upperCount, pricingTieredUsageUnitForSave.upperCount) && Objects.equals(this.meteringUnitName, pricingTieredUsageUnitForSave.meteringUnitName) && - Objects.equals(this.aggregateUsage, pricingTieredUsageUnitForSave.aggregateUsage); + Objects.equals(this.aggregateUsage, pricingTieredUsageUnitForSave.aggregateUsage)&& + Objects.equals(this.additionalProperties, pricingTieredUsageUnitForSave.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, displayName, description, type, currency, tiers, upperCount, meteringUnitName, aggregateUsage); + return Objects.hash(name, displayName, description, type, currency, tiers, upperCount, meteringUnitName, aggregateUsage, additionalProperties); } @Override @@ -314,6 +359,7 @@ public String toString() { sb.append(" upperCount: ").append(toIndentedString(upperCount)).append("\n"); sb.append(" meteringUnitName: ").append(toIndentedString(meteringUnitName)).append("\n"); sb.append(" aggregateUsage: ").append(toIndentedString(aggregateUsage)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -371,14 +417,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PricingTieredUsageUnitForSave.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingTieredUsageUnitForSave` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PricingTieredUsageUnitForSave.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -433,6 +471,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PricingTieredUsageUnitForSave value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -440,7 +495,28 @@ public void write(JsonWriter out, PricingTieredUsageUnitForSave value) throws IO public PricingTieredUsageUnitForSave read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PricingTieredUsageUnitForSave instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/PricingTiers.java b/src/main/java/saasus/sdk/pricing/models/PricingTiers.java index bb36a52a..6228a1eb 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingTiers.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingTiers.java @@ -52,7 +52,7 @@ /** * PricingTiers */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class PricingTiers { public static final String SERIALIZED_NAME_TIERS = "tiers"; @SerializedName(SERIALIZED_NAME_TIERS) @@ -87,6 +87,50 @@ public void setTiers(List tiers) { this.tiers = tiers; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PricingTiers instance itself + */ + public PricingTiers putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } PricingTiers pricingTiers = (PricingTiers) o; - return Objects.equals(this.tiers, pricingTiers.tiers); + return Objects.equals(this.tiers, pricingTiers.tiers)&& + Objects.equals(this.additionalProperties, pricingTiers.additionalProperties); } @Override public int hashCode() { - return Objects.hash(tiers); + return Objects.hash(tiers, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PricingTiers {\n"); sb.append(" tiers: ").append(toIndentedString(tiers)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PricingTiers.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingTiers` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PricingTiers.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PricingTiers value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, PricingTiers value) throws IOException { public PricingTiers read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PricingTiers instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/PricingUnit.java b/src/main/java/saasus/sdk/pricing/models/PricingUnit.java index 5b8ccfd2..72015da5 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingUnit.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingUnit.java @@ -9,8 +9,6 @@ * https://openapi-generator.tech * Do not edit the class manually. */ - - package saasus.sdk.pricing.models; import java.util.Objects; @@ -33,8 +31,6 @@ import saasus.sdk.pricing.models.RecurringInterval; import saasus.sdk.pricing.models.UnitType; - - import java.io.IOException; import java.lang.reflect.Type; import java.util.logging.Level; @@ -68,7 +64,7 @@ import saasus.sdk.pricing.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-14T05:49:40.753989212Z[Etc/UTC]") public class PricingUnit extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(PricingUnit.class.getName()); @@ -150,87 +146,12 @@ public PricingUnit read(JsonReader in) throws IOException { deserialized = adapterPricingUsageUnit.fromJsonTree(jsonObject); newPricingUnit.setActualInstance(deserialized); return newPricingUnit; - case "PricingFixedUnit": - deserialized = adapterPricingFixedUnit.fromJsonTree(jsonObject); - newPricingUnit.setActualInstance(deserialized); - return newPricingUnit; - case "PricingTieredUnit": - deserialized = adapterPricingTieredUnit.fromJsonTree(jsonObject); - newPricingUnit.setActualInstance(deserialized); - return newPricingUnit; - case "PricingTieredUsageUnit": - deserialized = adapterPricingTieredUsageUnit.fromJsonTree(jsonObject); - newPricingUnit.setActualInstance(deserialized); - return newPricingUnit; - case "PricingUsageUnit": - deserialized = adapterPricingUsageUnit.fromJsonTree(jsonObject); - newPricingUnit.setActualInstance(deserialized); - return newPricingUnit; default: - log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for PricingUnit. Possible values: fixed tiered tiered_usage usage PricingFixedUnit PricingTieredUnit PricingTieredUsageUnit PricingUsageUnit", jsonObject.get("type").getAsString())); + log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for PricingUnit. Possible values: fixed tiered tiered_usage usage", jsonObject.get("type").getAsString())); } } - int match = 0; - ArrayList errorMessages = new ArrayList<>(); - TypeAdapter actualAdapter = elementAdapter; - - // deserialize PricingTieredUsageUnit - try { - // validate the JSON object to see if any exception is thrown - PricingTieredUsageUnit.validateJsonElement(jsonElement); - actualAdapter = adapterPricingTieredUsageUnit; - match++; - log.log(Level.FINER, "Input data matches schema 'PricingTieredUsageUnit'"); - } catch (Exception e) { - // deserialization failed, continue - errorMessages.add(String.format("Deserialization for PricingTieredUsageUnit failed with `%s`.", e.getMessage())); - log.log(Level.FINER, "Input data does not match schema 'PricingTieredUsageUnit'", e); - } - // deserialize PricingTieredUnit - try { - // validate the JSON object to see if any exception is thrown - PricingTieredUnit.validateJsonElement(jsonElement); - actualAdapter = adapterPricingTieredUnit; - match++; - log.log(Level.FINER, "Input data matches schema 'PricingTieredUnit'"); - } catch (Exception e) { - // deserialization failed, continue - errorMessages.add(String.format("Deserialization for PricingTieredUnit failed with `%s`.", e.getMessage())); - log.log(Level.FINER, "Input data does not match schema 'PricingTieredUnit'", e); - } - // deserialize PricingUsageUnit - try { - // validate the JSON object to see if any exception is thrown - PricingUsageUnit.validateJsonElement(jsonElement); - actualAdapter = adapterPricingUsageUnit; - match++; - log.log(Level.FINER, "Input data matches schema 'PricingUsageUnit'"); - } catch (Exception e) { - // deserialization failed, continue - errorMessages.add(String.format("Deserialization for PricingUsageUnit failed with `%s`.", e.getMessage())); - log.log(Level.FINER, "Input data does not match schema 'PricingUsageUnit'", e); - } - // deserialize PricingFixedUnit - try { - // validate the JSON object to see if any exception is thrown - PricingFixedUnit.validateJsonElement(jsonElement); - actualAdapter = adapterPricingFixedUnit; - match++; - log.log(Level.FINER, "Input data matches schema 'PricingFixedUnit'"); - } catch (Exception e) { - // deserialization failed, continue - errorMessages.add(String.format("Deserialization for PricingFixedUnit failed with `%s`.", e.getMessage())); - log.log(Level.FINER, "Input data does not match schema 'PricingFixedUnit'", e); - } - - if (match == 1) { - PricingUnit ret = new PricingUnit(); - ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); - return ret; - } - - throw new IOException(String.format("Failed deserialization for PricingUnit: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + throw new IOException(String.format("JSON: %s", jsonElement.toString())); } }.nullSafe(); } @@ -366,43 +287,28 @@ public PricingFixedUnit getPricingFixedUnit() throws ClassCastException { * @throws IOException if the JSON Element is invalid with respect to PricingUnit */ 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 PricingTieredUsageUnit - try { - PricingTieredUsageUnit.validateJsonElement(jsonElement); - validCount++; - } catch (Exception e) { - errorMessages.add(String.format("Deserialization for PricingTieredUsageUnit failed with `%s`.", e.getMessage())); - // continue to the next one - } - // validate the json string with PricingTieredUnit - try { - PricingTieredUnit.validateJsonElement(jsonElement); - validCount++; - } catch (Exception e) { - errorMessages.add(String.format("Deserialization for PricingTieredUnit failed with `%s`.", e.getMessage())); - // continue to the next one - } - // validate the json string with PricingUsageUnit - try { - PricingUsageUnit.validateJsonElement(jsonElement); - validCount++; - } catch (Exception e) { - errorMessages.add(String.format("Deserialization for PricingUsageUnit failed with `%s`.", e.getMessage())); - // continue to the next one - } - // validate the json string with PricingFixedUnit - try { - PricingFixedUnit.validateJsonElement(jsonElement); - validCount++; - } catch (Exception e) { - errorMessages.add(String.format("Deserialization for PricingFixedUnit failed with `%s`.", e.getMessage())); - // continue to the next one + JsonObject jsonObject = jsonElement.getAsJsonObject(); + + if (jsonObject.get("type") == null) { + throw new IOException("Discriminator field `type` is missing"); } - if (validCount != 1) { - throw new IOException(String.format("The JSON string is invalid for PricingUnit with oneOf schemas: PricingFixedUnit, PricingTieredUnit, PricingTieredUsageUnit, PricingUsageUnit. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + + String discriminatorValue = jsonObject.get("type").getAsString(); + switch (discriminatorValue) { + case "fixed": + PricingFixedUnit.validateJsonElement(jsonElement); + break; + case "tiered": + PricingTieredUnit.validateJsonElement(jsonElement); + break; + case "tiered_usage": + PricingTieredUsageUnit.validateJsonElement(jsonElement); + break; + case "usage": + PricingUsageUnit.validateJsonElement(jsonElement); + break; + default: + throw new IOException("Unknown discriminator value: " + discriminatorValue); } } diff --git a/src/main/java/saasus/sdk/pricing/models/PricingUnitBaseProps.java b/src/main/java/saasus/sdk/pricing/models/PricingUnitBaseProps.java index 27078265..3443fb4c 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingUnitBaseProps.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingUnitBaseProps.java @@ -51,7 +51,7 @@ /** * PricingUnitBaseProps */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class PricingUnitBaseProps { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -170,6 +170,50 @@ public void setCurrency(Currency currency) { this.currency = currency; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PricingUnitBaseProps instance itself + */ + public PricingUnitBaseProps putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -185,12 +229,13 @@ public boolean equals(Object o) { Objects.equals(this.displayName, pricingUnitBaseProps.displayName) && Objects.equals(this.description, pricingUnitBaseProps.description) && Objects.equals(this.type, pricingUnitBaseProps.type) && - Objects.equals(this.currency, pricingUnitBaseProps.currency); + Objects.equals(this.currency, pricingUnitBaseProps.currency)&& + Objects.equals(this.additionalProperties, pricingUnitBaseProps.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, displayName, description, type, currency); + return Objects.hash(name, displayName, description, type, currency, additionalProperties); } @Override @@ -202,6 +247,7 @@ public String toString() { sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -252,14 +298,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PricingUnitBaseProps.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingUnitBaseProps` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PricingUnitBaseProps.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -297,6 +335,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PricingUnitBaseProps value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -304,7 +359,28 @@ public void write(JsonWriter out, PricingUnitBaseProps value) throws IOException public PricingUnitBaseProps read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PricingUnitBaseProps instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/PricingUnitForSave.java b/src/main/java/saasus/sdk/pricing/models/PricingUnitForSave.java index 215fccdd..6837f4b5 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingUnitForSave.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingUnitForSave.java @@ -12,7 +12,7 @@ package saasus.sdk.pricing.models; - + import java.util.Objects; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; @@ -68,7 +68,7 @@ import saasus.sdk.pricing.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-14T05:49:40.753989212Z[Etc/UTC]") public class PricingUnitForSave extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(PricingUnitForSave.class.getName()); @@ -150,87 +150,12 @@ public PricingUnitForSave read(JsonReader in) throws IOException { deserialized = adapterPricingUsageUnitForSave.fromJsonTree(jsonObject); newPricingUnitForSave.setActualInstance(deserialized); return newPricingUnitForSave; - case "PricingFixedUnitForSave": - deserialized = adapterPricingFixedUnitForSave.fromJsonTree(jsonObject); - newPricingUnitForSave.setActualInstance(deserialized); - return newPricingUnitForSave; - case "PricingTieredUnitForSave": - deserialized = adapterPricingTieredUnitForSave.fromJsonTree(jsonObject); - newPricingUnitForSave.setActualInstance(deserialized); - return newPricingUnitForSave; - case "PricingTieredUsageUnitForSave": - deserialized = adapterPricingTieredUsageUnitForSave.fromJsonTree(jsonObject); - newPricingUnitForSave.setActualInstance(deserialized); - return newPricingUnitForSave; - case "PricingUsageUnitForSave": - deserialized = adapterPricingUsageUnitForSave.fromJsonTree(jsonObject); - newPricingUnitForSave.setActualInstance(deserialized); - return newPricingUnitForSave; default: - log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for PricingUnitForSave. Possible values: fixed tiered tiered_usage usage PricingFixedUnitForSave PricingTieredUnitForSave PricingTieredUsageUnitForSave PricingUsageUnitForSave", jsonObject.get("type").getAsString())); + log.log(Level.WARNING, String.format("Failed to lookup discriminator value `%s` for PricingUnitForSave. Possible values: fixed tiered tiered_usage usage", jsonObject.get("type").getAsString())); } } - int match = 0; - ArrayList errorMessages = new ArrayList<>(); - TypeAdapter actualAdapter = elementAdapter; - - // deserialize PricingTieredUsageUnitForSave - try { - // validate the JSON object to see if any exception is thrown - PricingTieredUsageUnitForSave.validateJsonElement(jsonElement); - actualAdapter = adapterPricingTieredUsageUnitForSave; - match++; - log.log(Level.FINER, "Input data matches schema 'PricingTieredUsageUnitForSave'"); - } catch (Exception e) { - // deserialization failed, continue - errorMessages.add(String.format("Deserialization for PricingTieredUsageUnitForSave failed with `%s`.", e.getMessage())); - log.log(Level.FINER, "Input data does not match schema 'PricingTieredUsageUnitForSave'", e); - } - // deserialize PricingTieredUnitForSave - try { - // validate the JSON object to see if any exception is thrown - PricingTieredUnitForSave.validateJsonElement(jsonElement); - actualAdapter = adapterPricingTieredUnitForSave; - match++; - log.log(Level.FINER, "Input data matches schema 'PricingTieredUnitForSave'"); - } catch (Exception e) { - // deserialization failed, continue - errorMessages.add(String.format("Deserialization for PricingTieredUnitForSave failed with `%s`.", e.getMessage())); - log.log(Level.FINER, "Input data does not match schema 'PricingTieredUnitForSave'", e); - } - // deserialize PricingUsageUnitForSave - try { - // validate the JSON object to see if any exception is thrown - PricingUsageUnitForSave.validateJsonElement(jsonElement); - actualAdapter = adapterPricingUsageUnitForSave; - match++; - log.log(Level.FINER, "Input data matches schema 'PricingUsageUnitForSave'"); - } catch (Exception e) { - // deserialization failed, continue - errorMessages.add(String.format("Deserialization for PricingUsageUnitForSave failed with `%s`.", e.getMessage())); - log.log(Level.FINER, "Input data does not match schema 'PricingUsageUnitForSave'", e); - } - // deserialize PricingFixedUnitForSave - try { - // validate the JSON object to see if any exception is thrown - PricingFixedUnitForSave.validateJsonElement(jsonElement); - actualAdapter = adapterPricingFixedUnitForSave; - match++; - log.log(Level.FINER, "Input data matches schema 'PricingFixedUnitForSave'"); - } catch (Exception e) { - // deserialization failed, continue - errorMessages.add(String.format("Deserialization for PricingFixedUnitForSave failed with `%s`.", e.getMessage())); - log.log(Level.FINER, "Input data does not match schema 'PricingFixedUnitForSave'", e); - } - - if (match == 1) { - PricingUnitForSave ret = new PricingUnitForSave(); - ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); - return ret; - } - - throw new IOException(String.format("Failed deserialization for PricingUnitForSave: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + throw new IOException(String.format("JSON: %s", jsonElement.toString())); } }.nullSafe(); } @@ -366,43 +291,28 @@ public PricingFixedUnitForSave getPricingFixedUnitForSave() throws ClassCastExce * @throws IOException if the JSON Element is invalid with respect to PricingUnitForSave */ 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 PricingTieredUsageUnitForSave - try { - PricingTieredUsageUnitForSave.validateJsonElement(jsonElement); - validCount++; - } catch (Exception e) { - errorMessages.add(String.format("Deserialization for PricingTieredUsageUnitForSave failed with `%s`.", e.getMessage())); - // continue to the next one - } - // validate the json string with PricingTieredUnitForSave - try { - PricingTieredUnitForSave.validateJsonElement(jsonElement); - validCount++; - } catch (Exception e) { - errorMessages.add(String.format("Deserialization for PricingTieredUnitForSave failed with `%s`.", e.getMessage())); - // continue to the next one - } - // validate the json string with PricingUsageUnitForSave - try { - PricingUsageUnitForSave.validateJsonElement(jsonElement); - validCount++; - } catch (Exception e) { - errorMessages.add(String.format("Deserialization for PricingUsageUnitForSave failed with `%s`.", e.getMessage())); - // continue to the next one - } - // validate the json string with PricingFixedUnitForSave - try { - PricingFixedUnitForSave.validateJsonElement(jsonElement); - validCount++; - } catch (Exception e) { - errorMessages.add(String.format("Deserialization for PricingFixedUnitForSave failed with `%s`.", e.getMessage())); - // continue to the next one + JsonObject jsonObject = jsonElement.getAsJsonObject(); + + if (jsonObject.get("type") == null) { + throw new IOException("Discriminator field `type` is missing"); } - if (validCount != 1) { - throw new IOException(String.format("The JSON string is invalid for PricingUnitForSave with oneOf schemas: PricingFixedUnitForSave, PricingTieredUnitForSave, PricingTieredUsageUnitForSave, PricingUsageUnitForSave. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + + String discriminatorValue = jsonObject.get("type").getAsString(); + switch (discriminatorValue) { + case "fixed": + PricingFixedUnitForSave.validateJsonElement(jsonElement); + break; + case "tiered": + PricingTieredUnitForSave.validateJsonElement(jsonElement); + break; + case "tiered_usage": + PricingTieredUsageUnitForSave.validateJsonElement(jsonElement); + break; + case "usage": + PricingUsageUnitForSave.validateJsonElement(jsonElement); + break; + default: + throw new IOException("Unknown discriminator value: " + discriminatorValue); } } diff --git a/src/main/java/saasus/sdk/pricing/models/PricingUnits.java b/src/main/java/saasus/sdk/pricing/models/PricingUnits.java index a54c55e5..ededd752 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingUnits.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingUnits.java @@ -52,7 +52,7 @@ /** * PricingUnits */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class PricingUnits { public static final String SERIALIZED_NAME_UNITS = "units"; @SerializedName(SERIALIZED_NAME_UNITS) @@ -87,6 +87,50 @@ public void setUnits(List units) { this.units = units; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PricingUnits instance itself + */ + public PricingUnits putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } PricingUnits pricingUnits = (PricingUnits) o; - return Objects.equals(this.units, pricingUnits.units); + return Objects.equals(this.units, pricingUnits.units)&& + Objects.equals(this.additionalProperties, pricingUnits.additionalProperties); } @Override public int hashCode() { - return Objects.hash(units); + return Objects.hash(units, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PricingUnits {\n"); sb.append(" units: ").append(toIndentedString(units)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PricingUnits.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingUnits` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PricingUnits.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PricingUnits value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, PricingUnits value) throws IOException { public PricingUnits read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PricingUnits instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/PricingUsageUnit.java b/src/main/java/saasus/sdk/pricing/models/PricingUsageUnit.java index 7bf151c2..162cf8e4 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingUsageUnit.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingUsageUnit.java @@ -53,7 +53,7 @@ /** * PricingUsageUnit */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class PricingUsageUnit { public static final String SERIALIZED_NAME_UPPER_COUNT = "upper_count"; @SerializedName(SERIALIZED_NAME_UPPER_COUNT) @@ -356,6 +356,50 @@ public void setUsed(Boolean used) { this.used = used; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PricingUsageUnit instance itself + */ + public PricingUsageUnit putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -379,12 +423,13 @@ public boolean equals(Object o) { Objects.equals(this.id, pricingUsageUnit.id) && Objects.equals(this.meteringUnitId, pricingUsageUnit.meteringUnitId) && Objects.equals(this.recurringInterval, pricingUsageUnit.recurringInterval) && - Objects.equals(this.used, pricingUsageUnit.used); + Objects.equals(this.used, pricingUsageUnit.used)&& + Objects.equals(this.additionalProperties, pricingUsageUnit.additionalProperties); } @Override public int hashCode() { - return Objects.hash(upperCount, unitAmount, meteringUnitName, aggregateUsage, name, displayName, description, type, currency, id, meteringUnitId, recurringInterval, used); + return Objects.hash(upperCount, unitAmount, meteringUnitName, aggregateUsage, name, displayName, description, type, currency, id, meteringUnitId, recurringInterval, used, additionalProperties); } @Override @@ -404,6 +449,7 @@ public String toString() { sb.append(" meteringUnitId: ").append(toIndentedString(meteringUnitId)).append("\n"); sb.append(" recurringInterval: ").append(toIndentedString(recurringInterval)).append("\n"); sb.append(" used: ").append(toIndentedString(used)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -469,14 +515,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PricingUsageUnit.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingUsageUnit` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PricingUsageUnit.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -529,6 +567,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PricingUsageUnit value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -536,7 +591,28 @@ public void write(JsonWriter out, PricingUsageUnit value) throws IOException { public PricingUsageUnit read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PricingUsageUnit instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/PricingUsageUnitForSave.java b/src/main/java/saasus/sdk/pricing/models/PricingUsageUnitForSave.java index 3ed9fc46..13b73ae0 100644 --- a/src/main/java/saasus/sdk/pricing/models/PricingUsageUnitForSave.java +++ b/src/main/java/saasus/sdk/pricing/models/PricingUsageUnitForSave.java @@ -52,7 +52,7 @@ /** * PricingUsageUnitForSave */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class PricingUsageUnitForSave { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -263,6 +263,50 @@ public void setAggregateUsage(AggregateUsage aggregateUsage) { this.aggregateUsage = aggregateUsage; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PricingUsageUnitForSave instance itself + */ + public PricingUsageUnitForSave putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -282,12 +326,13 @@ public boolean equals(Object o) { Objects.equals(this.upperCount, pricingUsageUnitForSave.upperCount) && Objects.equals(this.unitAmount, pricingUsageUnitForSave.unitAmount) && Objects.equals(this.meteringUnitName, pricingUsageUnitForSave.meteringUnitName) && - Objects.equals(this.aggregateUsage, pricingUsageUnitForSave.aggregateUsage); + Objects.equals(this.aggregateUsage, pricingUsageUnitForSave.aggregateUsage)&& + Objects.equals(this.additionalProperties, pricingUsageUnitForSave.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, displayName, description, type, currency, upperCount, unitAmount, meteringUnitName, aggregateUsage); + return Objects.hash(name, displayName, description, type, currency, upperCount, unitAmount, meteringUnitName, aggregateUsage, additionalProperties); } @Override @@ -303,6 +348,7 @@ public String toString() { sb.append(" unitAmount: ").append(toIndentedString(unitAmount)).append("\n"); sb.append(" meteringUnitName: ").append(toIndentedString(meteringUnitName)).append("\n"); sb.append(" aggregateUsage: ").append(toIndentedString(aggregateUsage)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -360,14 +406,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PricingUsageUnitForSave.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingUsageUnitForSave` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PricingUsageUnitForSave.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -412,6 +450,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, PricingUsageUnitForSave value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -419,7 +474,28 @@ public void write(JsonWriter out, PricingUsageUnitForSave value) throws IOExcept public PricingUsageUnitForSave read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PricingUsageUnitForSave instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/SavePricingMenuParam.java b/src/main/java/saasus/sdk/pricing/models/SavePricingMenuParam.java index 1da482d1..cfc3b126 100644 --- a/src/main/java/saasus/sdk/pricing/models/SavePricingMenuParam.java +++ b/src/main/java/saasus/sdk/pricing/models/SavePricingMenuParam.java @@ -51,7 +51,7 @@ /** * SavePricingMenuParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class SavePricingMenuParam { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -155,6 +155,50 @@ public void setUnitIds(List unitIds) { this.unitIds = unitIds; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SavePricingMenuParam instance itself + */ + public SavePricingMenuParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -169,12 +213,13 @@ public boolean equals(Object o) { return Objects.equals(this.name, savePricingMenuParam.name) && Objects.equals(this.displayName, savePricingMenuParam.displayName) && Objects.equals(this.description, savePricingMenuParam.description) && - Objects.equals(this.unitIds, savePricingMenuParam.unitIds); + Objects.equals(this.unitIds, savePricingMenuParam.unitIds)&& + Objects.equals(this.additionalProperties, savePricingMenuParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, displayName, description, unitIds); + return Objects.hash(name, displayName, description, unitIds, additionalProperties); } @Override @@ -185,6 +230,7 @@ public String toString() { sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" unitIds: ").append(toIndentedString(unitIds)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -233,14 +279,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SavePricingMenuParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SavePricingMenuParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : SavePricingMenuParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -280,6 +318,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, SavePricingMenuParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -287,7 +342,28 @@ public void write(JsonWriter out, SavePricingMenuParam value) throws IOException public SavePricingMenuParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SavePricingMenuParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/SavePricingPlanParam.java b/src/main/java/saasus/sdk/pricing/models/SavePricingPlanParam.java index c6b4745a..3fd51dee 100644 --- a/src/main/java/saasus/sdk/pricing/models/SavePricingPlanParam.java +++ b/src/main/java/saasus/sdk/pricing/models/SavePricingPlanParam.java @@ -51,7 +51,7 @@ /** * SavePricingPlanParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class SavePricingPlanParam { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -155,6 +155,50 @@ public void setMenuIds(List menuIds) { this.menuIds = menuIds; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SavePricingPlanParam instance itself + */ + public SavePricingPlanParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -169,12 +213,13 @@ public boolean equals(Object o) { return Objects.equals(this.name, savePricingPlanParam.name) && Objects.equals(this.displayName, savePricingPlanParam.displayName) && Objects.equals(this.description, savePricingPlanParam.description) && - Objects.equals(this.menuIds, savePricingPlanParam.menuIds); + Objects.equals(this.menuIds, savePricingPlanParam.menuIds)&& + Objects.equals(this.additionalProperties, savePricingPlanParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, displayName, description, menuIds); + return Objects.hash(name, displayName, description, menuIds, additionalProperties); } @Override @@ -185,6 +230,7 @@ public String toString() { sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" menuIds: ").append(toIndentedString(menuIds)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -233,14 +279,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SavePricingPlanParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SavePricingPlanParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : SavePricingPlanParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -280,6 +318,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, SavePricingPlanParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -287,7 +342,28 @@ public void write(JsonWriter out, SavePricingPlanParam value) throws IOException public SavePricingPlanParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SavePricingPlanParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/TaxRate.java b/src/main/java/saasus/sdk/pricing/models/TaxRate.java index 6b3d7b3b..2725f6a8 100644 --- a/src/main/java/saasus/sdk/pricing/models/TaxRate.java +++ b/src/main/java/saasus/sdk/pricing/models/TaxRate.java @@ -50,7 +50,7 @@ /** * TaxRate */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class TaxRate { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -215,6 +215,50 @@ public void setId(String id) { this.id = id; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TaxRate instance itself + */ + public TaxRate putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -232,12 +276,13 @@ public boolean equals(Object o) { Objects.equals(this.inclusive, taxRate.inclusive) && Objects.equals(this.country, taxRate.country) && Objects.equals(this.description, taxRate.description) && - Objects.equals(this.id, taxRate.id); + Objects.equals(this.id, taxRate.id)&& + Objects.equals(this.additionalProperties, taxRate.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, displayName, percentage, inclusive, country, description, id); + return Objects.hash(name, displayName, percentage, inclusive, country, description, id, additionalProperties); } @Override @@ -251,6 +296,7 @@ public String toString() { sb.append(" country: ").append(toIndentedString(country)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -305,14 +351,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!TaxRate.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TaxRate` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : TaxRate.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -352,6 +390,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, TaxRate value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -359,7 +414,28 @@ public void write(JsonWriter out, TaxRate value) throws IOException { public TaxRate read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TaxRate instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/TaxRateProps.java b/src/main/java/saasus/sdk/pricing/models/TaxRateProps.java index 19f0cc59..66053073 100644 --- a/src/main/java/saasus/sdk/pricing/models/TaxRateProps.java +++ b/src/main/java/saasus/sdk/pricing/models/TaxRateProps.java @@ -50,7 +50,7 @@ /** * TaxRateProps */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class TaxRateProps { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -192,6 +192,50 @@ public void setDescription(String description) { this.description = description; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TaxRateProps instance itself + */ + public TaxRateProps putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -208,12 +252,13 @@ public boolean equals(Object o) { Objects.equals(this.percentage, taxRateProps.percentage) && Objects.equals(this.inclusive, taxRateProps.inclusive) && Objects.equals(this.country, taxRateProps.country) && - Objects.equals(this.description, taxRateProps.description); + Objects.equals(this.description, taxRateProps.description)&& + Objects.equals(this.additionalProperties, taxRateProps.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, displayName, percentage, inclusive, country, description); + return Objects.hash(name, displayName, percentage, inclusive, country, description, additionalProperties); } @Override @@ -226,6 +271,7 @@ public String toString() { sb.append(" inclusive: ").append(toIndentedString(inclusive)).append("\n"); sb.append(" country: ").append(toIndentedString(country)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -278,14 +324,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!TaxRateProps.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TaxRateProps` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : TaxRateProps.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -322,6 +360,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, TaxRateProps value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -329,7 +384,28 @@ public void write(JsonWriter out, TaxRateProps value) throws IOException { public TaxRateProps read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TaxRateProps instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/TaxRates.java b/src/main/java/saasus/sdk/pricing/models/TaxRates.java index eaf29262..aa91dae9 100644 --- a/src/main/java/saasus/sdk/pricing/models/TaxRates.java +++ b/src/main/java/saasus/sdk/pricing/models/TaxRates.java @@ -52,7 +52,7 @@ /** * TaxRates */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class TaxRates { public static final String SERIALIZED_NAME_TAX_RATES = "tax_rates"; @SerializedName(SERIALIZED_NAME_TAX_RATES) @@ -87,6 +87,50 @@ public void setTaxRates(List taxRates) { this.taxRates = taxRates; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TaxRates instance itself + */ + public TaxRates putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -98,12 +142,13 @@ public boolean equals(Object o) { return false; } TaxRates taxRates = (TaxRates) o; - return Objects.equals(this.taxRates, taxRates.taxRates); + return Objects.equals(this.taxRates, taxRates.taxRates)&& + Objects.equals(this.additionalProperties, taxRates.additionalProperties); } @Override public int hashCode() { - return Objects.hash(taxRates); + return Objects.hash(taxRates, additionalProperties); } @Override @@ -111,6 +156,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TaxRates {\n"); sb.append(" taxRates: ").append(toIndentedString(taxRates)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!TaxRates.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TaxRates` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : TaxRates.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -195,6 +233,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, TaxRates value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -202,7 +257,28 @@ public void write(JsonWriter out, TaxRates value) throws IOException { public TaxRates read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TaxRates instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/UpdateMeteringUnitTimestampCountNowParam.java b/src/main/java/saasus/sdk/pricing/models/UpdateMeteringUnitTimestampCountNowParam.java index 495e74a1..7c800c91 100644 --- a/src/main/java/saasus/sdk/pricing/models/UpdateMeteringUnitTimestampCountNowParam.java +++ b/src/main/java/saasus/sdk/pricing/models/UpdateMeteringUnitTimestampCountNowParam.java @@ -50,7 +50,7 @@ /** * UpdateMeteringUnitTimestampCountNowParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class UpdateMeteringUnitTimestampCountNowParam { public static final String SERIALIZED_NAME_METHOD = "method"; @SerializedName(SERIALIZED_NAME_METHOD) @@ -100,6 +100,50 @@ public void setCount(Integer count) { this.count = count; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateMeteringUnitTimestampCountNowParam instance itself + */ + public UpdateMeteringUnitTimestampCountNowParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -112,12 +156,13 @@ public boolean equals(Object o) { } UpdateMeteringUnitTimestampCountNowParam updateMeteringUnitTimestampCountNowParam = (UpdateMeteringUnitTimestampCountNowParam) o; return Objects.equals(this.method, updateMeteringUnitTimestampCountNowParam.method) && - Objects.equals(this.count, updateMeteringUnitTimestampCountNowParam.count); + Objects.equals(this.count, updateMeteringUnitTimestampCountNowParam.count)&& + Objects.equals(this.additionalProperties, updateMeteringUnitTimestampCountNowParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(method, count); + return Objects.hash(method, count, additionalProperties); } @Override @@ -126,6 +171,7 @@ public String toString() { sb.append("class UpdateMeteringUnitTimestampCountNowParam {\n"); sb.append(" method: ").append(toIndentedString(method)).append("\n"); sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -170,14 +216,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateMeteringUnitTimestampCountNowParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateMeteringUnitTimestampCountNowParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UpdateMeteringUnitTimestampCountNowParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -204,6 +242,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateMeteringUnitTimestampCountNowParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -211,7 +266,28 @@ public void write(JsonWriter out, UpdateMeteringUnitTimestampCountNowParam value public UpdateMeteringUnitTimestampCountNowParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateMeteringUnitTimestampCountNowParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/UpdateMeteringUnitTimestampCountParam.java b/src/main/java/saasus/sdk/pricing/models/UpdateMeteringUnitTimestampCountParam.java index 448550cd..b2dca5f7 100644 --- a/src/main/java/saasus/sdk/pricing/models/UpdateMeteringUnitTimestampCountParam.java +++ b/src/main/java/saasus/sdk/pricing/models/UpdateMeteringUnitTimestampCountParam.java @@ -50,7 +50,7 @@ /** * UpdateMeteringUnitTimestampCountParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class UpdateMeteringUnitTimestampCountParam { public static final String SERIALIZED_NAME_METHOD = "method"; @SerializedName(SERIALIZED_NAME_METHOD) @@ -100,6 +100,50 @@ public void setCount(Integer count) { this.count = count; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateMeteringUnitTimestampCountParam instance itself + */ + public UpdateMeteringUnitTimestampCountParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -112,12 +156,13 @@ public boolean equals(Object o) { } UpdateMeteringUnitTimestampCountParam updateMeteringUnitTimestampCountParam = (UpdateMeteringUnitTimestampCountParam) o; return Objects.equals(this.method, updateMeteringUnitTimestampCountParam.method) && - Objects.equals(this.count, updateMeteringUnitTimestampCountParam.count); + Objects.equals(this.count, updateMeteringUnitTimestampCountParam.count)&& + Objects.equals(this.additionalProperties, updateMeteringUnitTimestampCountParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(method, count); + return Objects.hash(method, count, additionalProperties); } @Override @@ -126,6 +171,7 @@ public String toString() { sb.append("class UpdateMeteringUnitTimestampCountParam {\n"); sb.append(" method: ").append(toIndentedString(method)).append("\n"); sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -170,14 +216,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateMeteringUnitTimestampCountParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateMeteringUnitTimestampCountParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UpdateMeteringUnitTimestampCountParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -204,6 +242,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateMeteringUnitTimestampCountParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -211,7 +266,28 @@ public void write(JsonWriter out, UpdateMeteringUnitTimestampCountParam value) t public UpdateMeteringUnitTimestampCountParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateMeteringUnitTimestampCountParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/UpdatePricingPlansUsedParam.java b/src/main/java/saasus/sdk/pricing/models/UpdatePricingPlansUsedParam.java index 67497088..7ac355de 100644 --- a/src/main/java/saasus/sdk/pricing/models/UpdatePricingPlansUsedParam.java +++ b/src/main/java/saasus/sdk/pricing/models/UpdatePricingPlansUsedParam.java @@ -51,7 +51,7 @@ /** * UpdatePricingPlansUsedParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class UpdatePricingPlansUsedParam { public static final String SERIALIZED_NAME_PLAN_IDS = "plan_ids"; @SerializedName(SERIALIZED_NAME_PLAN_IDS) @@ -86,6 +86,50 @@ public void setPlanIds(List planIds) { this.planIds = planIds; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdatePricingPlansUsedParam instance itself + */ + public UpdatePricingPlansUsedParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -97,12 +141,13 @@ public boolean equals(Object o) { return false; } UpdatePricingPlansUsedParam updatePricingPlansUsedParam = (UpdatePricingPlansUsedParam) o; - return Objects.equals(this.planIds, updatePricingPlansUsedParam.planIds); + return Objects.equals(this.planIds, updatePricingPlansUsedParam.planIds)&& + Objects.equals(this.additionalProperties, updatePricingPlansUsedParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(planIds); + return Objects.hash(planIds, additionalProperties); } @Override @@ -110,6 +155,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class UpdatePricingPlansUsedParam {\n"); sb.append(" planIds: ").append(toIndentedString(planIds)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -152,14 +198,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdatePricingPlansUsedParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdatePricingPlansUsedParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UpdatePricingPlansUsedParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -190,6 +228,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdatePricingPlansUsedParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -197,7 +252,28 @@ public void write(JsonWriter out, UpdatePricingPlansUsedParam value) throws IOEx public UpdatePricingPlansUsedParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdatePricingPlansUsedParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/main/java/saasus/sdk/pricing/models/UpdateTaxRateParam.java b/src/main/java/saasus/sdk/pricing/models/UpdateTaxRateParam.java index d780e7ae..abb16547 100644 --- a/src/main/java/saasus/sdk/pricing/models/UpdateTaxRateParam.java +++ b/src/main/java/saasus/sdk/pricing/models/UpdateTaxRateParam.java @@ -49,7 +49,7 @@ /** * UpdateTaxRateParam */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-18T06:15:46.013551151Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-08-21T01:53:24.042734292Z[Etc/UTC]") public class UpdateTaxRateParam { public static final String SERIALIZED_NAME_DISPLAY_NAME = "display_name"; @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) @@ -99,6 +99,50 @@ public void setDescription(String description) { this.description = description; } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateTaxRateParam instance itself + */ + public UpdateTaxRateParam putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } @Override @@ -111,12 +155,13 @@ public boolean equals(Object o) { } UpdateTaxRateParam updateTaxRateParam = (UpdateTaxRateParam) o; return Objects.equals(this.displayName, updateTaxRateParam.displayName) && - Objects.equals(this.description, updateTaxRateParam.description); + Objects.equals(this.description, updateTaxRateParam.description)&& + Objects.equals(this.additionalProperties, updateTaxRateParam.additionalProperties); } @Override public int hashCode() { - return Objects.hash(displayName, description); + return Objects.hash(displayName, description, additionalProperties); } @Override @@ -125,6 +170,7 @@ public String toString() { sb.append("class UpdateTaxRateParam {\n"); sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,14 +215,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateTaxRateParam.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateTaxRateParam` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : UpdateTaxRateParam.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -207,6 +245,23 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, UpdateTaxRateParam value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } elementAdapter.write(out, obj); } @@ -214,7 +269,28 @@ public void write(JsonWriter out, UpdateTaxRateParam value) throws IOException { public UpdateTaxRateParam read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateTaxRateParam instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; } }.nullSafe(); diff --git a/src/test/java/saasus/sdk/auth/api/SaasUserApiTest.java b/src/test/java/saasus/sdk/auth/api/SaasUserApiTest.java index 0613e8a7..11155f93 100644 --- a/src/test/java/saasus/sdk/auth/api/SaasUserApiTest.java +++ b/src/test/java/saasus/sdk/auth/api/SaasUserApiTest.java @@ -31,6 +31,7 @@ import saasus.sdk.auth.models.SignUpWithAwsMarketplaceParam; import saasus.sdk.auth.models.SoftwareTokenSecretCode; import saasus.sdk.auth.models.Tenant; +import saasus.sdk.auth.models.UpdateSaasUserAttributesParam; import saasus.sdk.auth.models.UpdateSaasUserEmailParam; import saasus.sdk.auth.models.UpdateSaasUserPasswordParam; import saasus.sdk.auth.models.UpdateSoftwareTokenParam; @@ -277,6 +278,21 @@ public void unlinkProviderTest() throws ApiException { // TODO: test validations } + /** + * Update SaaS User Attributes + * + * Update the additional attributes of the SaaS user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void updateSaasUserAttributesTest() throws ApiException { + String userId = null; + UpdateSaasUserAttributesParam updateSaasUserAttributesParam = null; + api.updateSaasUserAttributes(userId, updateSaasUserAttributesParam); + // TODO: test validations + } + /** * Change Email * diff --git a/src/test/java/saasus/sdk/auth/api/UserAttributeApiTest.java b/src/test/java/saasus/sdk/auth/api/UserAttributeApiTest.java index 64ba7a2e..a7d87ba5 100644 --- a/src/test/java/saasus/sdk/auth/api/UserAttributeApiTest.java +++ b/src/test/java/saasus/sdk/auth/api/UserAttributeApiTest.java @@ -33,10 +33,24 @@ public class UserAttributeApiTest { private final UserAttributeApi api = new UserAttributeApi(); + /** + * Create SaaS User Attributes + * + * Create additional SaaS user attributes to be kept on the SaaSus Platform. You can give common values to all tenants. + * + * @throws ApiException if the Api call fails + */ + @Test + public void createSaasUserAttributeTest() throws ApiException { + Attribute body = null; + Attribute response = api.createSaasUserAttribute(body); + // TODO: test validations + } + /** * Create User Attributes * - * Create additional user attributes to be kept on the SaaSus Platform. For example, you can define items associated with a user, such as user name, birthday, etc. If you don't want personal information on the SaaS Platform side, personal information can be kept on the SaaS side without user attribute definition. + * Create additional user attributes to be kept on the SaaSus Platform. You can give different values to each tenant. For example, you can define items associated with a user, such as user name, birthday, etc. If you don't want personal information on the SaaS Platform side, personal information can be kept on the SaaS side without user attribute definition. * * @throws ApiException if the Api call fails */ diff --git a/src/test/java/saasus/sdk/auth/models/SaasUserTest.java b/src/test/java/saasus/sdk/auth/models/SaasUserTest.java index 318168df..eb3393a5 100644 --- a/src/test/java/saasus/sdk/auth/models/SaasUserTest.java +++ b/src/test/java/saasus/sdk/auth/models/SaasUserTest.java @@ -20,6 +20,8 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -53,4 +55,12 @@ public void emailTest() { // TODO: test email } + /** + * Test the property 'attributes' + */ + @Test + public void attributesTest() { + // TODO: test attributes + } + } diff --git a/src/test/java/saasus/sdk/auth/models/UpdateSaasUserAttributesParamTest.java b/src/test/java/saasus/sdk/auth/models/UpdateSaasUserAttributesParamTest.java new file mode 100644 index 00000000..e211c663 --- /dev/null +++ b/src/test/java/saasus/sdk/auth/models/UpdateSaasUserAttributesParamTest.java @@ -0,0 +1,50 @@ +/* + * SaaSus Auth API Schema + * Schema + * + * 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 saasus.sdk.auth.models; + +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.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for UpdateSaasUserAttributesParam + */ +public class UpdateSaasUserAttributesParamTest { + private final UpdateSaasUserAttributesParam model = new UpdateSaasUserAttributesParam(); + + /** + * Model tests for UpdateSaasUserAttributesParam + */ + @Test + public void testUpdateSaasUserAttributesParam() { + // TODO: test UpdateSaasUserAttributesParam + } + + /** + * Test the property 'attributes' + */ + @Test + public void attributesTest() { + // TODO: test attributes + } + +} diff --git a/src/test/java/saasus/sdk/auth/models/UserInfoTest.java b/src/test/java/saasus/sdk/auth/models/UserInfoTest.java index f7d12aef..564ea475 100644 --- a/src/test/java/saasus/sdk/auth/models/UserInfoTest.java +++ b/src/test/java/saasus/sdk/auth/models/UserInfoTest.java @@ -21,7 +21,9 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; +import java.util.Map; import saasus.sdk.auth.models.UserAvailableTenant; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -56,6 +58,14 @@ public void emailTest() { // TODO: test email } + /** + * Test the property 'userAttribute' + */ + @Test + public void userAttributeTest() { + // TODO: test userAttribute + } + /** * Test the property 'tenants' */