com.svix.models.EndpointUpdatedEventData Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of svix Show documentation
Show all versions of svix Show documentation
Svix webhooks API client and webhook verification library
The newest version!
/*
* Svix API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.1.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.svix.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 org.openapitools.jackson.nullable.JsonNullable;
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.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.svix.internal.JSON;
/**
* Sent when an endpoint is created, updated, or deleted
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-12T23:42:33.364995Z[Etc/UTC]", comments = "Generator version: 7.9.0")
public class EndpointUpdatedEventData {
public static final String SERIALIZED_NAME_APP_ID = "appId";
@SerializedName(SERIALIZED_NAME_APP_ID)
private String appId;
public static final String SERIALIZED_NAME_APP_UID = "appUid";
@SerializedName(SERIALIZED_NAME_APP_UID)
private String appUid;
public static final String SERIALIZED_NAME_ENDPOINT_ID = "endpointId";
@SerializedName(SERIALIZED_NAME_ENDPOINT_ID)
private String endpointId;
public static final String SERIALIZED_NAME_ENDPOINT_UID = "endpointUid";
@SerializedName(SERIALIZED_NAME_ENDPOINT_UID)
private String endpointUid;
public EndpointUpdatedEventData() {
}
public EndpointUpdatedEventData appId(String appId) {
this.appId = appId;
return this;
}
/**
* The app's ID
* @return appId
*/
@javax.annotation.Nonnull
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public EndpointUpdatedEventData appUid(String appUid) {
this.appUid = appUid;
return this;
}
/**
* The app's UID
* @return appUid
*/
@javax.annotation.Nullable
public String getAppUid() {
return appUid;
}
public void setAppUid(String appUid) {
this.appUid = appUid;
}
public EndpointUpdatedEventData endpointId(String endpointId) {
this.endpointId = endpointId;
return this;
}
/**
* The ep's ID
* @return endpointId
*/
@javax.annotation.Nonnull
public String getEndpointId() {
return endpointId;
}
public void setEndpointId(String endpointId) {
this.endpointId = endpointId;
}
public EndpointUpdatedEventData endpointUid(String endpointUid) {
this.endpointUid = endpointUid;
return this;
}
/**
* The ep's UID
* @return endpointUid
*/
@javax.annotation.Nullable
public String getEndpointUid() {
return endpointUid;
}
public void setEndpointUid(String endpointUid) {
this.endpointUid = endpointUid;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
EndpointUpdatedEventData endpointUpdatedEventData = (EndpointUpdatedEventData) o;
return Objects.equals(this.appId, endpointUpdatedEventData.appId) &&
Objects.equals(this.appUid, endpointUpdatedEventData.appUid) &&
Objects.equals(this.endpointId, endpointUpdatedEventData.endpointId) &&
Objects.equals(this.endpointUid, endpointUpdatedEventData.endpointUid);
}
private static boolean equalsNullable(JsonNullable a, JsonNullable b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}
@Override
public int hashCode() {
return Objects.hash(appId, appUid, endpointId, endpointUid);
}
private static int hashCodeNullable(JsonNullable a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class EndpointUpdatedEventData {\n");
sb.append(" appId: ").append(toIndentedString(appId)).append("\n");
sb.append(" appUid: ").append(toIndentedString(appUid)).append("\n");
sb.append(" endpointId: ").append(toIndentedString(endpointId)).append("\n");
sb.append(" endpointUid: ").append(toIndentedString(endpointUid)).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("appId");
openapiFields.add("appUid");
openapiFields.add("endpointId");
openapiFields.add("endpointUid");
// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet();
openapiRequiredFields.add("appId");
openapiRequiredFields.add("endpointId");
}
/**
* 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 EndpointUpdatedEventData
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!EndpointUpdatedEventData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in EndpointUpdatedEventData is not found in the empty JSON string", EndpointUpdatedEventData.openapiRequiredFields.toString()));
}
}
Set> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Map.Entry entry : entries) {
if (!EndpointUpdatedEventData.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EndpointUpdatedEventData` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
// check to make sure all required properties/fields are present in the JSON string
for (String requiredField : EndpointUpdatedEventData.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();
if (!jsonObj.get("appId").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `appId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("appId").toString()));
}
if ((jsonObj.get("appUid") != null && !jsonObj.get("appUid").isJsonNull()) && !jsonObj.get("appUid").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `appUid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("appUid").toString()));
}
if (!jsonObj.get("endpointId").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `endpointId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("endpointId").toString()));
}
if ((jsonObj.get("endpointUid") != null && !jsonObj.get("endpointUid").isJsonNull()) && !jsonObj.get("endpointUid").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `endpointUid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("endpointUid").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!EndpointUpdatedEventData.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'EndpointUpdatedEventData' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(EndpointUpdatedEventData.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, EndpointUpdatedEventData value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public EndpointUpdatedEventData read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of EndpointUpdatedEventData given an JSON string
*
* @param jsonString JSON string
* @return An instance of EndpointUpdatedEventData
* @throws IOException if the JSON string is invalid with respect to EndpointUpdatedEventData
*/
public static EndpointUpdatedEventData fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, EndpointUpdatedEventData.class);
}
/**
* Convert an instance of EndpointUpdatedEventData to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy