TribufuJava/src/main/java/com/tribufu/generated/models/IntrospectResponse.java

536 lines
16 KiB
Java

/*
* Tribufu API
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.4.3
* Contact: contact@tribufu.com
*
* 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.tribufu.generated.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.tribufu.generated.JSON;
/**
* IntrospectResponse
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:18:39.326231700-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class IntrospectResponse {
public static final String SERIALIZED_NAME_JTI = "jti";
@SerializedName(SERIALIZED_NAME_JTI)
@javax.annotation.Nullable
private String jti;
public static final String SERIALIZED_NAME_ACTIVE = "active";
@SerializedName(SERIALIZED_NAME_ACTIVE)
@javax.annotation.Nullable
private Boolean active;
public static final String SERIALIZED_NAME_TOKEN_TYPE = "token_type";
@SerializedName(SERIALIZED_NAME_TOKEN_TYPE)
@javax.annotation.Nullable
private String tokenType;
public static final String SERIALIZED_NAME_CLIENT_ID = "client_id";
@SerializedName(SERIALIZED_NAME_CLIENT_ID)
@javax.annotation.Nullable
private String clientId;
public static final String SERIALIZED_NAME_SUB = "sub";
@SerializedName(SERIALIZED_NAME_SUB)
@javax.annotation.Nullable
private String sub;
public static final String SERIALIZED_NAME_USERNAME = "username";
@SerializedName(SERIALIZED_NAME_USERNAME)
@javax.annotation.Nullable
private String username;
public static final String SERIALIZED_NAME_SCOPE = "scope";
@SerializedName(SERIALIZED_NAME_SCOPE)
@javax.annotation.Nullable
private String scope;
public static final String SERIALIZED_NAME_ISS = "iss";
@SerializedName(SERIALIZED_NAME_ISS)
@javax.annotation.Nullable
private String iss;
public static final String SERIALIZED_NAME_AUD = "aud";
@SerializedName(SERIALIZED_NAME_AUD)
@javax.annotation.Nullable
private String aud;
public static final String SERIALIZED_NAME_IAT = "iat";
@SerializedName(SERIALIZED_NAME_IAT)
@javax.annotation.Nullable
private Long iat;
public static final String SERIALIZED_NAME_EXP = "exp";
@SerializedName(SERIALIZED_NAME_EXP)
@javax.annotation.Nullable
private Long exp;
public static final String SERIALIZED_NAME_NBF = "nbf";
@SerializedName(SERIALIZED_NAME_NBF)
@javax.annotation.Nullable
private Long nbf;
public IntrospectResponse() {
}
public IntrospectResponse jti(@javax.annotation.Nullable String jti) {
this.jti = jti;
return this;
}
/**
* Get jti
* @return jti
*/
@javax.annotation.Nullable
public String getJti() {
return jti;
}
public void setJti(@javax.annotation.Nullable String jti) {
this.jti = jti;
}
public IntrospectResponse active(@javax.annotation.Nullable Boolean active) {
this.active = active;
return this;
}
/**
* Get active
* @return active
*/
@javax.annotation.Nullable
public Boolean getActive() {
return active;
}
public void setActive(@javax.annotation.Nullable Boolean active) {
this.active = active;
}
public IntrospectResponse tokenType(@javax.annotation.Nullable String tokenType) {
this.tokenType = tokenType;
return this;
}
/**
* Get tokenType
* @return tokenType
*/
@javax.annotation.Nullable
public String getTokenType() {
return tokenType;
}
public void setTokenType(@javax.annotation.Nullable String tokenType) {
this.tokenType = tokenType;
}
public IntrospectResponse clientId(@javax.annotation.Nullable String clientId) {
this.clientId = clientId;
return this;
}
/**
* Get clientId
* @return clientId
*/
@javax.annotation.Nullable
public String getClientId() {
return clientId;
}
public void setClientId(@javax.annotation.Nullable String clientId) {
this.clientId = clientId;
}
public IntrospectResponse sub(@javax.annotation.Nullable String sub) {
this.sub = sub;
return this;
}
/**
* Get sub
* @return sub
*/
@javax.annotation.Nullable
public String getSub() {
return sub;
}
public void setSub(@javax.annotation.Nullable String sub) {
this.sub = sub;
}
public IntrospectResponse username(@javax.annotation.Nullable String username) {
this.username = username;
return this;
}
/**
* Get username
* @return username
*/
@javax.annotation.Nullable
public String getUsername() {
return username;
}
public void setUsername(@javax.annotation.Nullable String username) {
this.username = username;
}
public IntrospectResponse scope(@javax.annotation.Nullable String scope) {
this.scope = scope;
return this;
}
/**
* Get scope
* @return scope
*/
@javax.annotation.Nullable
public String getScope() {
return scope;
}
public void setScope(@javax.annotation.Nullable String scope) {
this.scope = scope;
}
public IntrospectResponse iss(@javax.annotation.Nullable String iss) {
this.iss = iss;
return this;
}
/**
* Get iss
* @return iss
*/
@javax.annotation.Nullable
public String getIss() {
return iss;
}
public void setIss(@javax.annotation.Nullable String iss) {
this.iss = iss;
}
public IntrospectResponse aud(@javax.annotation.Nullable String aud) {
this.aud = aud;
return this;
}
/**
* Get aud
* @return aud
*/
@javax.annotation.Nullable
public String getAud() {
return aud;
}
public void setAud(@javax.annotation.Nullable String aud) {
this.aud = aud;
}
public IntrospectResponse iat(@javax.annotation.Nullable Long iat) {
this.iat = iat;
return this;
}
/**
* Get iat
* @return iat
*/
@javax.annotation.Nullable
public Long getIat() {
return iat;
}
public void setIat(@javax.annotation.Nullable Long iat) {
this.iat = iat;
}
public IntrospectResponse exp(@javax.annotation.Nullable Long exp) {
this.exp = exp;
return this;
}
/**
* Get exp
* @return exp
*/
@javax.annotation.Nullable
public Long getExp() {
return exp;
}
public void setExp(@javax.annotation.Nullable Long exp) {
this.exp = exp;
}
public IntrospectResponse nbf(@javax.annotation.Nullable Long nbf) {
this.nbf = nbf;
return this;
}
/**
* Get nbf
* @return nbf
*/
@javax.annotation.Nullable
public Long getNbf() {
return nbf;
}
public void setNbf(@javax.annotation.Nullable Long nbf) {
this.nbf = nbf;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
IntrospectResponse introspectResponse = (IntrospectResponse) o;
return Objects.equals(this.jti, introspectResponse.jti) &&
Objects.equals(this.active, introspectResponse.active) &&
Objects.equals(this.tokenType, introspectResponse.tokenType) &&
Objects.equals(this.clientId, introspectResponse.clientId) &&
Objects.equals(this.sub, introspectResponse.sub) &&
Objects.equals(this.username, introspectResponse.username) &&
Objects.equals(this.scope, introspectResponse.scope) &&
Objects.equals(this.iss, introspectResponse.iss) &&
Objects.equals(this.aud, introspectResponse.aud) &&
Objects.equals(this.iat, introspectResponse.iat) &&
Objects.equals(this.exp, introspectResponse.exp) &&
Objects.equals(this.nbf, introspectResponse.nbf);
}
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> 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(jti, active, tokenType, clientId, sub, username, scope, iss, aud, iat, exp, nbf);
}
private static <T> int hashCodeNullable(JsonNullable<T> 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 IntrospectResponse {\n");
sb.append(" jti: ").append(toIndentedString(jti)).append("\n");
sb.append(" active: ").append(toIndentedString(active)).append("\n");
sb.append(" tokenType: ").append(toIndentedString(tokenType)).append("\n");
sb.append(" clientId: ").append(toIndentedString(clientId)).append("\n");
sb.append(" sub: ").append(toIndentedString(sub)).append("\n");
sb.append(" username: ").append(toIndentedString(username)).append("\n");
sb.append(" scope: ").append(toIndentedString(scope)).append("\n");
sb.append(" iss: ").append(toIndentedString(iss)).append("\n");
sb.append(" aud: ").append(toIndentedString(aud)).append("\n");
sb.append(" iat: ").append(toIndentedString(iat)).append("\n");
sb.append(" exp: ").append(toIndentedString(exp)).append("\n");
sb.append(" nbf: ").append(toIndentedString(nbf)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
public static HashSet<String> openapiFields;
public static HashSet<String> openapiRequiredFields;
static {
// a set of all properties/fields (JSON key names)
openapiFields = new HashSet<String>();
openapiFields.add("jti");
openapiFields.add("active");
openapiFields.add("token_type");
openapiFields.add("client_id");
openapiFields.add("sub");
openapiFields.add("username");
openapiFields.add("scope");
openapiFields.add("iss");
openapiFields.add("aud");
openapiFields.add("iat");
openapiFields.add("exp");
openapiFields.add("nbf");
// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet<String>();
}
/**
* 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 IntrospectResponse
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!IntrospectResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in IntrospectResponse is not found in the empty JSON string", IntrospectResponse.openapiRequiredFields.toString()));
}
}
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Map.Entry<String, JsonElement> entry : entries) {
if (!IntrospectResponse.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IntrospectResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("jti") != null && !jsonObj.get("jti").isJsonNull()) && !jsonObj.get("jti").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `jti` to be a primitive type in the JSON string but got `%s`", jsonObj.get("jti").toString()));
}
if ((jsonObj.get("token_type") != null && !jsonObj.get("token_type").isJsonNull()) && !jsonObj.get("token_type").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `token_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token_type").toString()));
}
if ((jsonObj.get("client_id") != null && !jsonObj.get("client_id").isJsonNull()) && !jsonObj.get("client_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `client_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("client_id").toString()));
}
if ((jsonObj.get("sub") != null && !jsonObj.get("sub").isJsonNull()) && !jsonObj.get("sub").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `sub` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sub").toString()));
}
if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString()));
}
if ((jsonObj.get("scope") != null && !jsonObj.get("scope").isJsonNull()) && !jsonObj.get("scope").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `scope` to be a primitive type in the JSON string but got `%s`", jsonObj.get("scope").toString()));
}
if ((jsonObj.get("iss") != null && !jsonObj.get("iss").isJsonNull()) && !jsonObj.get("iss").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `iss` to be a primitive type in the JSON string but got `%s`", jsonObj.get("iss").toString()));
}
if ((jsonObj.get("aud") != null && !jsonObj.get("aud").isJsonNull()) && !jsonObj.get("aud").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `aud` to be a primitive type in the JSON string but got `%s`", jsonObj.get("aud").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!IntrospectResponse.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'IntrospectResponse' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<IntrospectResponse> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(IntrospectResponse.class));
return (TypeAdapter<T>) new TypeAdapter<IntrospectResponse>() {
@Override
public void write(JsonWriter out, IntrospectResponse value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public IntrospectResponse read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of IntrospectResponse given an JSON string
*
* @param jsonString JSON string
* @return An instance of IntrospectResponse
* @throws IOException if the JSON string is invalid with respect to IntrospectResponse
*/
public static IntrospectResponse fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, IntrospectResponse.class);
}
/**
* Convert an instance of IntrospectResponse to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}