Generate project with openapi-generator

This commit is contained in:
Guilherme Werner 2025-05-26 22:07:40 -03:00
parent ca1aaad1c1
commit 55bd31eff0
90 changed files with 28130 additions and 808 deletions

View file

@ -0,0 +1,3 @@
<manifest package="com.tribufu.generated" xmlns:android="http://schemas.android.com/apk/res/android">
<application />
</manifest>

View file

@ -0,0 +1,62 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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;
import java.io.IOException;
import java.util.Map;
import java.util.List;
/**
* Callback for asynchronous API call.
*
* @param <T> The return type
*/
public interface ApiCallback<T> {
/**
* This is called when the API call fails.
*
* @param e The exception causing the failure
* @param statusCode Status code of the response if available, otherwise it would be 0
* @param responseHeaders Headers of the response if available, otherwise it would be null
*/
void onFailure(ApiException e, int statusCode, Map<String, List<String>> responseHeaders);
/**
* This is called when the API call succeeded.
*
* @param result The result deserialized from response
* @param statusCode Status code of the response
* @param responseHeaders Headers of the response
*/
void onSuccess(T result, int statusCode, Map<String, List<String>> responseHeaders);
/**
* This is called when the API upload processing.
*
* @param bytesWritten bytes Written
* @param contentLength content length of request body
* @param done write end
*/
void onUploadProgress(long bytesWritten, long contentLength, boolean done);
/**
* This is called when the API download processing.
*
* @param bytesRead bytes Read
* @param contentLength content length of the response
* @param done Read end
*/
void onDownloadProgress(long bytesRead, long contentLength, boolean done);
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,167 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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;
import java.util.Map;
import java.util.List;
/**
* <p>ApiException class.</p>
*/
@SuppressWarnings("serial")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;
/**
* <p>Constructor for ApiException.</p>
*/
public ApiException() {}
/**
* <p>Constructor for ApiException.</p>
*
* @param throwable a {@link java.lang.Throwable} object
*/
public ApiException(Throwable throwable) {
super(throwable);
}
/**
* <p>Constructor for ApiException.</p>
*
* @param message the error message
*/
public ApiException(String message) {
super(message);
}
/**
* <p>Constructor for ApiException.</p>
*
* @param message the error message
* @param throwable a {@link java.lang.Throwable} object
* @param code HTTP status code
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
* @param responseBody the response body
*/
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
super(message, throwable);
this.code = code;
this.responseHeaders = responseHeaders;
this.responseBody = responseBody;
}
/**
* <p>Constructor for ApiException.</p>
*
* @param message the error message
* @param code HTTP status code
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
* @param responseBody the response body
*/
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
this(message, (Throwable) null, code, responseHeaders, responseBody);
}
/**
* <p>Constructor for ApiException.</p>
*
* @param message the error message
* @param throwable a {@link java.lang.Throwable} object
* @param code HTTP status code
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
*/
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
this(message, throwable, code, responseHeaders, null);
}
/**
* <p>Constructor for ApiException.</p>
*
* @param code HTTP status code
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
* @param responseBody the response body
*/
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody);
}
/**
* <p>Constructor for ApiException.</p>
*
* @param code HTTP status code
* @param message a {@link java.lang.String} object
*/
public ApiException(int code, String message) {
super(message);
this.code = code;
}
/**
* <p>Constructor for ApiException.</p>
*
* @param code HTTP status code
* @param message the error message
* @param responseHeaders a {@link java.util.Map} of HTTP response headers
* @param responseBody the response body
*/
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
this(code, message);
this.responseHeaders = responseHeaders;
this.responseBody = responseBody;
}
/**
* Get the HTTP status code.
*
* @return HTTP status code
*/
public int getCode() {
return code;
}
/**
* Get the HTTP response headers.
*
* @return A map of list of string
*/
public Map<String, List<String>> getResponseHeaders() {
return responseHeaders;
}
/**
* Get the HTTP response body.
*
* @return Response body in the form of string
*/
public String getResponseBody() {
return responseBody;
}
/**
* Get the exception message including HTTP response data.
*
* @return The exception message
*/
public String getMessage() {
return String.format("Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s",
super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders());
}
}

View file

@ -0,0 +1,76 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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;
import java.util.List;
import java.util.Map;
/**
* API response returned by API call.
*/
public class ApiResponse<T> {
final private int statusCode;
final private Map<String, List<String>> headers;
final private T data;
/**
* <p>Constructor for ApiResponse.</p>
*
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers) {
this(statusCode, headers, null);
}
/**
* <p>Constructor for ApiResponse.</p>
*
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
* @param data The object deserialized from response bod
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) {
this.statusCode = statusCode;
this.headers = headers;
this.data = data;
}
/**
* <p>Get the <code>status code</code>.</p>
*
* @return the status code
*/
public int getStatusCode() {
return statusCode;
}
/**
* <p>Get the <code>headers</code>.</p>
*
* @return a {@link java.util.Map} of headers
*/
public Map<String, List<String>> getHeaders() {
return headers;
}
/**
* <p>Get the <code>data</code>.</p>
*
* @return the data
*/
public T getData() {
return data;
}
}

View file

@ -0,0 +1,41 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class Configuration {
public static final String VERSION = "1.1.0";
private static volatile ApiClient defaultApiClient = new ApiClient();
/**
* Get the default API client, which would be used when creating API
* instances without providing an API client.
*
* @return Default API client
*/
public static ApiClient getDefaultApiClient() {
return defaultApiClient;
}
/**
* Set the default API client, which would be used when creating API
* instances without providing an API client.
*
* @param apiClient API client
*/
public static void setDefaultApiClient(ApiClient apiClient) {
defaultApiClient = apiClient;
}
}

View file

@ -0,0 +1,85 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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;
import okhttp3.*;
import okio.Buffer;
import okio.BufferedSink;
import okio.GzipSink;
import okio.Okio;
import java.io.IOException;
/**
* Encodes request bodies using gzip.
*
* Taken from https://github.com/square/okhttp/issues/350
*/
class GzipRequestInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request originalRequest = chain.request();
if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
return chain.proceed(originalRequest);
}
Request compressedRequest = originalRequest.newBuilder()
.header("Content-Encoding", "gzip")
.method(originalRequest.method(), forceContentLength(gzip(originalRequest.body())))
.build();
return chain.proceed(compressedRequest);
}
private RequestBody forceContentLength(final RequestBody requestBody) throws IOException {
final Buffer buffer = new Buffer();
requestBody.writeTo(buffer);
return new RequestBody() {
@Override
public MediaType contentType() {
return requestBody.contentType();
}
@Override
public long contentLength() {
return buffer.size();
}
@Override
public void writeTo(BufferedSink sink) throws IOException {
sink.write(buffer.snapshot());
}
};
}
private RequestBody gzip(final RequestBody body) {
return new RequestBody() {
@Override
public MediaType contentType() {
return body.contentType();
}
@Override
public long contentLength() {
return -1; // We don't know the compressed length in advance!
}
@Override
public void writeTo(BufferedSink sink) throws IOException {
BufferedSink gzipSink = Okio.buffer(new GzipSink(sink));
body.writeTo(gzipSink);
gzipSink.close();
}
};
}
}

View file

@ -0,0 +1,430 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapter;
import com.google.gson.internal.bind.util.ISO8601Utils;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.google.gson.JsonElement;
import io.gsonfire.GsonFireBuilder;
import io.gsonfire.TypeSelector;
import okio.ByteString;
import java.io.IOException;
import java.io.StringReader;
import java.lang.reflect.Type;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Locale;
import java.util.Map;
import java.util.HashMap;
/*
* A JSON utility class
*
* NOTE: in the future, this class may be converted to static, which may break
* backward-compatibility
*/
public class JSON {
private static Gson gson;
private static boolean isLenientOnJson = false;
private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter();
private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter();
private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter();
private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter();
private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter();
@SuppressWarnings("unchecked")
public static GsonBuilder createGson() {
GsonFireBuilder fireBuilder = new GsonFireBuilder()
;
GsonBuilder builder = fireBuilder.createGsonBuilder();
return builder;
}
private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) {
JsonElement element = readElement.getAsJsonObject().get(discriminatorField);
if (null == element) {
throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">");
}
return element.getAsString();
}
/**
* Returns the Java class that implements the OpenAPI schema for the specified discriminator value.
*
* @param classByDiscriminatorValue The map of discriminator values to Java classes.
* @param discriminatorValue The value of the OpenAPI discriminator in the input data.
* @return The Java class that implements the OpenAPI schema
*/
private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) {
Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue);
if (null == clazz) {
throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">");
}
return clazz;
}
static {
GsonBuilder gsonBuilder = createGson();
gsonBuilder.registerTypeAdapter(Date.class, dateTypeAdapter);
gsonBuilder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter);
gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter);
gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter);
gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter);
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.Account.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.Application.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.AuthorizeRequest.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.CryptoViewModel.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.Game.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.GameServer.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.GameServerCluster.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.Group.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.GroupGame.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.GroupMember.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.HashViewModel.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.IntrospectRequest.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.IpAddress.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.LeaderboardItem.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.LoginRequest.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.LoginResponse.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.ModelPackage.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.Profile.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.ProfileGame.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.ProfileGroup.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.RefreshRequest.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.RegisterRequest.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.RevokeRequest.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.SearchRequest.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.ServerMetrics.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.Subscription.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.TokenRequest.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.TokenResponse.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.UpdateProfile.CustomTypeAdapterFactory());
gsonBuilder.registerTypeAdapterFactory(new com.tribufu.generated.models.UserInfo.CustomTypeAdapterFactory());
gson = gsonBuilder.create();
}
/**
* Get Gson.
*
* @return Gson
*/
public static Gson getGson() {
return gson;
}
/**
* Set Gson.
*
* @param gson Gson
*/
public static void setGson(Gson gson) {
JSON.gson = gson;
}
public static void setLenientOnJson(boolean lenientOnJson) {
isLenientOnJson = lenientOnJson;
}
/**
* Serialize the given Java object into JSON string.
*
* @param obj Object
* @return String representation of the JSON
*/
public static String serialize(Object obj) {
return gson.toJson(obj);
}
/**
* Deserialize the given JSON string to Java object.
*
* @param <T> Type
* @param body The JSON string
* @param returnType The type to deserialize into
* @return The deserialized Java object
*/
@SuppressWarnings("unchecked")
public static <T> T deserialize(String body, Type returnType) {
try {
if (isLenientOnJson) {
JsonReader jsonReader = new JsonReader(new StringReader(body));
// see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean)
jsonReader.setLenient(true);
return gson.fromJson(jsonReader, returnType);
} else {
return gson.fromJson(body, returnType);
}
} catch (JsonParseException e) {
// Fallback processing when failed to parse JSON form response body:
// return the response body string directly for the String return type;
if (returnType.equals(String.class)) {
return (T) body;
} else {
throw (e);
}
}
}
/**
* Gson TypeAdapter for Byte Array type
*/
public static class ByteArrayAdapter extends TypeAdapter<byte[]> {
@Override
public void write(JsonWriter out, byte[] value) throws IOException {
if (value == null) {
out.nullValue();
} else {
out.value(ByteString.of(value).base64());
}
}
@Override
public byte[] read(JsonReader in) throws IOException {
switch (in.peek()) {
case NULL:
in.nextNull();
return null;
default:
String bytesAsBase64 = in.nextString();
ByteString byteString = ByteString.decodeBase64(bytesAsBase64);
return byteString.toByteArray();
}
}
}
/**
* Gson TypeAdapter for JSR310 OffsetDateTime type
*/
public static class OffsetDateTimeTypeAdapter extends TypeAdapter<OffsetDateTime> {
private DateTimeFormatter formatter;
public OffsetDateTimeTypeAdapter() {
this(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
}
public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) {
this.formatter = formatter;
}
public void setFormat(DateTimeFormatter dateFormat) {
this.formatter = dateFormat;
}
@Override
public void write(JsonWriter out, OffsetDateTime date) throws IOException {
if (date == null) {
out.nullValue();
} else {
out.value(formatter.format(date));
}
}
@Override
public OffsetDateTime read(JsonReader in) throws IOException {
switch (in.peek()) {
case NULL:
in.nextNull();
return null;
default:
String date = in.nextString();
if (date.endsWith("+0000")) {
date = date.substring(0, date.length()-5) + "Z";
}
return OffsetDateTime.parse(date, formatter);
}
}
}
/**
* Gson TypeAdapter for JSR310 LocalDate type
*/
public static class LocalDateTypeAdapter extends TypeAdapter<LocalDate> {
private DateTimeFormatter formatter;
public LocalDateTypeAdapter() {
this(DateTimeFormatter.ISO_LOCAL_DATE);
}
public LocalDateTypeAdapter(DateTimeFormatter formatter) {
this.formatter = formatter;
}
public void setFormat(DateTimeFormatter dateFormat) {
this.formatter = dateFormat;
}
@Override
public void write(JsonWriter out, LocalDate date) throws IOException {
if (date == null) {
out.nullValue();
} else {
out.value(formatter.format(date));
}
}
@Override
public LocalDate read(JsonReader in) throws IOException {
switch (in.peek()) {
case NULL:
in.nextNull();
return null;
default:
String date = in.nextString();
return LocalDate.parse(date, formatter);
}
}
}
public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
offsetDateTimeTypeAdapter.setFormat(dateFormat);
}
public static void setLocalDateFormat(DateTimeFormatter dateFormat) {
localDateTypeAdapter.setFormat(dateFormat);
}
/**
* Gson TypeAdapter for java.sql.Date type
* If the dateFormat is null, a simple "yyyy-MM-dd" format will be used
* (more efficient than SimpleDateFormat).
*/
public static class SqlDateTypeAdapter extends TypeAdapter<java.sql.Date> {
private DateFormat dateFormat;
public SqlDateTypeAdapter() {}
public SqlDateTypeAdapter(DateFormat dateFormat) {
this.dateFormat = dateFormat;
}
public void setFormat(DateFormat dateFormat) {
this.dateFormat = dateFormat;
}
@Override
public void write(JsonWriter out, java.sql.Date date) throws IOException {
if (date == null) {
out.nullValue();
} else {
String value;
if (dateFormat != null) {
value = dateFormat.format(date);
} else {
value = date.toString();
}
out.value(value);
}
}
@Override
public java.sql.Date read(JsonReader in) throws IOException {
switch (in.peek()) {
case NULL:
in.nextNull();
return null;
default:
String date = in.nextString();
try {
if (dateFormat != null) {
return new java.sql.Date(dateFormat.parse(date).getTime());
}
return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
} catch (ParseException e) {
throw new JsonParseException(e);
}
}
}
}
/**
* Gson TypeAdapter for java.util.Date type
* If the dateFormat is null, ISO8601Utils will be used.
*/
public static class DateTypeAdapter extends TypeAdapter<Date> {
private DateFormat dateFormat;
public DateTypeAdapter() {}
public DateTypeAdapter(DateFormat dateFormat) {
this.dateFormat = dateFormat;
}
public void setFormat(DateFormat dateFormat) {
this.dateFormat = dateFormat;
}
@Override
public void write(JsonWriter out, Date date) throws IOException {
if (date == null) {
out.nullValue();
} else {
String value;
if (dateFormat != null) {
value = dateFormat.format(date);
} else {
value = ISO8601Utils.format(date, true);
}
out.value(value);
}
}
@Override
public Date read(JsonReader in) throws IOException {
try {
switch (in.peek()) {
case NULL:
in.nextNull();
return null;
default:
String date = in.nextString();
try {
if (dateFormat != null) {
return dateFormat.parse(date);
}
return ISO8601Utils.parse(date, new ParsePosition(0));
} catch (ParseException e) {
throw new JsonParseException(e);
}
}
} catch (IllegalArgumentException e) {
throw new JsonParseException(e);
}
}
}
public static void setDateFormat(DateFormat dateFormat) {
dateTypeAdapter.setFormat(dateFormat);
}
public static void setSqlDateFormat(DateFormat dateFormat) {
sqlDateTypeAdapter.setFormat(dateFormat);
}
}

View file

@ -0,0 +1,57 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class Pair {
private String name = "";
private String value = "";
public Pair (String name, String value) {
setName(name);
setValue(value);
}
private void setName(String name) {
if (!isValidString(name)) {
return;
}
this.name = name;
}
private void setValue(String value) {
if (!isValidString(value)) {
return;
}
this.value = value;
}
public String getName() {
return this.name;
}
public String getValue() {
return this.value;
}
private boolean isValidString(String arg) {
if (arg == null) {
return false;
}
return true;
}
}

View file

@ -0,0 +1,73 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import java.io.IOException;
import okio.Buffer;
import okio.BufferedSink;
import okio.ForwardingSink;
import okio.Okio;
import okio.Sink;
public class ProgressRequestBody extends RequestBody {
private final RequestBody requestBody;
private final ApiCallback callback;
public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) {
this.requestBody = requestBody;
this.callback = callback;
}
@Override
public MediaType contentType() {
return requestBody.contentType();
}
@Override
public long contentLength() throws IOException {
return requestBody.contentLength();
}
@Override
public void writeTo(BufferedSink sink) throws IOException {
BufferedSink bufferedSink = Okio.buffer(sink(sink));
requestBody.writeTo(bufferedSink);
bufferedSink.flush();
}
private Sink sink(Sink sink) {
return new ForwardingSink(sink) {
long bytesWritten = 0L;
long contentLength = 0L;
@Override
public void write(Buffer source, long byteCount) throws IOException {
super.write(source, byteCount);
if (contentLength == 0) {
contentLength = contentLength();
}
bytesWritten += byteCount;
callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength);
}
};
}
}

View file

@ -0,0 +1,70 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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;
import okhttp3.MediaType;
import okhttp3.ResponseBody;
import java.io.IOException;
import okio.Buffer;
import okio.BufferedSource;
import okio.ForwardingSource;
import okio.Okio;
import okio.Source;
public class ProgressResponseBody extends ResponseBody {
private final ResponseBody responseBody;
private final ApiCallback callback;
private BufferedSource bufferedSource;
public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) {
this.responseBody = responseBody;
this.callback = callback;
}
@Override
public MediaType contentType() {
return responseBody.contentType();
}
@Override
public long contentLength() {
return responseBody.contentLength();
}
@Override
public BufferedSource source() {
if (bufferedSource == null) {
bufferedSource = Okio.buffer(source(responseBody.source()));
}
return bufferedSource;
}
private Source source(Source source) {
return new ForwardingSource(source) {
long totalBytesRead = 0L;
@Override
public long read(Buffer sink, long byteCount) throws IOException {
long bytesRead = super.read(sink, byteCount);
// read() returns the number of bytes read, or -1 if this source is exhausted.
totalBytesRead += bytesRead != -1 ? bytesRead : 0;
callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1);
return bytesRead;
}
};
}
}

View file

@ -0,0 +1,72 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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;
import java.util.Map;
/**
* Representing a Server configuration.
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class ServerConfiguration {
public String URL;
public String description;
public Map<String, ServerVariable> variables;
/**
* @param URL A URL to the target host.
* @param description A description of the host designated by the URL.
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
*/
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
this.URL = URL;
this.description = description;
this.variables = variables;
}
/**
* Format URL template using given variables.
*
* @param variables A map between a variable name and its value.
* @return Formatted URL.
*/
public String URL(Map<String, String> variables) {
String url = this.URL;
// go through variables and replace placeholders
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
String name = variable.getKey();
ServerVariable serverVariable = variable.getValue();
String value = serverVariable.defaultValue;
if (variables != null && variables.containsKey(name)) {
value = variables.get(name);
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + ".");
}
}
url = url.replace("{" + name + "}", value);
}
return url;
}
/**
* Format URL template using default server variables.
*
* @return Formatted URL.
*/
public String URL() {
return URL(null);
}
}

View file

@ -0,0 +1,37 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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;
import java.util.HashSet;
/**
* Representing a Server Variable for server URL template substitution.
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class ServerVariable {
public String description;
public String defaultValue;
public HashSet<String> enumValues = null;
/**
* @param description A description for the server variable.
* @param defaultValue The default value to use for substitution.
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
*/
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
this.description = description;
this.defaultValue = defaultValue;
this.enumValues = enumValues;
}
}

View file

@ -0,0 +1,83 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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;
import java.util.Collection;
import java.util.Iterator;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive comparison).
*
* @param array The array
* @param value The value to search
* @return true if the array contains the value
*/
public static boolean containsIgnoreCase(String[] array, String value) {
for (String str : array) {
if (value == null && str == null) {
return true;
}
if (value != null && value.equalsIgnoreCase(str)) {
return true;
}
}
return false;
}
/**
* Join an array of strings with the given separator.
* <p>
* Note: This might be replaced by utility method from commons-lang or guava someday
* if one of those libraries is added as dependency.
* </p>
*
* @param array The array of strings
* @param separator The separator
* @return the resulting string
*/
public static String join(String[] array, String separator) {
int len = array.length;
if (len == 0) {
return "";
}
StringBuilder out = new StringBuilder();
out.append(array[0]);
for (int i = 1; i < len; i++) {
out.append(separator).append(array[i]);
}
return out.toString();
}
/**
* Join a list of strings with the given separator.
*
* @param list The list of strings
* @param separator The separator
* @return the resulting string
*/
public static String join(Collection<String> list, String separator) {
Iterator<String> iterator = list.iterator();
StringBuilder out = new StringBuilder();
if (iterator.hasNext()) {
out.append(iterator.next());
}
while (iterator.hasNext()) {
out.append(separator).append(iterator.next());
}
return out.toString();
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,80 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.auth;
import com.tribufu.generated.ApiException;
import com.tribufu.generated.Pair;
import java.net.URI;
import java.util.Map;
import java.util.List;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class ApiKeyAuth implements Authentication {
private final String location;
private final String paramName;
private String apiKey;
private String apiKeyPrefix;
public ApiKeyAuth(String location, String paramName) {
this.location = location;
this.paramName = paramName;
}
public String getLocation() {
return location;
}
public String getParamName() {
return paramName;
}
public String getApiKey() {
return apiKey;
}
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
public String getApiKeyPrefix() {
return apiKeyPrefix;
}
public void setApiKeyPrefix(String apiKeyPrefix) {
this.apiKeyPrefix = apiKeyPrefix;
}
@Override
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams,
String payload, String method, URI uri) throws ApiException {
if (apiKey == null) {
return;
}
String value;
if (apiKeyPrefix != null) {
value = apiKeyPrefix + " " + apiKey;
} else {
value = apiKey;
}
if ("query".equals(location)) {
queryParams.add(new Pair(paramName, value));
} else if ("header".equals(location)) {
headerParams.put(paramName, value);
} else if ("cookie".equals(location)) {
cookieParams.put(paramName, value);
}
}
}

View file

@ -0,0 +1,36 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.auth;
import com.tribufu.generated.Pair;
import com.tribufu.generated.ApiException;
import java.net.URI;
import java.util.Map;
import java.util.List;
public interface Authentication {
/**
* Apply authentication settings to header and query params.
*
* @param queryParams List of query parameters
* @param headerParams Map of header parameters
* @param cookieParams Map of cookie parameters
* @param payload HTTP request body
* @param method HTTP method
* @param uri URI
* @throws ApiException if failed to update the parameters
*/
void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException;
}

View file

@ -0,0 +1,55 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.auth;
import com.tribufu.generated.Pair;
import com.tribufu.generated.ApiException;
import okhttp3.Credentials;
import java.net.URI;
import java.util.Map;
import java.util.List;
public class HttpBasicAuth implements Authentication {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams,
String payload, String method, URI uri) throws ApiException {
if (username == null && password == null) {
return;
}
headerParams.put("Authorization", Credentials.basic(
username == null ? "" : username,
password == null ? "" : password));
}
}

View file

@ -0,0 +1,75 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.auth;
import com.tribufu.generated.ApiException;
import com.tribufu.generated.Pair;
import java.net.URI;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Supplier;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class HttpBearerAuth implements Authentication {
private final String scheme;
private Supplier<String> tokenSupplier;
public HttpBearerAuth(String scheme) {
this.scheme = scheme;
}
/**
* Gets the token, which together with the scheme, will be sent as the value of the Authorization header.
*
* @return The bearer token
*/
public String getBearerToken() {
return tokenSupplier.get();
}
/**
* Sets the token, which together with the scheme, will be sent as the value of the Authorization header.
*
* @param bearerToken The bearer token to send in the Authorization header
*/
public void setBearerToken(String bearerToken) {
this.tokenSupplier = () -> bearerToken;
}
/**
* Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header.
*
* @param tokenSupplier The supplier of bearer tokens to send in the Authorization header
*/
public void setBearerToken(Supplier<String> tokenSupplier) {
this.tokenSupplier = tokenSupplier;
}
@Override
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams,
String payload, String method, URI uri) throws ApiException {
String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null);
if (bearerToken == null) {
return;
}
headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken);
}
private static String upperCaseBearer(String scheme) {
return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme;
}
}

View file

@ -0,0 +1,146 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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 com.tribufu.generated.ApiException;
import java.util.Objects;
import java.lang.reflect.Type;
import java.util.Map;
/**
* Abstract class for oneOf,anyOf schemas defined in OpenAPI spec
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public abstract class AbstractOpenApiSchema {
// store the actual instance of the schema/object
private Object instance;
// is nullable
private Boolean isNullable;
// schema type (e.g. oneOf, anyOf)
private final String schemaType;
public AbstractOpenApiSchema(String schemaType, Boolean isNullable) {
this.schemaType = schemaType;
this.isNullable = isNullable;
}
/**
* Get the list of oneOf/anyOf composed schemas allowed to be stored in this object
*
* @return an instance of the actual schema/object
*/
public abstract Map<String, Class<?>> getSchemas();
/**
* Get the actual instance
*
* @return an instance of the actual schema/object
*/
//@JsonValue
public Object getActualInstance() {return instance;}
/**
* Set the actual instance
*
* @param instance the actual instance of the schema/object
*/
public void setActualInstance(Object instance) {this.instance = instance;}
/**
* Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well
*
* @return an instance of the actual schema/object
*/
public Object getActualInstanceRecursively() {
return getActualInstanceRecursively(this);
}
private Object getActualInstanceRecursively(AbstractOpenApiSchema object) {
if (object.getActualInstance() == null) {
return null;
} else if (object.getActualInstance() instanceof AbstractOpenApiSchema) {
return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance());
} else {
return object.getActualInstance();
}
}
/**
* Get the schema type (e.g. anyOf, oneOf)
*
* @return the schema type
*/
public String getSchemaType() {
return schemaType;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ").append(getClass()).append(" {\n");
sb.append(" instance: ").append(toIndentedString(instance)).append("\n");
sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n");
sb.append(" schemaType: ").append(toIndentedString(schemaType)).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 boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
AbstractOpenApiSchema a = (AbstractOpenApiSchema) o;
return Objects.equals(this.instance, a.instance) &&
Objects.equals(this.isNullable, a.isNullable) &&
Objects.equals(this.schemaType, a.schemaType);
}
@Override
public int hashCode() {
return Objects.hash(instance, isNullable, schemaType);
}
/**
* Is nullable
*
* @return true if it's nullable
*/
public Boolean isNullable() {
if (Boolean.TRUE.equals(isNullable)) {
return Boolean.TRUE;
} else {
return Boolean.FALSE;
}
}
}

View file

@ -0,0 +1,419 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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 com.tribufu.generated.models.LoginProvider;
import java.io.IOException;
import java.time.OffsetDateTime;
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;
/**
* Account
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class Account {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
@javax.annotation.Nullable
private String id;
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
@javax.annotation.Nullable
private String name;
public static final String SERIALIZED_NAME_PROVIDER = "provider";
@SerializedName(SERIALIZED_NAME_PROVIDER)
@javax.annotation.Nullable
private LoginProvider provider;
public static final String SERIALIZED_NAME_USER_ID = "user_id";
@SerializedName(SERIALIZED_NAME_USER_ID)
@javax.annotation.Nullable
private String userId;
public static final String SERIALIZED_NAME_AUTHORIZED = "authorized";
@SerializedName(SERIALIZED_NAME_AUTHORIZED)
@javax.annotation.Nullable
private Boolean authorized;
public static final String SERIALIZED_NAME_FIELDS = "fields";
@SerializedName(SERIALIZED_NAME_FIELDS)
@javax.annotation.Nullable
private Object fields = null;
public static final String SERIALIZED_NAME_CREATED = "created";
@SerializedName(SERIALIZED_NAME_CREATED)
@javax.annotation.Nullable
private OffsetDateTime created;
public static final String SERIALIZED_NAME_UPDATED = "updated";
@SerializedName(SERIALIZED_NAME_UPDATED)
@javax.annotation.Nullable
private OffsetDateTime updated;
public Account() {
}
public Account id(@javax.annotation.Nullable String id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@javax.annotation.Nullable
public String getId() {
return id;
}
public void setId(@javax.annotation.Nullable String id) {
this.id = id;
}
public Account name(@javax.annotation.Nullable String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
*/
@javax.annotation.Nullable
public String getName() {
return name;
}
public void setName(@javax.annotation.Nullable String name) {
this.name = name;
}
public Account provider(@javax.annotation.Nullable LoginProvider provider) {
this.provider = provider;
return this;
}
/**
* Get provider
* @return provider
*/
@javax.annotation.Nullable
public LoginProvider getProvider() {
return provider;
}
public void setProvider(@javax.annotation.Nullable LoginProvider provider) {
this.provider = provider;
}
public Account userId(@javax.annotation.Nullable String userId) {
this.userId = userId;
return this;
}
/**
* Get userId
* @return userId
*/
@javax.annotation.Nullable
public String getUserId() {
return userId;
}
public void setUserId(@javax.annotation.Nullable String userId) {
this.userId = userId;
}
public Account authorized(@javax.annotation.Nullable Boolean authorized) {
this.authorized = authorized;
return this;
}
/**
* Get authorized
* @return authorized
*/
@javax.annotation.Nullable
public Boolean getAuthorized() {
return authorized;
}
public void setAuthorized(@javax.annotation.Nullable Boolean authorized) {
this.authorized = authorized;
}
public Account fields(@javax.annotation.Nullable Object fields) {
this.fields = fields;
return this;
}
/**
* Get fields
* @return fields
*/
@javax.annotation.Nullable
public Object getFields() {
return fields;
}
public void setFields(@javax.annotation.Nullable Object fields) {
this.fields = fields;
}
public Account created(@javax.annotation.Nullable OffsetDateTime created) {
this.created = created;
return this;
}
/**
* Get created
* @return created
*/
@javax.annotation.Nullable
public OffsetDateTime getCreated() {
return created;
}
public void setCreated(@javax.annotation.Nullable OffsetDateTime created) {
this.created = created;
}
public Account updated(@javax.annotation.Nullable OffsetDateTime updated) {
this.updated = updated;
return this;
}
/**
* Get updated
* @return updated
*/
@javax.annotation.Nullable
public OffsetDateTime getUpdated() {
return updated;
}
public void setUpdated(@javax.annotation.Nullable OffsetDateTime updated) {
this.updated = updated;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Account account = (Account) o;
return Objects.equals(this.id, account.id) &&
Objects.equals(this.name, account.name) &&
Objects.equals(this.provider, account.provider) &&
Objects.equals(this.userId, account.userId) &&
Objects.equals(this.authorized, account.authorized) &&
Objects.equals(this.fields, account.fields) &&
Objects.equals(this.created, account.created) &&
Objects.equals(this.updated, account.updated);
}
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(id, name, provider, userId, authorized, fields, created, updated);
}
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 Account {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" provider: ").append(toIndentedString(provider)).append("\n");
sb.append(" userId: ").append(toIndentedString(userId)).append("\n");
sb.append(" authorized: ").append(toIndentedString(authorized)).append("\n");
sb.append(" fields: ").append(toIndentedString(fields)).append("\n");
sb.append(" created: ").append(toIndentedString(created)).append("\n");
sb.append(" updated: ").append(toIndentedString(updated)).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("id");
openapiFields.add("name");
openapiFields.add("provider");
openapiFields.add("user_id");
openapiFields.add("authorized");
openapiFields.add("fields");
openapiFields.add("created");
openapiFields.add("updated");
// 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 Account
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!Account.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in Account is not found in the empty JSON string", Account.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 (!Account.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Account` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString()));
}
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
}
// validate the optional field `provider`
if (jsonObj.get("provider") != null && !jsonObj.get("provider").isJsonNull()) {
LoginProvider.validateJsonElement(jsonObj.get("provider"));
}
if ((jsonObj.get("user_id") != null && !jsonObj.get("user_id").isJsonNull()) && !jsonObj.get("user_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `user_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("user_id").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!Account.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'Account' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<Account> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(Account.class));
return (TypeAdapter<T>) new TypeAdapter<Account>() {
@Override
public void write(JsonWriter out, Account value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public Account read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of Account given an JSON string
*
* @param jsonString JSON string
* @return An instance of Account
* @throws IOException if the JSON string is invalid with respect to Account
*/
public static Account fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, Account.class);
}
/**
* Convert an instance of Account to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,768 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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 com.tribufu.generated.models.ApplicationType;
import java.io.IOException;
import java.net.URI;
import java.time.OffsetDateTime;
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;
/**
* Application
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class Application {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
@javax.annotation.Nullable
private String id;
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
@javax.annotation.Nullable
private String name;
public static final String SERIALIZED_NAME_DESCRIPTION = "description";
@SerializedName(SERIALIZED_NAME_DESCRIPTION)
@javax.annotation.Nullable
private String description;
public static final String SERIALIZED_NAME_TYPE = "type";
@SerializedName(SERIALIZED_NAME_TYPE)
@javax.annotation.Nullable
private ApplicationType type;
public static final String SERIALIZED_NAME_ORGANIZATION_ID = "organization_id";
@SerializedName(SERIALIZED_NAME_ORGANIZATION_ID)
@javax.annotation.Nullable
private String organizationId;
public static final String SERIALIZED_NAME_ICON_URL = "icon_url";
@SerializedName(SERIALIZED_NAME_ICON_URL)
@javax.annotation.Nullable
private URI iconUrl;
public static final String SERIALIZED_NAME_BANNER_URL = "banner_url";
@SerializedName(SERIALIZED_NAME_BANNER_URL)
@javax.annotation.Nullable
private URI bannerUrl;
public static final String SERIALIZED_NAME_CAPSULE_IMAGE_URL = "capsule_image_url";
@SerializedName(SERIALIZED_NAME_CAPSULE_IMAGE_URL)
@javax.annotation.Nullable
private URI capsuleImageUrl;
public static final String SERIALIZED_NAME_LIBRARY_IMAGE_URL = "library_image_url";
@SerializedName(SERIALIZED_NAME_LIBRARY_IMAGE_URL)
@javax.annotation.Nullable
private URI libraryImageUrl;
public static final String SERIALIZED_NAME_PARENT_ID = "parent_id";
@SerializedName(SERIALIZED_NAME_PARENT_ID)
@javax.annotation.Nullable
private String parentId;
public static final String SERIALIZED_NAME_SLUG = "slug";
@SerializedName(SERIALIZED_NAME_SLUG)
@javax.annotation.Nullable
private String slug;
public static final String SERIALIZED_NAME_VISIBILITY = "visibility";
@SerializedName(SERIALIZED_NAME_VISIBILITY)
@javax.annotation.Nullable
private Integer visibility;
public static final String SERIALIZED_NAME_PASSWORD = "password";
@SerializedName(SERIALIZED_NAME_PASSWORD)
@javax.annotation.Nullable
private String password;
public static final String SERIALIZED_NAME_PRIMARY = "primary";
@SerializedName(SERIALIZED_NAME_PRIMARY)
@javax.annotation.Nullable
private Integer primary;
public static final String SERIALIZED_NAME_USER_COUNT = "user_count";
@SerializedName(SERIALIZED_NAME_USER_COUNT)
@javax.annotation.Nullable
private Integer userCount;
public static final String SERIALIZED_NAME_ACHIEVEMENT_COUNT = "achievement_count";
@SerializedName(SERIALIZED_NAME_ACHIEVEMENT_COUNT)
@javax.annotation.Nullable
private Integer achievementCount;
public static final String SERIALIZED_NAME_BADGE_COUNT = "badge_count";
@SerializedName(SERIALIZED_NAME_BADGE_COUNT)
@javax.annotation.Nullable
private Integer badgeCount;
public static final String SERIALIZED_NAME_DOWNLOAD_COUNT = "download_count";
@SerializedName(SERIALIZED_NAME_DOWNLOAD_COUNT)
@javax.annotation.Nullable
private Integer downloadCount;
public static final String SERIALIZED_NAME_CREATED = "created";
@SerializedName(SERIALIZED_NAME_CREATED)
@javax.annotation.Nullable
private OffsetDateTime created;
public static final String SERIALIZED_NAME_UPDATED = "updated";
@SerializedName(SERIALIZED_NAME_UPDATED)
@javax.annotation.Nullable
private OffsetDateTime updated;
public Application() {
}
public Application id(@javax.annotation.Nullable String id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@javax.annotation.Nullable
public String getId() {
return id;
}
public void setId(@javax.annotation.Nullable String id) {
this.id = id;
}
public Application name(@javax.annotation.Nullable String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
*/
@javax.annotation.Nullable
public String getName() {
return name;
}
public void setName(@javax.annotation.Nullable String name) {
this.name = name;
}
public Application description(@javax.annotation.Nullable String description) {
this.description = description;
return this;
}
/**
* Get description
* @return description
*/
@javax.annotation.Nullable
public String getDescription() {
return description;
}
public void setDescription(@javax.annotation.Nullable String description) {
this.description = description;
}
public Application type(@javax.annotation.Nullable ApplicationType type) {
this.type = type;
return this;
}
/**
* Get type
* @return type
*/
@javax.annotation.Nullable
public ApplicationType getType() {
return type;
}
public void setType(@javax.annotation.Nullable ApplicationType type) {
this.type = type;
}
public Application organizationId(@javax.annotation.Nullable String organizationId) {
this.organizationId = organizationId;
return this;
}
/**
* Get organizationId
* @return organizationId
*/
@javax.annotation.Nullable
public String getOrganizationId() {
return organizationId;
}
public void setOrganizationId(@javax.annotation.Nullable String organizationId) {
this.organizationId = organizationId;
}
public Application iconUrl(@javax.annotation.Nullable URI iconUrl) {
this.iconUrl = iconUrl;
return this;
}
/**
* Get iconUrl
* @return iconUrl
*/
@javax.annotation.Nullable
public URI getIconUrl() {
return iconUrl;
}
public void setIconUrl(@javax.annotation.Nullable URI iconUrl) {
this.iconUrl = iconUrl;
}
public Application bannerUrl(@javax.annotation.Nullable URI bannerUrl) {
this.bannerUrl = bannerUrl;
return this;
}
/**
* Get bannerUrl
* @return bannerUrl
*/
@javax.annotation.Nullable
public URI getBannerUrl() {
return bannerUrl;
}
public void setBannerUrl(@javax.annotation.Nullable URI bannerUrl) {
this.bannerUrl = bannerUrl;
}
public Application capsuleImageUrl(@javax.annotation.Nullable URI capsuleImageUrl) {
this.capsuleImageUrl = capsuleImageUrl;
return this;
}
/**
* Get capsuleImageUrl
* @return capsuleImageUrl
*/
@javax.annotation.Nullable
public URI getCapsuleImageUrl() {
return capsuleImageUrl;
}
public void setCapsuleImageUrl(@javax.annotation.Nullable URI capsuleImageUrl) {
this.capsuleImageUrl = capsuleImageUrl;
}
public Application libraryImageUrl(@javax.annotation.Nullable URI libraryImageUrl) {
this.libraryImageUrl = libraryImageUrl;
return this;
}
/**
* Get libraryImageUrl
* @return libraryImageUrl
*/
@javax.annotation.Nullable
public URI getLibraryImageUrl() {
return libraryImageUrl;
}
public void setLibraryImageUrl(@javax.annotation.Nullable URI libraryImageUrl) {
this.libraryImageUrl = libraryImageUrl;
}
public Application parentId(@javax.annotation.Nullable String parentId) {
this.parentId = parentId;
return this;
}
/**
* Get parentId
* @return parentId
*/
@javax.annotation.Nullable
public String getParentId() {
return parentId;
}
public void setParentId(@javax.annotation.Nullable String parentId) {
this.parentId = parentId;
}
public Application slug(@javax.annotation.Nullable String slug) {
this.slug = slug;
return this;
}
/**
* Get slug
* @return slug
*/
@javax.annotation.Nullable
public String getSlug() {
return slug;
}
public void setSlug(@javax.annotation.Nullable String slug) {
this.slug = slug;
}
public Application visibility(@javax.annotation.Nullable Integer visibility) {
this.visibility = visibility;
return this;
}
/**
* Get visibility
* @return visibility
*/
@javax.annotation.Nullable
public Integer getVisibility() {
return visibility;
}
public void setVisibility(@javax.annotation.Nullable Integer visibility) {
this.visibility = visibility;
}
public Application password(@javax.annotation.Nullable String password) {
this.password = password;
return this;
}
/**
* Get password
* @return password
*/
@javax.annotation.Nullable
public String getPassword() {
return password;
}
public void setPassword(@javax.annotation.Nullable String password) {
this.password = password;
}
public Application primary(@javax.annotation.Nullable Integer primary) {
this.primary = primary;
return this;
}
/**
* Get primary
* @return primary
*/
@javax.annotation.Nullable
public Integer getPrimary() {
return primary;
}
public void setPrimary(@javax.annotation.Nullable Integer primary) {
this.primary = primary;
}
public Application userCount(@javax.annotation.Nullable Integer userCount) {
this.userCount = userCount;
return this;
}
/**
* Get userCount
* @return userCount
*/
@javax.annotation.Nullable
public Integer getUserCount() {
return userCount;
}
public void setUserCount(@javax.annotation.Nullable Integer userCount) {
this.userCount = userCount;
}
public Application achievementCount(@javax.annotation.Nullable Integer achievementCount) {
this.achievementCount = achievementCount;
return this;
}
/**
* Get achievementCount
* @return achievementCount
*/
@javax.annotation.Nullable
public Integer getAchievementCount() {
return achievementCount;
}
public void setAchievementCount(@javax.annotation.Nullable Integer achievementCount) {
this.achievementCount = achievementCount;
}
public Application badgeCount(@javax.annotation.Nullable Integer badgeCount) {
this.badgeCount = badgeCount;
return this;
}
/**
* Get badgeCount
* @return badgeCount
*/
@javax.annotation.Nullable
public Integer getBadgeCount() {
return badgeCount;
}
public void setBadgeCount(@javax.annotation.Nullable Integer badgeCount) {
this.badgeCount = badgeCount;
}
public Application downloadCount(@javax.annotation.Nullable Integer downloadCount) {
this.downloadCount = downloadCount;
return this;
}
/**
* Get downloadCount
* @return downloadCount
*/
@javax.annotation.Nullable
public Integer getDownloadCount() {
return downloadCount;
}
public void setDownloadCount(@javax.annotation.Nullable Integer downloadCount) {
this.downloadCount = downloadCount;
}
public Application created(@javax.annotation.Nullable OffsetDateTime created) {
this.created = created;
return this;
}
/**
* Get created
* @return created
*/
@javax.annotation.Nullable
public OffsetDateTime getCreated() {
return created;
}
public void setCreated(@javax.annotation.Nullable OffsetDateTime created) {
this.created = created;
}
public Application updated(@javax.annotation.Nullable OffsetDateTime updated) {
this.updated = updated;
return this;
}
/**
* Get updated
* @return updated
*/
@javax.annotation.Nullable
public OffsetDateTime getUpdated() {
return updated;
}
public void setUpdated(@javax.annotation.Nullable OffsetDateTime updated) {
this.updated = updated;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Application application = (Application) o;
return Objects.equals(this.id, application.id) &&
Objects.equals(this.name, application.name) &&
Objects.equals(this.description, application.description) &&
Objects.equals(this.type, application.type) &&
Objects.equals(this.organizationId, application.organizationId) &&
Objects.equals(this.iconUrl, application.iconUrl) &&
Objects.equals(this.bannerUrl, application.bannerUrl) &&
Objects.equals(this.capsuleImageUrl, application.capsuleImageUrl) &&
Objects.equals(this.libraryImageUrl, application.libraryImageUrl) &&
Objects.equals(this.parentId, application.parentId) &&
Objects.equals(this.slug, application.slug) &&
Objects.equals(this.visibility, application.visibility) &&
Objects.equals(this.password, application.password) &&
Objects.equals(this.primary, application.primary) &&
Objects.equals(this.userCount, application.userCount) &&
Objects.equals(this.achievementCount, application.achievementCount) &&
Objects.equals(this.badgeCount, application.badgeCount) &&
Objects.equals(this.downloadCount, application.downloadCount) &&
Objects.equals(this.created, application.created) &&
Objects.equals(this.updated, application.updated);
}
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(id, name, description, type, organizationId, iconUrl, bannerUrl, capsuleImageUrl, libraryImageUrl, parentId, slug, visibility, password, primary, userCount, achievementCount, badgeCount, downloadCount, created, updated);
}
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 Application {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" organizationId: ").append(toIndentedString(organizationId)).append("\n");
sb.append(" iconUrl: ").append(toIndentedString(iconUrl)).append("\n");
sb.append(" bannerUrl: ").append(toIndentedString(bannerUrl)).append("\n");
sb.append(" capsuleImageUrl: ").append(toIndentedString(capsuleImageUrl)).append("\n");
sb.append(" libraryImageUrl: ").append(toIndentedString(libraryImageUrl)).append("\n");
sb.append(" parentId: ").append(toIndentedString(parentId)).append("\n");
sb.append(" slug: ").append(toIndentedString(slug)).append("\n");
sb.append(" visibility: ").append(toIndentedString(visibility)).append("\n");
sb.append(" password: ").append(toIndentedString(password)).append("\n");
sb.append(" primary: ").append(toIndentedString(primary)).append("\n");
sb.append(" userCount: ").append(toIndentedString(userCount)).append("\n");
sb.append(" achievementCount: ").append(toIndentedString(achievementCount)).append("\n");
sb.append(" badgeCount: ").append(toIndentedString(badgeCount)).append("\n");
sb.append(" downloadCount: ").append(toIndentedString(downloadCount)).append("\n");
sb.append(" created: ").append(toIndentedString(created)).append("\n");
sb.append(" updated: ").append(toIndentedString(updated)).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("id");
openapiFields.add("name");
openapiFields.add("description");
openapiFields.add("type");
openapiFields.add("organization_id");
openapiFields.add("icon_url");
openapiFields.add("banner_url");
openapiFields.add("capsule_image_url");
openapiFields.add("library_image_url");
openapiFields.add("parent_id");
openapiFields.add("slug");
openapiFields.add("visibility");
openapiFields.add("password");
openapiFields.add("primary");
openapiFields.add("user_count");
openapiFields.add("achievement_count");
openapiFields.add("badge_count");
openapiFields.add("download_count");
openapiFields.add("created");
openapiFields.add("updated");
// 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 Application
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!Application.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in Application is not found in the empty JSON string", Application.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 (!Application.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Application` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString()));
}
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
}
if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString()));
}
// validate the optional field `type`
if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) {
ApplicationType.validateJsonElement(jsonObj.get("type"));
}
if ((jsonObj.get("organization_id") != null && !jsonObj.get("organization_id").isJsonNull()) && !jsonObj.get("organization_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `organization_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("organization_id").toString()));
}
if ((jsonObj.get("icon_url") != null && !jsonObj.get("icon_url").isJsonNull()) && !jsonObj.get("icon_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `icon_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("icon_url").toString()));
}
if ((jsonObj.get("banner_url") != null && !jsonObj.get("banner_url").isJsonNull()) && !jsonObj.get("banner_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `banner_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("banner_url").toString()));
}
if ((jsonObj.get("capsule_image_url") != null && !jsonObj.get("capsule_image_url").isJsonNull()) && !jsonObj.get("capsule_image_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `capsule_image_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("capsule_image_url").toString()));
}
if ((jsonObj.get("library_image_url") != null && !jsonObj.get("library_image_url").isJsonNull()) && !jsonObj.get("library_image_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `library_image_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("library_image_url").toString()));
}
if ((jsonObj.get("parent_id") != null && !jsonObj.get("parent_id").isJsonNull()) && !jsonObj.get("parent_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `parent_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parent_id").toString()));
}
if ((jsonObj.get("slug") != null && !jsonObj.get("slug").isJsonNull()) && !jsonObj.get("slug").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").toString()));
}
if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!Application.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'Application' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<Application> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(Application.class));
return (TypeAdapter<T>) new TypeAdapter<Application>() {
@Override
public void write(JsonWriter out, Application value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public Application read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of Application given an JSON string
*
* @param jsonString JSON string
* @return An instance of Application
* @throws IOException if the JSON string is invalid with respect to Application
*/
public static Application fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, Application.class);
}
/**
* Convert an instance of Application to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,78 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.annotations.SerializedName;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* Gets or Sets ApplicationType
*/
@JsonAdapter(ApplicationType.Adapter.class)
public enum ApplicationType {
APPLICATION("application"),
GAME("game");
private String value;
ApplicationType(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static ApplicationType fromValue(String value) {
for (ApplicationType b : ApplicationType.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter<ApplicationType> {
@Override
public void write(final JsonWriter jsonWriter, final ApplicationType enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public ApplicationType read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return ApplicationType.fromValue(value);
}
}
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
ApplicationType.fromValue(value);
}
}

View file

@ -0,0 +1,402 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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 com.tribufu.generated.models.CodeChallengeMethod;
import com.tribufu.generated.models.ResponseType;
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;
/**
* AuthorizeRequest
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class AuthorizeRequest {
public static final String SERIALIZED_NAME_RESPONSE_TYPE = "response_type";
@SerializedName(SERIALIZED_NAME_RESPONSE_TYPE)
@javax.annotation.Nullable
private ResponseType responseType;
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_CODE_CHALLENGE = "code_challenge";
@SerializedName(SERIALIZED_NAME_CODE_CHALLENGE)
@javax.annotation.Nullable
private String codeChallenge;
public static final String SERIALIZED_NAME_CODE_CHALLENGE_METHOD = "code_challenge_method";
@SerializedName(SERIALIZED_NAME_CODE_CHALLENGE_METHOD)
@javax.annotation.Nullable
private CodeChallengeMethod codeChallengeMethod;
public static final String SERIALIZED_NAME_REDIRECT_URI = "redirect_uri";
@SerializedName(SERIALIZED_NAME_REDIRECT_URI)
@javax.annotation.Nullable
private String redirectUri;
public static final String SERIALIZED_NAME_SCOPE = "scope";
@SerializedName(SERIALIZED_NAME_SCOPE)
@javax.annotation.Nullable
private String scope;
public static final String SERIALIZED_NAME_STATE = "state";
@SerializedName(SERIALIZED_NAME_STATE)
@javax.annotation.Nullable
private String state;
public AuthorizeRequest() {
}
public AuthorizeRequest responseType(@javax.annotation.Nullable ResponseType responseType) {
this.responseType = responseType;
return this;
}
/**
* Get responseType
* @return responseType
*/
@javax.annotation.Nullable
public ResponseType getResponseType() {
return responseType;
}
public void setResponseType(@javax.annotation.Nullable ResponseType responseType) {
this.responseType = responseType;
}
public AuthorizeRequest 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 AuthorizeRequest codeChallenge(@javax.annotation.Nullable String codeChallenge) {
this.codeChallenge = codeChallenge;
return this;
}
/**
* Get codeChallenge
* @return codeChallenge
*/
@javax.annotation.Nullable
public String getCodeChallenge() {
return codeChallenge;
}
public void setCodeChallenge(@javax.annotation.Nullable String codeChallenge) {
this.codeChallenge = codeChallenge;
}
public AuthorizeRequest codeChallengeMethod(@javax.annotation.Nullable CodeChallengeMethod codeChallengeMethod) {
this.codeChallengeMethod = codeChallengeMethod;
return this;
}
/**
* Get codeChallengeMethod
* @return codeChallengeMethod
*/
@javax.annotation.Nullable
public CodeChallengeMethod getCodeChallengeMethod() {
return codeChallengeMethod;
}
public void setCodeChallengeMethod(@javax.annotation.Nullable CodeChallengeMethod codeChallengeMethod) {
this.codeChallengeMethod = codeChallengeMethod;
}
public AuthorizeRequest redirectUri(@javax.annotation.Nullable String redirectUri) {
this.redirectUri = redirectUri;
return this;
}
/**
* Get redirectUri
* @return redirectUri
*/
@javax.annotation.Nullable
public String getRedirectUri() {
return redirectUri;
}
public void setRedirectUri(@javax.annotation.Nullable String redirectUri) {
this.redirectUri = redirectUri;
}
public AuthorizeRequest 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 AuthorizeRequest state(@javax.annotation.Nullable String state) {
this.state = state;
return this;
}
/**
* Get state
* @return state
*/
@javax.annotation.Nullable
public String getState() {
return state;
}
public void setState(@javax.annotation.Nullable String state) {
this.state = state;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
AuthorizeRequest authorizeRequest = (AuthorizeRequest) o;
return Objects.equals(this.responseType, authorizeRequest.responseType) &&
Objects.equals(this.clientId, authorizeRequest.clientId) &&
Objects.equals(this.codeChallenge, authorizeRequest.codeChallenge) &&
Objects.equals(this.codeChallengeMethod, authorizeRequest.codeChallengeMethod) &&
Objects.equals(this.redirectUri, authorizeRequest.redirectUri) &&
Objects.equals(this.scope, authorizeRequest.scope) &&
Objects.equals(this.state, authorizeRequest.state);
}
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(responseType, clientId, codeChallenge, codeChallengeMethod, redirectUri, scope, state);
}
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 AuthorizeRequest {\n");
sb.append(" responseType: ").append(toIndentedString(responseType)).append("\n");
sb.append(" clientId: ").append(toIndentedString(clientId)).append("\n");
sb.append(" codeChallenge: ").append(toIndentedString(codeChallenge)).append("\n");
sb.append(" codeChallengeMethod: ").append(toIndentedString(codeChallengeMethod)).append("\n");
sb.append(" redirectUri: ").append(toIndentedString(redirectUri)).append("\n");
sb.append(" scope: ").append(toIndentedString(scope)).append("\n");
sb.append(" state: ").append(toIndentedString(state)).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("response_type");
openapiFields.add("client_id");
openapiFields.add("code_challenge");
openapiFields.add("code_challenge_method");
openapiFields.add("redirect_uri");
openapiFields.add("scope");
openapiFields.add("state");
// 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 AuthorizeRequest
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!AuthorizeRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in AuthorizeRequest is not found in the empty JSON string", AuthorizeRequest.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 (!AuthorizeRequest.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuthorizeRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
// validate the optional field `response_type`
if (jsonObj.get("response_type") != null && !jsonObj.get("response_type").isJsonNull()) {
ResponseType.validateJsonElement(jsonObj.get("response_type"));
}
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("code_challenge") != null && !jsonObj.get("code_challenge").isJsonNull()) && !jsonObj.get("code_challenge").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `code_challenge` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code_challenge").toString()));
}
// validate the optional field `code_challenge_method`
if (jsonObj.get("code_challenge_method") != null && !jsonObj.get("code_challenge_method").isJsonNull()) {
CodeChallengeMethod.validateJsonElement(jsonObj.get("code_challenge_method"));
}
if ((jsonObj.get("redirect_uri") != null && !jsonObj.get("redirect_uri").isJsonNull()) && !jsonObj.get("redirect_uri").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `redirect_uri` to be a primitive type in the JSON string but got `%s`", jsonObj.get("redirect_uri").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("state") != null && !jsonObj.get("state").isJsonNull()) && !jsonObj.get("state").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!AuthorizeRequest.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'AuthorizeRequest' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<AuthorizeRequest> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(AuthorizeRequest.class));
return (TypeAdapter<T>) new TypeAdapter<AuthorizeRequest>() {
@Override
public void write(JsonWriter out, AuthorizeRequest value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public AuthorizeRequest read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of AuthorizeRequest given an JSON string
*
* @param jsonString JSON string
* @return An instance of AuthorizeRequest
* @throws IOException if the JSON string is invalid with respect to AuthorizeRequest
*/
public static AuthorizeRequest fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, AuthorizeRequest.class);
}
/**
* Convert an instance of AuthorizeRequest to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,78 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.annotations.SerializedName;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* Gets or Sets CodeChallengeMethod
*/
@JsonAdapter(CodeChallengeMethod.Adapter.class)
public enum CodeChallengeMethod {
PLAIN("plain"),
S256("S256");
private String value;
CodeChallengeMethod(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static CodeChallengeMethod fromValue(String value) {
for (CodeChallengeMethod b : CodeChallengeMethod.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter<CodeChallengeMethod> {
@Override
public void write(final JsonWriter jsonWriter, final CodeChallengeMethod enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public CodeChallengeMethod read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return CodeChallengeMethod.fromValue(value);
}
}
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
CodeChallengeMethod.fromValue(value);
}
}

View file

@ -0,0 +1,248 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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;
/**
* CryptoViewModel
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class CryptoViewModel {
public static final String SERIALIZED_NAME_ENCODED = "encoded";
@SerializedName(SERIALIZED_NAME_ENCODED)
@javax.annotation.Nullable
private String encoded;
public static final String SERIALIZED_NAME_DECODED = "decoded";
@SerializedName(SERIALIZED_NAME_DECODED)
@javax.annotation.Nullable
private String decoded;
public CryptoViewModel() {
}
public CryptoViewModel encoded(@javax.annotation.Nullable String encoded) {
this.encoded = encoded;
return this;
}
/**
* Get encoded
* @return encoded
*/
@javax.annotation.Nullable
public String getEncoded() {
return encoded;
}
public void setEncoded(@javax.annotation.Nullable String encoded) {
this.encoded = encoded;
}
public CryptoViewModel decoded(@javax.annotation.Nullable String decoded) {
this.decoded = decoded;
return this;
}
/**
* Get decoded
* @return decoded
*/
@javax.annotation.Nullable
public String getDecoded() {
return decoded;
}
public void setDecoded(@javax.annotation.Nullable String decoded) {
this.decoded = decoded;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CryptoViewModel cryptoViewModel = (CryptoViewModel) o;
return Objects.equals(this.encoded, cryptoViewModel.encoded) &&
Objects.equals(this.decoded, cryptoViewModel.decoded);
}
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(encoded, decoded);
}
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 CryptoViewModel {\n");
sb.append(" encoded: ").append(toIndentedString(encoded)).append("\n");
sb.append(" decoded: ").append(toIndentedString(decoded)).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("encoded");
openapiFields.add("decoded");
// 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 CryptoViewModel
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!CryptoViewModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in CryptoViewModel is not found in the empty JSON string", CryptoViewModel.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 (!CryptoViewModel.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CryptoViewModel` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("encoded") != null && !jsonObj.get("encoded").isJsonNull()) && !jsonObj.get("encoded").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `encoded` to be a primitive type in the JSON string but got `%s`", jsonObj.get("encoded").toString()));
}
if ((jsonObj.get("decoded") != null && !jsonObj.get("decoded").isJsonNull()) && !jsonObj.get("decoded").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `decoded` to be a primitive type in the JSON string but got `%s`", jsonObj.get("decoded").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!CryptoViewModel.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'CryptoViewModel' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<CryptoViewModel> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(CryptoViewModel.class));
return (TypeAdapter<T>) new TypeAdapter<CryptoViewModel>() {
@Override
public void write(JsonWriter out, CryptoViewModel value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public CryptoViewModel read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of CryptoViewModel given an JSON string
*
* @param jsonString JSON string
* @return An instance of CryptoViewModel
* @throws IOException if the JSON string is invalid with respect to CryptoViewModel
*/
public static CryptoViewModel fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, CryptoViewModel.class);
}
/**
* Convert an instance of CryptoViewModel to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,598 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.net.URI;
import java.time.OffsetDateTime;
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;
/**
* GameServerCluster
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class GameServerCluster {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
@javax.annotation.Nullable
private String id;
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
@javax.annotation.Nullable
private String name;
public static final String SERIALIZED_NAME_DESCRIPTION = "description";
@SerializedName(SERIALIZED_NAME_DESCRIPTION)
@javax.annotation.Nullable
private String description;
public static final String SERIALIZED_NAME_GAME_ID = "game_id";
@SerializedName(SERIALIZED_NAME_GAME_ID)
@javax.annotation.Nullable
private String gameId;
public static final String SERIALIZED_NAME_WEBSITE_URL = "website_url";
@SerializedName(SERIALIZED_NAME_WEBSITE_URL)
@javax.annotation.Nullable
private String websiteUrl;
public static final String SERIALIZED_NAME_BANNER_URL = "banner_url";
@SerializedName(SERIALIZED_NAME_BANNER_URL)
@javax.annotation.Nullable
private URI bannerUrl;
public static final String SERIALIZED_NAME_OWNER_ID = "owner_id";
@SerializedName(SERIALIZED_NAME_OWNER_ID)
@javax.annotation.Nullable
private String ownerId;
public static final String SERIALIZED_NAME_DISCORD_SERVER_ID = "discord_server_id";
@SerializedName(SERIALIZED_NAME_DISCORD_SERVER_ID)
@javax.annotation.Nullable
private String discordServerId;
public static final String SERIALIZED_NAME_YOUTUBE_VIDEO_URL = "youtube_video_url";
@SerializedName(SERIALIZED_NAME_YOUTUBE_VIDEO_URL)
@javax.annotation.Nullable
private String youtubeVideoUrl;
public static final String SERIALIZED_NAME_TAGS = "tags";
@SerializedName(SERIALIZED_NAME_TAGS)
@javax.annotation.Nullable
private String tags;
public static final String SERIALIZED_NAME_COMMENT_COUNT = "comment_count";
@SerializedName(SERIALIZED_NAME_COMMENT_COUNT)
@javax.annotation.Nullable
private Integer commentCount;
public static final String SERIALIZED_NAME_SERVER_COUNT = "server_count";
@SerializedName(SERIALIZED_NAME_SERVER_COUNT)
@javax.annotation.Nullable
private Integer serverCount;
public static final String SERIALIZED_NAME_CREATED = "created";
@SerializedName(SERIALIZED_NAME_CREATED)
@javax.annotation.Nullable
private OffsetDateTime created;
public static final String SERIALIZED_NAME_UPDATED = "updated";
@SerializedName(SERIALIZED_NAME_UPDATED)
@javax.annotation.Nullable
private OffsetDateTime updated;
public GameServerCluster() {
}
public GameServerCluster id(@javax.annotation.Nullable String id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@javax.annotation.Nullable
public String getId() {
return id;
}
public void setId(@javax.annotation.Nullable String id) {
this.id = id;
}
public GameServerCluster name(@javax.annotation.Nullable String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
*/
@javax.annotation.Nullable
public String getName() {
return name;
}
public void setName(@javax.annotation.Nullable String name) {
this.name = name;
}
public GameServerCluster description(@javax.annotation.Nullable String description) {
this.description = description;
return this;
}
/**
* Get description
* @return description
*/
@javax.annotation.Nullable
public String getDescription() {
return description;
}
public void setDescription(@javax.annotation.Nullable String description) {
this.description = description;
}
public GameServerCluster gameId(@javax.annotation.Nullable String gameId) {
this.gameId = gameId;
return this;
}
/**
* Get gameId
* @return gameId
*/
@javax.annotation.Nullable
public String getGameId() {
return gameId;
}
public void setGameId(@javax.annotation.Nullable String gameId) {
this.gameId = gameId;
}
public GameServerCluster websiteUrl(@javax.annotation.Nullable String websiteUrl) {
this.websiteUrl = websiteUrl;
return this;
}
/**
* Get websiteUrl
* @return websiteUrl
*/
@javax.annotation.Nullable
public String getWebsiteUrl() {
return websiteUrl;
}
public void setWebsiteUrl(@javax.annotation.Nullable String websiteUrl) {
this.websiteUrl = websiteUrl;
}
public GameServerCluster bannerUrl(@javax.annotation.Nullable URI bannerUrl) {
this.bannerUrl = bannerUrl;
return this;
}
/**
* Get bannerUrl
* @return bannerUrl
*/
@javax.annotation.Nullable
public URI getBannerUrl() {
return bannerUrl;
}
public void setBannerUrl(@javax.annotation.Nullable URI bannerUrl) {
this.bannerUrl = bannerUrl;
}
public GameServerCluster ownerId(@javax.annotation.Nullable String ownerId) {
this.ownerId = ownerId;
return this;
}
/**
* Get ownerId
* @return ownerId
*/
@javax.annotation.Nullable
public String getOwnerId() {
return ownerId;
}
public void setOwnerId(@javax.annotation.Nullable String ownerId) {
this.ownerId = ownerId;
}
public GameServerCluster discordServerId(@javax.annotation.Nullable String discordServerId) {
this.discordServerId = discordServerId;
return this;
}
/**
* Get discordServerId
* @return discordServerId
*/
@javax.annotation.Nullable
public String getDiscordServerId() {
return discordServerId;
}
public void setDiscordServerId(@javax.annotation.Nullable String discordServerId) {
this.discordServerId = discordServerId;
}
public GameServerCluster youtubeVideoUrl(@javax.annotation.Nullable String youtubeVideoUrl) {
this.youtubeVideoUrl = youtubeVideoUrl;
return this;
}
/**
* Get youtubeVideoUrl
* @return youtubeVideoUrl
*/
@javax.annotation.Nullable
public String getYoutubeVideoUrl() {
return youtubeVideoUrl;
}
public void setYoutubeVideoUrl(@javax.annotation.Nullable String youtubeVideoUrl) {
this.youtubeVideoUrl = youtubeVideoUrl;
}
public GameServerCluster tags(@javax.annotation.Nullable String tags) {
this.tags = tags;
return this;
}
/**
* Get tags
* @return tags
*/
@javax.annotation.Nullable
public String getTags() {
return tags;
}
public void setTags(@javax.annotation.Nullable String tags) {
this.tags = tags;
}
public GameServerCluster commentCount(@javax.annotation.Nullable Integer commentCount) {
this.commentCount = commentCount;
return this;
}
/**
* Get commentCount
* @return commentCount
*/
@javax.annotation.Nullable
public Integer getCommentCount() {
return commentCount;
}
public void setCommentCount(@javax.annotation.Nullable Integer commentCount) {
this.commentCount = commentCount;
}
public GameServerCluster serverCount(@javax.annotation.Nullable Integer serverCount) {
this.serverCount = serverCount;
return this;
}
/**
* Get serverCount
* @return serverCount
*/
@javax.annotation.Nullable
public Integer getServerCount() {
return serverCount;
}
public void setServerCount(@javax.annotation.Nullable Integer serverCount) {
this.serverCount = serverCount;
}
public GameServerCluster created(@javax.annotation.Nullable OffsetDateTime created) {
this.created = created;
return this;
}
/**
* Get created
* @return created
*/
@javax.annotation.Nullable
public OffsetDateTime getCreated() {
return created;
}
public void setCreated(@javax.annotation.Nullable OffsetDateTime created) {
this.created = created;
}
public GameServerCluster updated(@javax.annotation.Nullable OffsetDateTime updated) {
this.updated = updated;
return this;
}
/**
* Get updated
* @return updated
*/
@javax.annotation.Nullable
public OffsetDateTime getUpdated() {
return updated;
}
public void setUpdated(@javax.annotation.Nullable OffsetDateTime updated) {
this.updated = updated;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
GameServerCluster gameServerCluster = (GameServerCluster) o;
return Objects.equals(this.id, gameServerCluster.id) &&
Objects.equals(this.name, gameServerCluster.name) &&
Objects.equals(this.description, gameServerCluster.description) &&
Objects.equals(this.gameId, gameServerCluster.gameId) &&
Objects.equals(this.websiteUrl, gameServerCluster.websiteUrl) &&
Objects.equals(this.bannerUrl, gameServerCluster.bannerUrl) &&
Objects.equals(this.ownerId, gameServerCluster.ownerId) &&
Objects.equals(this.discordServerId, gameServerCluster.discordServerId) &&
Objects.equals(this.youtubeVideoUrl, gameServerCluster.youtubeVideoUrl) &&
Objects.equals(this.tags, gameServerCluster.tags) &&
Objects.equals(this.commentCount, gameServerCluster.commentCount) &&
Objects.equals(this.serverCount, gameServerCluster.serverCount) &&
Objects.equals(this.created, gameServerCluster.created) &&
Objects.equals(this.updated, gameServerCluster.updated);
}
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(id, name, description, gameId, websiteUrl, bannerUrl, ownerId, discordServerId, youtubeVideoUrl, tags, commentCount, serverCount, created, updated);
}
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 GameServerCluster {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" gameId: ").append(toIndentedString(gameId)).append("\n");
sb.append(" websiteUrl: ").append(toIndentedString(websiteUrl)).append("\n");
sb.append(" bannerUrl: ").append(toIndentedString(bannerUrl)).append("\n");
sb.append(" ownerId: ").append(toIndentedString(ownerId)).append("\n");
sb.append(" discordServerId: ").append(toIndentedString(discordServerId)).append("\n");
sb.append(" youtubeVideoUrl: ").append(toIndentedString(youtubeVideoUrl)).append("\n");
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
sb.append(" commentCount: ").append(toIndentedString(commentCount)).append("\n");
sb.append(" serverCount: ").append(toIndentedString(serverCount)).append("\n");
sb.append(" created: ").append(toIndentedString(created)).append("\n");
sb.append(" updated: ").append(toIndentedString(updated)).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("id");
openapiFields.add("name");
openapiFields.add("description");
openapiFields.add("game_id");
openapiFields.add("website_url");
openapiFields.add("banner_url");
openapiFields.add("owner_id");
openapiFields.add("discord_server_id");
openapiFields.add("youtube_video_url");
openapiFields.add("tags");
openapiFields.add("comment_count");
openapiFields.add("server_count");
openapiFields.add("created");
openapiFields.add("updated");
// 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 GameServerCluster
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!GameServerCluster.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in GameServerCluster is not found in the empty JSON string", GameServerCluster.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 (!GameServerCluster.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GameServerCluster` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString()));
}
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
}
if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString()));
}
if ((jsonObj.get("game_id") != null && !jsonObj.get("game_id").isJsonNull()) && !jsonObj.get("game_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `game_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("game_id").toString()));
}
if ((jsonObj.get("website_url") != null && !jsonObj.get("website_url").isJsonNull()) && !jsonObj.get("website_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `website_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("website_url").toString()));
}
if ((jsonObj.get("banner_url") != null && !jsonObj.get("banner_url").isJsonNull()) && !jsonObj.get("banner_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `banner_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("banner_url").toString()));
}
if ((jsonObj.get("owner_id") != null && !jsonObj.get("owner_id").isJsonNull()) && !jsonObj.get("owner_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `owner_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("owner_id").toString()));
}
if ((jsonObj.get("discord_server_id") != null && !jsonObj.get("discord_server_id").isJsonNull()) && !jsonObj.get("discord_server_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `discord_server_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("discord_server_id").toString()));
}
if ((jsonObj.get("youtube_video_url") != null && !jsonObj.get("youtube_video_url").isJsonNull()) && !jsonObj.get("youtube_video_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `youtube_video_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("youtube_video_url").toString()));
}
if ((jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) && !jsonObj.get("tags").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `tags` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tags").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!GameServerCluster.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'GameServerCluster' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<GameServerCluster> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(GameServerCluster.class));
return (TypeAdapter<T>) new TypeAdapter<GameServerCluster>() {
@Override
public void write(JsonWriter out, GameServerCluster value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public GameServerCluster read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of GameServerCluster given an JSON string
*
* @param jsonString JSON string
* @return An instance of GameServerCluster
* @throws IOException if the JSON string is invalid with respect to GameServerCluster
*/
public static GameServerCluster fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, GameServerCluster.class);
}
/**
* Convert an instance of GameServerCluster to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,82 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.annotations.SerializedName;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* Gets or Sets GrantType
*/
@JsonAdapter(GrantType.Adapter.class)
public enum GrantType {
AUTHORIZATION_CODE("authorization_code"),
CLIENT_CREDENTIALS("client_credentials"),
PASSWORD("password"),
REFRESH_TOKEN("refresh_token");
private String value;
GrantType(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static GrantType fromValue(String value) {
for (GrantType b : GrantType.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter<GrantType> {
@Override
public void write(final JsonWriter jsonWriter, final GrantType enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public GrantType read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return GrantType.fromValue(value);
}
}
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
GrantType.fromValue(value);
}
}

View file

@ -0,0 +1,646 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.time.OffsetDateTime;
import java.util.Arrays;
import java.util.UUID;
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;
/**
* Group
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class Group {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
@javax.annotation.Nullable
private String id;
public static final String SERIALIZED_NAME_UUID = "uuid";
@SerializedName(SERIALIZED_NAME_UUID)
@javax.annotation.Nullable
private UUID uuid;
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
@javax.annotation.Nullable
private String name;
public static final String SERIALIZED_NAME_TAG = "tag";
@SerializedName(SERIALIZED_NAME_TAG)
@javax.annotation.Nullable
private String tag;
public static final String SERIALIZED_NAME_DESCRIPTION = "description";
@SerializedName(SERIALIZED_NAME_DESCRIPTION)
@javax.annotation.Nullable
private String description;
public static final String SERIALIZED_NAME_TYPE = "type";
@SerializedName(SERIALIZED_NAME_TYPE)
@javax.annotation.Nullable
private Integer type;
public static final String SERIALIZED_NAME_PRIVACY = "privacy";
@SerializedName(SERIALIZED_NAME_PRIVACY)
@javax.annotation.Nullable
private Integer privacy;
public static final String SERIALIZED_NAME_OWNER_ID = "owner_id";
@SerializedName(SERIALIZED_NAME_OWNER_ID)
@javax.annotation.Nullable
private String ownerId;
public static final String SERIALIZED_NAME_VERIFIED = "verified";
@SerializedName(SERIALIZED_NAME_VERIFIED)
@javax.annotation.Nullable
private Boolean verified;
public static final String SERIALIZED_NAME_PHOTO_URL = "photo_url";
@SerializedName(SERIALIZED_NAME_PHOTO_URL)
@javax.annotation.Nullable
private String photoUrl;
public static final String SERIALIZED_NAME_BANNER_URL = "banner_url";
@SerializedName(SERIALIZED_NAME_BANNER_URL)
@javax.annotation.Nullable
private String bannerUrl;
public static final String SERIALIZED_NAME_MEMBER_COUNT = "member_count";
@SerializedName(SERIALIZED_NAME_MEMBER_COUNT)
@javax.annotation.Nullable
private Integer memberCount;
public static final String SERIALIZED_NAME_FOLLOWER_COUNT = "follower_count";
@SerializedName(SERIALIZED_NAME_FOLLOWER_COUNT)
@javax.annotation.Nullable
private Integer followerCount;
public static final String SERIALIZED_NAME_VIEW_COUNT = "view_count";
@SerializedName(SERIALIZED_NAME_VIEW_COUNT)
@javax.annotation.Nullable
private Integer viewCount;
public static final String SERIALIZED_NAME_CREATED = "created";
@SerializedName(SERIALIZED_NAME_CREATED)
@javax.annotation.Nullable
private OffsetDateTime created;
public static final String SERIALIZED_NAME_UPDATED = "updated";
@SerializedName(SERIALIZED_NAME_UPDATED)
@javax.annotation.Nullable
private OffsetDateTime updated;
public Group() {
}
public Group id(@javax.annotation.Nullable String id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@javax.annotation.Nullable
public String getId() {
return id;
}
public void setId(@javax.annotation.Nullable String id) {
this.id = id;
}
public Group uuid(@javax.annotation.Nullable UUID uuid) {
this.uuid = uuid;
return this;
}
/**
* Get uuid
* @return uuid
*/
@javax.annotation.Nullable
public UUID getUuid() {
return uuid;
}
public void setUuid(@javax.annotation.Nullable UUID uuid) {
this.uuid = uuid;
}
public Group name(@javax.annotation.Nullable String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
*/
@javax.annotation.Nullable
public String getName() {
return name;
}
public void setName(@javax.annotation.Nullable String name) {
this.name = name;
}
public Group tag(@javax.annotation.Nullable String tag) {
this.tag = tag;
return this;
}
/**
* Get tag
* @return tag
*/
@javax.annotation.Nullable
public String getTag() {
return tag;
}
public void setTag(@javax.annotation.Nullable String tag) {
this.tag = tag;
}
public Group description(@javax.annotation.Nullable String description) {
this.description = description;
return this;
}
/**
* Get description
* @return description
*/
@javax.annotation.Nullable
public String getDescription() {
return description;
}
public void setDescription(@javax.annotation.Nullable String description) {
this.description = description;
}
public Group type(@javax.annotation.Nullable Integer type) {
this.type = type;
return this;
}
/**
* Get type
* @return type
*/
@javax.annotation.Nullable
public Integer getType() {
return type;
}
public void setType(@javax.annotation.Nullable Integer type) {
this.type = type;
}
public Group privacy(@javax.annotation.Nullable Integer privacy) {
this.privacy = privacy;
return this;
}
/**
* Get privacy
* @return privacy
*/
@javax.annotation.Nullable
public Integer getPrivacy() {
return privacy;
}
public void setPrivacy(@javax.annotation.Nullable Integer privacy) {
this.privacy = privacy;
}
public Group ownerId(@javax.annotation.Nullable String ownerId) {
this.ownerId = ownerId;
return this;
}
/**
* Get ownerId
* @return ownerId
*/
@javax.annotation.Nullable
public String getOwnerId() {
return ownerId;
}
public void setOwnerId(@javax.annotation.Nullable String ownerId) {
this.ownerId = ownerId;
}
public Group verified(@javax.annotation.Nullable Boolean verified) {
this.verified = verified;
return this;
}
/**
* Get verified
* @return verified
*/
@javax.annotation.Nullable
public Boolean getVerified() {
return verified;
}
public void setVerified(@javax.annotation.Nullable Boolean verified) {
this.verified = verified;
}
public Group photoUrl(@javax.annotation.Nullable String photoUrl) {
this.photoUrl = photoUrl;
return this;
}
/**
* Get photoUrl
* @return photoUrl
*/
@javax.annotation.Nullable
public String getPhotoUrl() {
return photoUrl;
}
public void setPhotoUrl(@javax.annotation.Nullable String photoUrl) {
this.photoUrl = photoUrl;
}
public Group bannerUrl(@javax.annotation.Nullable String bannerUrl) {
this.bannerUrl = bannerUrl;
return this;
}
/**
* Get bannerUrl
* @return bannerUrl
*/
@javax.annotation.Nullable
public String getBannerUrl() {
return bannerUrl;
}
public void setBannerUrl(@javax.annotation.Nullable String bannerUrl) {
this.bannerUrl = bannerUrl;
}
public Group memberCount(@javax.annotation.Nullable Integer memberCount) {
this.memberCount = memberCount;
return this;
}
/**
* Get memberCount
* @return memberCount
*/
@javax.annotation.Nullable
public Integer getMemberCount() {
return memberCount;
}
public void setMemberCount(@javax.annotation.Nullable Integer memberCount) {
this.memberCount = memberCount;
}
public Group followerCount(@javax.annotation.Nullable Integer followerCount) {
this.followerCount = followerCount;
return this;
}
/**
* Get followerCount
* @return followerCount
*/
@javax.annotation.Nullable
public Integer getFollowerCount() {
return followerCount;
}
public void setFollowerCount(@javax.annotation.Nullable Integer followerCount) {
this.followerCount = followerCount;
}
public Group viewCount(@javax.annotation.Nullable Integer viewCount) {
this.viewCount = viewCount;
return this;
}
/**
* Get viewCount
* @return viewCount
*/
@javax.annotation.Nullable
public Integer getViewCount() {
return viewCount;
}
public void setViewCount(@javax.annotation.Nullable Integer viewCount) {
this.viewCount = viewCount;
}
public Group created(@javax.annotation.Nullable OffsetDateTime created) {
this.created = created;
return this;
}
/**
* Get created
* @return created
*/
@javax.annotation.Nullable
public OffsetDateTime getCreated() {
return created;
}
public void setCreated(@javax.annotation.Nullable OffsetDateTime created) {
this.created = created;
}
public Group updated(@javax.annotation.Nullable OffsetDateTime updated) {
this.updated = updated;
return this;
}
/**
* Get updated
* @return updated
*/
@javax.annotation.Nullable
public OffsetDateTime getUpdated() {
return updated;
}
public void setUpdated(@javax.annotation.Nullable OffsetDateTime updated) {
this.updated = updated;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Group group = (Group) o;
return Objects.equals(this.id, group.id) &&
Objects.equals(this.uuid, group.uuid) &&
Objects.equals(this.name, group.name) &&
Objects.equals(this.tag, group.tag) &&
Objects.equals(this.description, group.description) &&
Objects.equals(this.type, group.type) &&
Objects.equals(this.privacy, group.privacy) &&
Objects.equals(this.ownerId, group.ownerId) &&
Objects.equals(this.verified, group.verified) &&
Objects.equals(this.photoUrl, group.photoUrl) &&
Objects.equals(this.bannerUrl, group.bannerUrl) &&
Objects.equals(this.memberCount, group.memberCount) &&
Objects.equals(this.followerCount, group.followerCount) &&
Objects.equals(this.viewCount, group.viewCount) &&
Objects.equals(this.created, group.created) &&
Objects.equals(this.updated, group.updated);
}
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(id, uuid, name, tag, description, type, privacy, ownerId, verified, photoUrl, bannerUrl, memberCount, followerCount, viewCount, created, updated);
}
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 Group {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" tag: ").append(toIndentedString(tag)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" privacy: ").append(toIndentedString(privacy)).append("\n");
sb.append(" ownerId: ").append(toIndentedString(ownerId)).append("\n");
sb.append(" verified: ").append(toIndentedString(verified)).append("\n");
sb.append(" photoUrl: ").append(toIndentedString(photoUrl)).append("\n");
sb.append(" bannerUrl: ").append(toIndentedString(bannerUrl)).append("\n");
sb.append(" memberCount: ").append(toIndentedString(memberCount)).append("\n");
sb.append(" followerCount: ").append(toIndentedString(followerCount)).append("\n");
sb.append(" viewCount: ").append(toIndentedString(viewCount)).append("\n");
sb.append(" created: ").append(toIndentedString(created)).append("\n");
sb.append(" updated: ").append(toIndentedString(updated)).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("id");
openapiFields.add("uuid");
openapiFields.add("name");
openapiFields.add("tag");
openapiFields.add("description");
openapiFields.add("type");
openapiFields.add("privacy");
openapiFields.add("owner_id");
openapiFields.add("verified");
openapiFields.add("photo_url");
openapiFields.add("banner_url");
openapiFields.add("member_count");
openapiFields.add("follower_count");
openapiFields.add("view_count");
openapiFields.add("created");
openapiFields.add("updated");
// 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 Group
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!Group.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in Group is not found in the empty JSON string", Group.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 (!Group.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Group` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString()));
}
if ((jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString()));
}
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
}
if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString()));
}
if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString()));
}
if ((jsonObj.get("owner_id") != null && !jsonObj.get("owner_id").isJsonNull()) && !jsonObj.get("owner_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `owner_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("owner_id").toString()));
}
if ((jsonObj.get("photo_url") != null && !jsonObj.get("photo_url").isJsonNull()) && !jsonObj.get("photo_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `photo_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("photo_url").toString()));
}
if ((jsonObj.get("banner_url") != null && !jsonObj.get("banner_url").isJsonNull()) && !jsonObj.get("banner_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `banner_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("banner_url").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!Group.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'Group' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<Group> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(Group.class));
return (TypeAdapter<T>) new TypeAdapter<Group>() {
@Override
public void write(JsonWriter out, Group value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public Group read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of Group given an JSON string
*
* @param jsonString JSON string
* @return An instance of Group
* @throws IOException if the JSON string is invalid with respect to Group
*/
public static Group fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, Group.class);
}
/**
* Convert an instance of Group to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,394 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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 com.tribufu.generated.models.Application;
import com.tribufu.generated.models.Group;
import java.io.IOException;
import java.time.OffsetDateTime;
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;
/**
* GroupGame
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class GroupGame {
public static final String SERIALIZED_NAME_GROUP_ID = "group_id";
@SerializedName(SERIALIZED_NAME_GROUP_ID)
@javax.annotation.Nullable
private String groupId;
public static final String SERIALIZED_NAME_GROUP = "group";
@SerializedName(SERIALIZED_NAME_GROUP)
@javax.annotation.Nullable
private Group group;
public static final String SERIALIZED_NAME_APPLICATION_ID = "application_id";
@SerializedName(SERIALIZED_NAME_APPLICATION_ID)
@javax.annotation.Nullable
private String applicationId;
public static final String SERIALIZED_NAME_APPLICATION = "application";
@SerializedName(SERIALIZED_NAME_APPLICATION)
@javax.annotation.Nullable
private Application application;
public static final String SERIALIZED_NAME_STATS = "stats";
@SerializedName(SERIALIZED_NAME_STATS)
@javax.annotation.Nullable
private Object stats = null;
public static final String SERIALIZED_NAME_ACQUIRED = "acquired";
@SerializedName(SERIALIZED_NAME_ACQUIRED)
@javax.annotation.Nullable
private OffsetDateTime acquired;
public static final String SERIALIZED_NAME_LAST_USED = "last_used";
@SerializedName(SERIALIZED_NAME_LAST_USED)
@javax.annotation.Nullable
private OffsetDateTime lastUsed;
public GroupGame() {
}
public GroupGame groupId(@javax.annotation.Nullable String groupId) {
this.groupId = groupId;
return this;
}
/**
* Get groupId
* @return groupId
*/
@javax.annotation.Nullable
public String getGroupId() {
return groupId;
}
public void setGroupId(@javax.annotation.Nullable String groupId) {
this.groupId = groupId;
}
public GroupGame group(@javax.annotation.Nullable Group group) {
this.group = group;
return this;
}
/**
* Get group
* @return group
*/
@javax.annotation.Nullable
public Group getGroup() {
return group;
}
public void setGroup(@javax.annotation.Nullable Group group) {
this.group = group;
}
public GroupGame applicationId(@javax.annotation.Nullable String applicationId) {
this.applicationId = applicationId;
return this;
}
/**
* Get applicationId
* @return applicationId
*/
@javax.annotation.Nullable
public String getApplicationId() {
return applicationId;
}
public void setApplicationId(@javax.annotation.Nullable String applicationId) {
this.applicationId = applicationId;
}
public GroupGame application(@javax.annotation.Nullable Application application) {
this.application = application;
return this;
}
/**
* Get application
* @return application
*/
@javax.annotation.Nullable
public Application getApplication() {
return application;
}
public void setApplication(@javax.annotation.Nullable Application application) {
this.application = application;
}
public GroupGame stats(@javax.annotation.Nullable Object stats) {
this.stats = stats;
return this;
}
/**
* Get stats
* @return stats
*/
@javax.annotation.Nullable
public Object getStats() {
return stats;
}
public void setStats(@javax.annotation.Nullable Object stats) {
this.stats = stats;
}
public GroupGame acquired(@javax.annotation.Nullable OffsetDateTime acquired) {
this.acquired = acquired;
return this;
}
/**
* Get acquired
* @return acquired
*/
@javax.annotation.Nullable
public OffsetDateTime getAcquired() {
return acquired;
}
public void setAcquired(@javax.annotation.Nullable OffsetDateTime acquired) {
this.acquired = acquired;
}
public GroupGame lastUsed(@javax.annotation.Nullable OffsetDateTime lastUsed) {
this.lastUsed = lastUsed;
return this;
}
/**
* Get lastUsed
* @return lastUsed
*/
@javax.annotation.Nullable
public OffsetDateTime getLastUsed() {
return lastUsed;
}
public void setLastUsed(@javax.annotation.Nullable OffsetDateTime lastUsed) {
this.lastUsed = lastUsed;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
GroupGame groupGame = (GroupGame) o;
return Objects.equals(this.groupId, groupGame.groupId) &&
Objects.equals(this.group, groupGame.group) &&
Objects.equals(this.applicationId, groupGame.applicationId) &&
Objects.equals(this.application, groupGame.application) &&
Objects.equals(this.stats, groupGame.stats) &&
Objects.equals(this.acquired, groupGame.acquired) &&
Objects.equals(this.lastUsed, groupGame.lastUsed);
}
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(groupId, group, applicationId, application, stats, acquired, lastUsed);
}
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 GroupGame {\n");
sb.append(" groupId: ").append(toIndentedString(groupId)).append("\n");
sb.append(" group: ").append(toIndentedString(group)).append("\n");
sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n");
sb.append(" application: ").append(toIndentedString(application)).append("\n");
sb.append(" stats: ").append(toIndentedString(stats)).append("\n");
sb.append(" acquired: ").append(toIndentedString(acquired)).append("\n");
sb.append(" lastUsed: ").append(toIndentedString(lastUsed)).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("group_id");
openapiFields.add("group");
openapiFields.add("application_id");
openapiFields.add("application");
openapiFields.add("stats");
openapiFields.add("acquired");
openapiFields.add("last_used");
// 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 GroupGame
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!GroupGame.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in GroupGame is not found in the empty JSON string", GroupGame.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 (!GroupGame.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GroupGame` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("group_id") != null && !jsonObj.get("group_id").isJsonNull()) && !jsonObj.get("group_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `group_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("group_id").toString()));
}
// validate the optional field `group`
if (jsonObj.get("group") != null && !jsonObj.get("group").isJsonNull()) {
Group.validateJsonElement(jsonObj.get("group"));
}
if ((jsonObj.get("application_id") != null && !jsonObj.get("application_id").isJsonNull()) && !jsonObj.get("application_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `application_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("application_id").toString()));
}
// validate the optional field `application`
if (jsonObj.get("application") != null && !jsonObj.get("application").isJsonNull()) {
Application.validateJsonElement(jsonObj.get("application"));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!GroupGame.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'GroupGame' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<GroupGame> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(GroupGame.class));
return (TypeAdapter<T>) new TypeAdapter<GroupGame>() {
@Override
public void write(JsonWriter out, GroupGame value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public GroupGame read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of GroupGame given an JSON string
*
* @param jsonString JSON string
* @return An instance of GroupGame
* @throws IOException if the JSON string is invalid with respect to GroupGame
*/
public static GroupGame fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, GroupGame.class);
}
/**
* Convert an instance of GroupGame to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,453 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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 com.tribufu.generated.models.GroupRank;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.Arrays;
import java.util.UUID;
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;
/**
* GroupMember
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class GroupMember {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
@javax.annotation.Nullable
private String id;
public static final String SERIALIZED_NAME_UUID = "uuid";
@SerializedName(SERIALIZED_NAME_UUID)
@javax.annotation.Nullable
private UUID uuid;
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
@javax.annotation.Nullable
private String name;
public static final String SERIALIZED_NAME_DISPLAY_NAME = "display_name";
@SerializedName(SERIALIZED_NAME_DISPLAY_NAME)
@javax.annotation.Nullable
private String displayName;
public static final String SERIALIZED_NAME_VERIFIED = "verified";
@SerializedName(SERIALIZED_NAME_VERIFIED)
@javax.annotation.Nullable
private Boolean verified;
public static final String SERIALIZED_NAME_PHOTO_URL = "photo_url";
@SerializedName(SERIALIZED_NAME_PHOTO_URL)
@javax.annotation.Nullable
private String photoUrl;
public static final String SERIALIZED_NAME_LAST_ONLINE = "last_online";
@SerializedName(SERIALIZED_NAME_LAST_ONLINE)
@javax.annotation.Nullable
private OffsetDateTime lastOnline;
public static final String SERIALIZED_NAME_RANK = "rank";
@SerializedName(SERIALIZED_NAME_RANK)
@javax.annotation.Nullable
private GroupRank rank;
public static final String SERIALIZED_NAME_SINCE = "since";
@SerializedName(SERIALIZED_NAME_SINCE)
@javax.annotation.Nullable
private OffsetDateTime since;
public GroupMember() {
}
public GroupMember id(@javax.annotation.Nullable String id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@javax.annotation.Nullable
public String getId() {
return id;
}
public void setId(@javax.annotation.Nullable String id) {
this.id = id;
}
public GroupMember uuid(@javax.annotation.Nullable UUID uuid) {
this.uuid = uuid;
return this;
}
/**
* Get uuid
* @return uuid
*/
@javax.annotation.Nullable
public UUID getUuid() {
return uuid;
}
public void setUuid(@javax.annotation.Nullable UUID uuid) {
this.uuid = uuid;
}
public GroupMember name(@javax.annotation.Nullable String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
*/
@javax.annotation.Nullable
public String getName() {
return name;
}
public void setName(@javax.annotation.Nullable String name) {
this.name = name;
}
public GroupMember displayName(@javax.annotation.Nullable String displayName) {
this.displayName = displayName;
return this;
}
/**
* Get displayName
* @return displayName
*/
@javax.annotation.Nullable
public String getDisplayName() {
return displayName;
}
public void setDisplayName(@javax.annotation.Nullable String displayName) {
this.displayName = displayName;
}
public GroupMember verified(@javax.annotation.Nullable Boolean verified) {
this.verified = verified;
return this;
}
/**
* Get verified
* @return verified
*/
@javax.annotation.Nullable
public Boolean getVerified() {
return verified;
}
public void setVerified(@javax.annotation.Nullable Boolean verified) {
this.verified = verified;
}
public GroupMember photoUrl(@javax.annotation.Nullable String photoUrl) {
this.photoUrl = photoUrl;
return this;
}
/**
* Get photoUrl
* @return photoUrl
*/
@javax.annotation.Nullable
public String getPhotoUrl() {
return photoUrl;
}
public void setPhotoUrl(@javax.annotation.Nullable String photoUrl) {
this.photoUrl = photoUrl;
}
public GroupMember lastOnline(@javax.annotation.Nullable OffsetDateTime lastOnline) {
this.lastOnline = lastOnline;
return this;
}
/**
* Get lastOnline
* @return lastOnline
*/
@javax.annotation.Nullable
public OffsetDateTime getLastOnline() {
return lastOnline;
}
public void setLastOnline(@javax.annotation.Nullable OffsetDateTime lastOnline) {
this.lastOnline = lastOnline;
}
public GroupMember rank(@javax.annotation.Nullable GroupRank rank) {
this.rank = rank;
return this;
}
/**
* Get rank
* @return rank
*/
@javax.annotation.Nullable
public GroupRank getRank() {
return rank;
}
public void setRank(@javax.annotation.Nullable GroupRank rank) {
this.rank = rank;
}
public GroupMember since(@javax.annotation.Nullable OffsetDateTime since) {
this.since = since;
return this;
}
/**
* Get since
* @return since
*/
@javax.annotation.Nullable
public OffsetDateTime getSince() {
return since;
}
public void setSince(@javax.annotation.Nullable OffsetDateTime since) {
this.since = since;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
GroupMember groupMember = (GroupMember) o;
return Objects.equals(this.id, groupMember.id) &&
Objects.equals(this.uuid, groupMember.uuid) &&
Objects.equals(this.name, groupMember.name) &&
Objects.equals(this.displayName, groupMember.displayName) &&
Objects.equals(this.verified, groupMember.verified) &&
Objects.equals(this.photoUrl, groupMember.photoUrl) &&
Objects.equals(this.lastOnline, groupMember.lastOnline) &&
Objects.equals(this.rank, groupMember.rank) &&
Objects.equals(this.since, groupMember.since);
}
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(id, uuid, name, displayName, verified, photoUrl, lastOnline, rank, since);
}
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 GroupMember {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n");
sb.append(" verified: ").append(toIndentedString(verified)).append("\n");
sb.append(" photoUrl: ").append(toIndentedString(photoUrl)).append("\n");
sb.append(" lastOnline: ").append(toIndentedString(lastOnline)).append("\n");
sb.append(" rank: ").append(toIndentedString(rank)).append("\n");
sb.append(" since: ").append(toIndentedString(since)).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("id");
openapiFields.add("uuid");
openapiFields.add("name");
openapiFields.add("display_name");
openapiFields.add("verified");
openapiFields.add("photo_url");
openapiFields.add("last_online");
openapiFields.add("rank");
openapiFields.add("since");
// 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 GroupMember
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!GroupMember.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in GroupMember is not found in the empty JSON string", GroupMember.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 (!GroupMember.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GroupMember` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString()));
}
if ((jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString()));
}
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
}
if ((jsonObj.get("display_name") != null && !jsonObj.get("display_name").isJsonNull()) && !jsonObj.get("display_name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `display_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("display_name").toString()));
}
if ((jsonObj.get("photo_url") != null && !jsonObj.get("photo_url").isJsonNull()) && !jsonObj.get("photo_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `photo_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("photo_url").toString()));
}
// validate the optional field `rank`
if (jsonObj.get("rank") != null && !jsonObj.get("rank").isJsonNull()) {
GroupRank.validateJsonElement(jsonObj.get("rank"));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!GroupMember.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'GroupMember' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<GroupMember> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(GroupMember.class));
return (TypeAdapter<T>) new TypeAdapter<GroupMember>() {
@Override
public void write(JsonWriter out, GroupMember value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public GroupMember read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of GroupMember given an JSON string
*
* @param jsonString JSON string
* @return An instance of GroupMember
* @throws IOException if the JSON string is invalid with respect to GroupMember
*/
public static GroupMember fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, GroupMember.class);
}
/**
* Convert an instance of GroupMember to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,80 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.annotations.SerializedName;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* Gets or Sets GroupRank
*/
@JsonAdapter(GroupRank.Adapter.class)
public enum GroupRank {
MEMBER("member"),
LEADER("leader"),
OWNER("owner");
private String value;
GroupRank(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static GroupRank fromValue(String value) {
for (GroupRank b : GroupRank.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter<GroupRank> {
@Override
public void write(final JsonWriter jsonWriter, final GroupRank enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public GroupRank read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return GroupRank.fromValue(value);
}
}
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
GroupRank.fromValue(value);
}
}

View file

@ -0,0 +1,218 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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;
/**
* HashViewModel
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class HashViewModel {
public static final String SERIALIZED_NAME_VALUE = "value";
@SerializedName(SERIALIZED_NAME_VALUE)
@javax.annotation.Nullable
private String value;
public HashViewModel() {
}
public HashViewModel value(@javax.annotation.Nullable String value) {
this.value = value;
return this;
}
/**
* Get value
* @return value
*/
@javax.annotation.Nullable
public String getValue() {
return value;
}
public void setValue(@javax.annotation.Nullable String value) {
this.value = value;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
HashViewModel hashViewModel = (HashViewModel) o;
return Objects.equals(this.value, hashViewModel.value);
}
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(value);
}
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 HashViewModel {\n");
sb.append(" value: ").append(toIndentedString(value)).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("value");
// 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 HashViewModel
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!HashViewModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in HashViewModel is not found in the empty JSON string", HashViewModel.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 (!HashViewModel.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `HashViewModel` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!HashViewModel.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'HashViewModel' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<HashViewModel> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(HashViewModel.class));
return (TypeAdapter<T>) new TypeAdapter<HashViewModel>() {
@Override
public void write(JsonWriter out, HashViewModel value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public HashViewModel read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of HashViewModel given an JSON string
*
* @param jsonString JSON string
* @return An instance of HashViewModel
* @throws IOException if the JSON string is invalid with respect to HashViewModel
*/
public static HashViewModel fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, HashViewModel.class);
}
/**
* Convert an instance of HashViewModel to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,250 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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 com.tribufu.generated.models.TokenHintType;
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;
/**
* IntrospectRequest
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class IntrospectRequest {
public static final String SERIALIZED_NAME_TOKEN = "token";
@SerializedName(SERIALIZED_NAME_TOKEN)
@javax.annotation.Nullable
private String token;
public static final String SERIALIZED_NAME_TOKEN_TYPE_HINT = "token_type_hint";
@SerializedName(SERIALIZED_NAME_TOKEN_TYPE_HINT)
@javax.annotation.Nullable
private TokenHintType tokenTypeHint;
public IntrospectRequest() {
}
public IntrospectRequest token(@javax.annotation.Nullable String token) {
this.token = token;
return this;
}
/**
* Get token
* @return token
*/
@javax.annotation.Nullable
public String getToken() {
return token;
}
public void setToken(@javax.annotation.Nullable String token) {
this.token = token;
}
public IntrospectRequest tokenTypeHint(@javax.annotation.Nullable TokenHintType tokenTypeHint) {
this.tokenTypeHint = tokenTypeHint;
return this;
}
/**
* Get tokenTypeHint
* @return tokenTypeHint
*/
@javax.annotation.Nullable
public TokenHintType getTokenTypeHint() {
return tokenTypeHint;
}
public void setTokenTypeHint(@javax.annotation.Nullable TokenHintType tokenTypeHint) {
this.tokenTypeHint = tokenTypeHint;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
IntrospectRequest introspectRequest = (IntrospectRequest) o;
return Objects.equals(this.token, introspectRequest.token) &&
Objects.equals(this.tokenTypeHint, introspectRequest.tokenTypeHint);
}
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(token, tokenTypeHint);
}
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 IntrospectRequest {\n");
sb.append(" token: ").append(toIndentedString(token)).append("\n");
sb.append(" tokenTypeHint: ").append(toIndentedString(tokenTypeHint)).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("token");
openapiFields.add("token_type_hint");
// 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 IntrospectRequest
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!IntrospectRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in IntrospectRequest is not found in the empty JSON string", IntrospectRequest.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 (!IntrospectRequest.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IntrospectRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("token") != null && !jsonObj.get("token").isJsonNull()) && !jsonObj.get("token").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token").toString()));
}
// validate the optional field `token_type_hint`
if (jsonObj.get("token_type_hint") != null && !jsonObj.get("token_type_hint").isJsonNull()) {
TokenHintType.validateJsonElement(jsonObj.get("token_type_hint"));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!IntrospectRequest.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'IntrospectRequest' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<IntrospectRequest> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(IntrospectRequest.class));
return (TypeAdapter<T>) new TypeAdapter<IntrospectRequest>() {
@Override
public void write(JsonWriter out, IntrospectRequest value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public IntrospectRequest read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of IntrospectRequest given an JSON string
*
* @param jsonString JSON string
* @return An instance of IntrospectRequest
* @throws IOException if the JSON string is invalid with respect to IntrospectRequest
*/
public static IntrospectRequest fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, IntrospectRequest.class);
}
/**
* Convert an instance of IntrospectRequest to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,716 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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;
/**
* IpAddress
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class IpAddress {
public static final String SERIALIZED_NAME_ADDRESS = "address";
@SerializedName(SERIALIZED_NAME_ADDRESS)
@javax.annotation.Nullable
private String address;
public static final String SERIALIZED_NAME_VERSION = "version";
@SerializedName(SERIALIZED_NAME_VERSION)
@javax.annotation.Nullable
private Integer version;
public static final String SERIALIZED_NAME_NETWORK = "network";
@SerializedName(SERIALIZED_NAME_NETWORK)
@javax.annotation.Nullable
private String network;
public static final String SERIALIZED_NAME_RESERVED = "reserved";
@SerializedName(SERIALIZED_NAME_RESERVED)
@javax.annotation.Nullable
private Boolean reserved;
public static final String SERIALIZED_NAME_ASN = "asn";
@SerializedName(SERIALIZED_NAME_ASN)
@javax.annotation.Nullable
private String asn;
public static final String SERIALIZED_NAME_ISP = "isp";
@SerializedName(SERIALIZED_NAME_ISP)
@javax.annotation.Nullable
private String isp;
public static final String SERIALIZED_NAME_CONTINENT = "continent";
@SerializedName(SERIALIZED_NAME_CONTINENT)
@javax.annotation.Nullable
private String continent;
public static final String SERIALIZED_NAME_COUNTRY = "country";
@SerializedName(SERIALIZED_NAME_COUNTRY)
@javax.annotation.Nullable
private String country;
public static final String SERIALIZED_NAME_REGION = "region";
@SerializedName(SERIALIZED_NAME_REGION)
@javax.annotation.Nullable
private String region;
public static final String SERIALIZED_NAME_CITY = "city";
@SerializedName(SERIALIZED_NAME_CITY)
@javax.annotation.Nullable
private String city;
public static final String SERIALIZED_NAME_POSTAL_CODE = "postal_code";
@SerializedName(SERIALIZED_NAME_POSTAL_CODE)
@javax.annotation.Nullable
private String postalCode;
public static final String SERIALIZED_NAME_CALLING_CODE = "calling_code";
@SerializedName(SERIALIZED_NAME_CALLING_CODE)
@javax.annotation.Nullable
private String callingCode;
public static final String SERIALIZED_NAME_TLD = "tld";
@SerializedName(SERIALIZED_NAME_TLD)
@javax.annotation.Nullable
private String tld;
public static final String SERIALIZED_NAME_LANGUAGE = "language";
@SerializedName(SERIALIZED_NAME_LANGUAGE)
@javax.annotation.Nullable
private String language;
public static final String SERIALIZED_NAME_TIMEZONE = "timezone";
@SerializedName(SERIALIZED_NAME_TIMEZONE)
@javax.annotation.Nullable
private String timezone;
public static final String SERIALIZED_NAME_CURRENCY = "currency";
@SerializedName(SERIALIZED_NAME_CURRENCY)
@javax.annotation.Nullable
private String currency;
public static final String SERIALIZED_NAME_LATITUDE = "latitude";
@SerializedName(SERIALIZED_NAME_LATITUDE)
@javax.annotation.Nullable
private Float latitude;
public static final String SERIALIZED_NAME_LONGITUDE = "longitude";
@SerializedName(SERIALIZED_NAME_LONGITUDE)
@javax.annotation.Nullable
private Float longitude;
public IpAddress() {
}
public IpAddress address(@javax.annotation.Nullable String address) {
this.address = address;
return this;
}
/**
* Get address
* @return address
*/
@javax.annotation.Nullable
public String getAddress() {
return address;
}
public void setAddress(@javax.annotation.Nullable String address) {
this.address = address;
}
public IpAddress version(@javax.annotation.Nullable Integer version) {
this.version = version;
return this;
}
/**
* Get version
* @return version
*/
@javax.annotation.Nullable
public Integer getVersion() {
return version;
}
public void setVersion(@javax.annotation.Nullable Integer version) {
this.version = version;
}
public IpAddress network(@javax.annotation.Nullable String network) {
this.network = network;
return this;
}
/**
* Get network
* @return network
*/
@javax.annotation.Nullable
public String getNetwork() {
return network;
}
public void setNetwork(@javax.annotation.Nullable String network) {
this.network = network;
}
public IpAddress reserved(@javax.annotation.Nullable Boolean reserved) {
this.reserved = reserved;
return this;
}
/**
* Get reserved
* @return reserved
*/
@javax.annotation.Nullable
public Boolean getReserved() {
return reserved;
}
public void setReserved(@javax.annotation.Nullable Boolean reserved) {
this.reserved = reserved;
}
public IpAddress asn(@javax.annotation.Nullable String asn) {
this.asn = asn;
return this;
}
/**
* Get asn
* @return asn
*/
@javax.annotation.Nullable
public String getAsn() {
return asn;
}
public void setAsn(@javax.annotation.Nullable String asn) {
this.asn = asn;
}
public IpAddress isp(@javax.annotation.Nullable String isp) {
this.isp = isp;
return this;
}
/**
* Get isp
* @return isp
*/
@javax.annotation.Nullable
public String getIsp() {
return isp;
}
public void setIsp(@javax.annotation.Nullable String isp) {
this.isp = isp;
}
public IpAddress continent(@javax.annotation.Nullable String continent) {
this.continent = continent;
return this;
}
/**
* Get continent
* @return continent
*/
@javax.annotation.Nullable
public String getContinent() {
return continent;
}
public void setContinent(@javax.annotation.Nullable String continent) {
this.continent = continent;
}
public IpAddress country(@javax.annotation.Nullable String country) {
this.country = country;
return this;
}
/**
* Get country
* @return country
*/
@javax.annotation.Nullable
public String getCountry() {
return country;
}
public void setCountry(@javax.annotation.Nullable String country) {
this.country = country;
}
public IpAddress region(@javax.annotation.Nullable String region) {
this.region = region;
return this;
}
/**
* Get region
* @return region
*/
@javax.annotation.Nullable
public String getRegion() {
return region;
}
public void setRegion(@javax.annotation.Nullable String region) {
this.region = region;
}
public IpAddress city(@javax.annotation.Nullable String city) {
this.city = city;
return this;
}
/**
* Get city
* @return city
*/
@javax.annotation.Nullable
public String getCity() {
return city;
}
public void setCity(@javax.annotation.Nullable String city) {
this.city = city;
}
public IpAddress postalCode(@javax.annotation.Nullable String postalCode) {
this.postalCode = postalCode;
return this;
}
/**
* Get postalCode
* @return postalCode
*/
@javax.annotation.Nullable
public String getPostalCode() {
return postalCode;
}
public void setPostalCode(@javax.annotation.Nullable String postalCode) {
this.postalCode = postalCode;
}
public IpAddress callingCode(@javax.annotation.Nullable String callingCode) {
this.callingCode = callingCode;
return this;
}
/**
* Get callingCode
* @return callingCode
*/
@javax.annotation.Nullable
public String getCallingCode() {
return callingCode;
}
public void setCallingCode(@javax.annotation.Nullable String callingCode) {
this.callingCode = callingCode;
}
public IpAddress tld(@javax.annotation.Nullable String tld) {
this.tld = tld;
return this;
}
/**
* Get tld
* @return tld
*/
@javax.annotation.Nullable
public String getTld() {
return tld;
}
public void setTld(@javax.annotation.Nullable String tld) {
this.tld = tld;
}
public IpAddress language(@javax.annotation.Nullable String language) {
this.language = language;
return this;
}
/**
* Get language
* @return language
*/
@javax.annotation.Nullable
public String getLanguage() {
return language;
}
public void setLanguage(@javax.annotation.Nullable String language) {
this.language = language;
}
public IpAddress timezone(@javax.annotation.Nullable String timezone) {
this.timezone = timezone;
return this;
}
/**
* Get timezone
* @return timezone
*/
@javax.annotation.Nullable
public String getTimezone() {
return timezone;
}
public void setTimezone(@javax.annotation.Nullable String timezone) {
this.timezone = timezone;
}
public IpAddress currency(@javax.annotation.Nullable String currency) {
this.currency = currency;
return this;
}
/**
* Get currency
* @return currency
*/
@javax.annotation.Nullable
public String getCurrency() {
return currency;
}
public void setCurrency(@javax.annotation.Nullable String currency) {
this.currency = currency;
}
public IpAddress latitude(@javax.annotation.Nullable Float latitude) {
this.latitude = latitude;
return this;
}
/**
* Get latitude
* @return latitude
*/
@javax.annotation.Nullable
public Float getLatitude() {
return latitude;
}
public void setLatitude(@javax.annotation.Nullable Float latitude) {
this.latitude = latitude;
}
public IpAddress longitude(@javax.annotation.Nullable Float longitude) {
this.longitude = longitude;
return this;
}
/**
* Get longitude
* @return longitude
*/
@javax.annotation.Nullable
public Float getLongitude() {
return longitude;
}
public void setLongitude(@javax.annotation.Nullable Float longitude) {
this.longitude = longitude;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
IpAddress ipAddress = (IpAddress) o;
return Objects.equals(this.address, ipAddress.address) &&
Objects.equals(this.version, ipAddress.version) &&
Objects.equals(this.network, ipAddress.network) &&
Objects.equals(this.reserved, ipAddress.reserved) &&
Objects.equals(this.asn, ipAddress.asn) &&
Objects.equals(this.isp, ipAddress.isp) &&
Objects.equals(this.continent, ipAddress.continent) &&
Objects.equals(this.country, ipAddress.country) &&
Objects.equals(this.region, ipAddress.region) &&
Objects.equals(this.city, ipAddress.city) &&
Objects.equals(this.postalCode, ipAddress.postalCode) &&
Objects.equals(this.callingCode, ipAddress.callingCode) &&
Objects.equals(this.tld, ipAddress.tld) &&
Objects.equals(this.language, ipAddress.language) &&
Objects.equals(this.timezone, ipAddress.timezone) &&
Objects.equals(this.currency, ipAddress.currency) &&
Objects.equals(this.latitude, ipAddress.latitude) &&
Objects.equals(this.longitude, ipAddress.longitude);
}
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(address, version, network, reserved, asn, isp, continent, country, region, city, postalCode, callingCode, tld, language, timezone, currency, latitude, longitude);
}
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 IpAddress {\n");
sb.append(" address: ").append(toIndentedString(address)).append("\n");
sb.append(" version: ").append(toIndentedString(version)).append("\n");
sb.append(" network: ").append(toIndentedString(network)).append("\n");
sb.append(" reserved: ").append(toIndentedString(reserved)).append("\n");
sb.append(" asn: ").append(toIndentedString(asn)).append("\n");
sb.append(" isp: ").append(toIndentedString(isp)).append("\n");
sb.append(" continent: ").append(toIndentedString(continent)).append("\n");
sb.append(" country: ").append(toIndentedString(country)).append("\n");
sb.append(" region: ").append(toIndentedString(region)).append("\n");
sb.append(" city: ").append(toIndentedString(city)).append("\n");
sb.append(" postalCode: ").append(toIndentedString(postalCode)).append("\n");
sb.append(" callingCode: ").append(toIndentedString(callingCode)).append("\n");
sb.append(" tld: ").append(toIndentedString(tld)).append("\n");
sb.append(" language: ").append(toIndentedString(language)).append("\n");
sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n");
sb.append(" currency: ").append(toIndentedString(currency)).append("\n");
sb.append(" latitude: ").append(toIndentedString(latitude)).append("\n");
sb.append(" longitude: ").append(toIndentedString(longitude)).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("address");
openapiFields.add("version");
openapiFields.add("network");
openapiFields.add("reserved");
openapiFields.add("asn");
openapiFields.add("isp");
openapiFields.add("continent");
openapiFields.add("country");
openapiFields.add("region");
openapiFields.add("city");
openapiFields.add("postal_code");
openapiFields.add("calling_code");
openapiFields.add("tld");
openapiFields.add("language");
openapiFields.add("timezone");
openapiFields.add("currency");
openapiFields.add("latitude");
openapiFields.add("longitude");
// 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 IpAddress
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!IpAddress.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in IpAddress is not found in the empty JSON string", IpAddress.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 (!IpAddress.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IpAddress` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) && !jsonObj.get("address").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `address` to be a primitive type in the JSON string but got `%s`", jsonObj.get("address").toString()));
}
if ((jsonObj.get("network") != null && !jsonObj.get("network").isJsonNull()) && !jsonObj.get("network").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `network` to be a primitive type in the JSON string but got `%s`", jsonObj.get("network").toString()));
}
if ((jsonObj.get("asn") != null && !jsonObj.get("asn").isJsonNull()) && !jsonObj.get("asn").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `asn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("asn").toString()));
}
if ((jsonObj.get("isp") != null && !jsonObj.get("isp").isJsonNull()) && !jsonObj.get("isp").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `isp` to be a primitive type in the JSON string but got `%s`", jsonObj.get("isp").toString()));
}
if ((jsonObj.get("continent") != null && !jsonObj.get("continent").isJsonNull()) && !jsonObj.get("continent").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `continent` to be a primitive type in the JSON string but got `%s`", jsonObj.get("continent").toString()));
}
if ((jsonObj.get("country") != null && !jsonObj.get("country").isJsonNull()) && !jsonObj.get("country").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `country` to be a primitive type in the JSON string but got `%s`", jsonObj.get("country").toString()));
}
if ((jsonObj.get("region") != null && !jsonObj.get("region").isJsonNull()) && !jsonObj.get("region").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `region` to be a primitive type in the JSON string but got `%s`", jsonObj.get("region").toString()));
}
if ((jsonObj.get("city") != null && !jsonObj.get("city").isJsonNull()) && !jsonObj.get("city").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString()));
}
if ((jsonObj.get("postal_code") != null && !jsonObj.get("postal_code").isJsonNull()) && !jsonObj.get("postal_code").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `postal_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postal_code").toString()));
}
if ((jsonObj.get("calling_code") != null && !jsonObj.get("calling_code").isJsonNull()) && !jsonObj.get("calling_code").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `calling_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("calling_code").toString()));
}
if ((jsonObj.get("tld") != null && !jsonObj.get("tld").isJsonNull()) && !jsonObj.get("tld").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `tld` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tld").toString()));
}
if ((jsonObj.get("language") != null && !jsonObj.get("language").isJsonNull()) && !jsonObj.get("language").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString()));
}
if ((jsonObj.get("timezone") != null && !jsonObj.get("timezone").isJsonNull()) && !jsonObj.get("timezone").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `timezone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timezone").toString()));
}
if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!IpAddress.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'IpAddress' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<IpAddress> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(IpAddress.class));
return (TypeAdapter<T>) new TypeAdapter<IpAddress>() {
@Override
public void write(JsonWriter out, IpAddress value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public IpAddress read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of IpAddress given an JSON string
*
* @param jsonString JSON string
* @return An instance of IpAddress
* @throws IOException if the JSON string is invalid with respect to IpAddress
*/
public static IpAddress fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, IpAddress.class);
}
/**
* Convert an instance of IpAddress to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,359 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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;
/**
* LeaderboardItem
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class LeaderboardItem {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
@javax.annotation.Nullable
private String name;
public static final String SERIALIZED_NAME_DISPLAY_NAME = "display_name";
@SerializedName(SERIALIZED_NAME_DISPLAY_NAME)
@javax.annotation.Nullable
private String displayName;
public static final String SERIALIZED_NAME_PHOTO_URL = "photo_url";
@SerializedName(SERIALIZED_NAME_PHOTO_URL)
@javax.annotation.Nullable
private String photoUrl;
public static final String SERIALIZED_NAME_LEVEL = "level";
@SerializedName(SERIALIZED_NAME_LEVEL)
@javax.annotation.Nullable
private Integer level;
public static final String SERIALIZED_NAME_EXPERIENCE = "experience";
@SerializedName(SERIALIZED_NAME_EXPERIENCE)
@javax.annotation.Nullable
private Double experience;
public static final String SERIALIZED_NAME_POINTS = "points";
@SerializedName(SERIALIZED_NAME_POINTS)
@javax.annotation.Nullable
private Double points;
public LeaderboardItem() {
}
public LeaderboardItem name(@javax.annotation.Nullable String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
*/
@javax.annotation.Nullable
public String getName() {
return name;
}
public void setName(@javax.annotation.Nullable String name) {
this.name = name;
}
public LeaderboardItem displayName(@javax.annotation.Nullable String displayName) {
this.displayName = displayName;
return this;
}
/**
* Get displayName
* @return displayName
*/
@javax.annotation.Nullable
public String getDisplayName() {
return displayName;
}
public void setDisplayName(@javax.annotation.Nullable String displayName) {
this.displayName = displayName;
}
public LeaderboardItem photoUrl(@javax.annotation.Nullable String photoUrl) {
this.photoUrl = photoUrl;
return this;
}
/**
* Get photoUrl
* @return photoUrl
*/
@javax.annotation.Nullable
public String getPhotoUrl() {
return photoUrl;
}
public void setPhotoUrl(@javax.annotation.Nullable String photoUrl) {
this.photoUrl = photoUrl;
}
public LeaderboardItem level(@javax.annotation.Nullable Integer level) {
this.level = level;
return this;
}
/**
* Get level
* @return level
*/
@javax.annotation.Nullable
public Integer getLevel() {
return level;
}
public void setLevel(@javax.annotation.Nullable Integer level) {
this.level = level;
}
public LeaderboardItem experience(@javax.annotation.Nullable Double experience) {
this.experience = experience;
return this;
}
/**
* Get experience
* @return experience
*/
@javax.annotation.Nullable
public Double getExperience() {
return experience;
}
public void setExperience(@javax.annotation.Nullable Double experience) {
this.experience = experience;
}
public LeaderboardItem points(@javax.annotation.Nullable Double points) {
this.points = points;
return this;
}
/**
* Get points
* @return points
*/
@javax.annotation.Nullable
public Double getPoints() {
return points;
}
public void setPoints(@javax.annotation.Nullable Double points) {
this.points = points;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
LeaderboardItem leaderboardItem = (LeaderboardItem) o;
return Objects.equals(this.name, leaderboardItem.name) &&
Objects.equals(this.displayName, leaderboardItem.displayName) &&
Objects.equals(this.photoUrl, leaderboardItem.photoUrl) &&
Objects.equals(this.level, leaderboardItem.level) &&
Objects.equals(this.experience, leaderboardItem.experience) &&
Objects.equals(this.points, leaderboardItem.points);
}
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(name, displayName, photoUrl, level, experience, points);
}
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 LeaderboardItem {\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n");
sb.append(" photoUrl: ").append(toIndentedString(photoUrl)).append("\n");
sb.append(" level: ").append(toIndentedString(level)).append("\n");
sb.append(" experience: ").append(toIndentedString(experience)).append("\n");
sb.append(" points: ").append(toIndentedString(points)).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("name");
openapiFields.add("display_name");
openapiFields.add("photo_url");
openapiFields.add("level");
openapiFields.add("experience");
openapiFields.add("points");
// 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 LeaderboardItem
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!LeaderboardItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in LeaderboardItem is not found in the empty JSON string", LeaderboardItem.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 (!LeaderboardItem.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LeaderboardItem` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
}
if ((jsonObj.get("display_name") != null && !jsonObj.get("display_name").isJsonNull()) && !jsonObj.get("display_name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `display_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("display_name").toString()));
}
if ((jsonObj.get("photo_url") != null && !jsonObj.get("photo_url").isJsonNull()) && !jsonObj.get("photo_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `photo_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("photo_url").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!LeaderboardItem.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'LeaderboardItem' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<LeaderboardItem> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(LeaderboardItem.class));
return (TypeAdapter<T>) new TypeAdapter<LeaderboardItem>() {
@Override
public void write(JsonWriter out, LeaderboardItem value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public LeaderboardItem read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of LeaderboardItem given an JSON string
*
* @param jsonString JSON string
* @return An instance of LeaderboardItem
* @throws IOException if the JSON string is invalid with respect to LeaderboardItem
*/
public static LeaderboardItem fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, LeaderboardItem.class);
}
/**
* Convert an instance of LeaderboardItem to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,78 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.annotations.SerializedName;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* Gets or Sets LeaderboardOrder
*/
@JsonAdapter(LeaderboardOrder.Adapter.class)
public enum LeaderboardOrder {
LEVEL("level"),
POINTS("points");
private String value;
LeaderboardOrder(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static LeaderboardOrder fromValue(String value) {
for (LeaderboardOrder b : LeaderboardOrder.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter<LeaderboardOrder> {
@Override
public void write(final JsonWriter jsonWriter, final LeaderboardOrder enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public LeaderboardOrder read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return LeaderboardOrder.fromValue(value);
}
}
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
LeaderboardOrder.fromValue(value);
}
}

View file

@ -0,0 +1,88 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.annotations.SerializedName;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* Gets or Sets LoginProvider
*/
@JsonAdapter(LoginProvider.Adapter.class)
public enum LoginProvider {
STEAM("steam"),
EPIC("epic"),
DISCORD("discord"),
MICROSOFT("microsoft"),
PLAYSTATION("playstation"),
GOOGLE("google"),
APPLE("apple");
private String value;
LoginProvider(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static LoginProvider fromValue(String value) {
for (LoginProvider b : LoginProvider.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter<LoginProvider> {
@Override
public void write(final JsonWriter jsonWriter, final LoginProvider enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public LoginProvider read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return LoginProvider.fromValue(value);
}
}
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
LoginProvider.fromValue(value);
}
}

View file

@ -0,0 +1,248 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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;
/**
* LoginRequest
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class LoginRequest {
public static final String SERIALIZED_NAME_LOGIN = "login";
@SerializedName(SERIALIZED_NAME_LOGIN)
@javax.annotation.Nullable
private String login;
public static final String SERIALIZED_NAME_PASSWORD = "password";
@SerializedName(SERIALIZED_NAME_PASSWORD)
@javax.annotation.Nullable
private String password;
public LoginRequest() {
}
public LoginRequest login(@javax.annotation.Nullable String login) {
this.login = login;
return this;
}
/**
* Get login
* @return login
*/
@javax.annotation.Nullable
public String getLogin() {
return login;
}
public void setLogin(@javax.annotation.Nullable String login) {
this.login = login;
}
public LoginRequest password(@javax.annotation.Nullable String password) {
this.password = password;
return this;
}
/**
* Get password
* @return password
*/
@javax.annotation.Nullable
public String getPassword() {
return password;
}
public void setPassword(@javax.annotation.Nullable String password) {
this.password = password;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
LoginRequest loginRequest = (LoginRequest) o;
return Objects.equals(this.login, loginRequest.login) &&
Objects.equals(this.password, loginRequest.password);
}
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(login, password);
}
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 LoginRequest {\n");
sb.append(" login: ").append(toIndentedString(login)).append("\n");
sb.append(" password: ").append(toIndentedString(password)).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("login");
openapiFields.add("password");
// 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 LoginRequest
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!LoginRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in LoginRequest is not found in the empty JSON string", LoginRequest.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 (!LoginRequest.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LoginRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("login") != null && !jsonObj.get("login").isJsonNull()) && !jsonObj.get("login").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `login` to be a primitive type in the JSON string but got `%s`", jsonObj.get("login").toString()));
}
if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!LoginRequest.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'LoginRequest' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<LoginRequest> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(LoginRequest.class));
return (TypeAdapter<T>) new TypeAdapter<LoginRequest>() {
@Override
public void write(JsonWriter out, LoginRequest value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public LoginRequest read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of LoginRequest given an JSON string
*
* @param jsonString JSON string
* @return An instance of LoginRequest
* @throws IOException if the JSON string is invalid with respect to LoginRequest
*/
public static LoginRequest fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, LoginRequest.class);
}
/**
* Convert an instance of LoginRequest to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,307 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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 com.tribufu.generated.models.UserInfo;
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;
/**
* LoginResponse
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class LoginResponse {
public static final String SERIALIZED_NAME_USER = "user";
@SerializedName(SERIALIZED_NAME_USER)
@javax.annotation.Nullable
private UserInfo user;
public static final String SERIALIZED_NAME_ACCESS_TOKEN = "access_token";
@SerializedName(SERIALIZED_NAME_ACCESS_TOKEN)
@javax.annotation.Nullable
private String accessToken;
public static final String SERIALIZED_NAME_REFRESH_TOKEN = "refresh_token";
@SerializedName(SERIALIZED_NAME_REFRESH_TOKEN)
@javax.annotation.Nullable
private String refreshToken;
public static final String SERIALIZED_NAME_EXPIRES_IN = "expires_in";
@SerializedName(SERIALIZED_NAME_EXPIRES_IN)
@javax.annotation.Nullable
private Long expiresIn;
public LoginResponse() {
}
public LoginResponse user(@javax.annotation.Nullable UserInfo user) {
this.user = user;
return this;
}
/**
* Get user
* @return user
*/
@javax.annotation.Nullable
public UserInfo getUser() {
return user;
}
public void setUser(@javax.annotation.Nullable UserInfo user) {
this.user = user;
}
public LoginResponse accessToken(@javax.annotation.Nullable String accessToken) {
this.accessToken = accessToken;
return this;
}
/**
* Get accessToken
* @return accessToken
*/
@javax.annotation.Nullable
public String getAccessToken() {
return accessToken;
}
public void setAccessToken(@javax.annotation.Nullable String accessToken) {
this.accessToken = accessToken;
}
public LoginResponse refreshToken(@javax.annotation.Nullable String refreshToken) {
this.refreshToken = refreshToken;
return this;
}
/**
* Get refreshToken
* @return refreshToken
*/
@javax.annotation.Nullable
public String getRefreshToken() {
return refreshToken;
}
public void setRefreshToken(@javax.annotation.Nullable String refreshToken) {
this.refreshToken = refreshToken;
}
public LoginResponse expiresIn(@javax.annotation.Nullable Long expiresIn) {
this.expiresIn = expiresIn;
return this;
}
/**
* Get expiresIn
* @return expiresIn
*/
@javax.annotation.Nullable
public Long getExpiresIn() {
return expiresIn;
}
public void setExpiresIn(@javax.annotation.Nullable Long expiresIn) {
this.expiresIn = expiresIn;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
LoginResponse loginResponse = (LoginResponse) o;
return Objects.equals(this.user, loginResponse.user) &&
Objects.equals(this.accessToken, loginResponse.accessToken) &&
Objects.equals(this.refreshToken, loginResponse.refreshToken) &&
Objects.equals(this.expiresIn, loginResponse.expiresIn);
}
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(user, accessToken, refreshToken, expiresIn);
}
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 LoginResponse {\n");
sb.append(" user: ").append(toIndentedString(user)).append("\n");
sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n");
sb.append(" refreshToken: ").append(toIndentedString(refreshToken)).append("\n");
sb.append(" expiresIn: ").append(toIndentedString(expiresIn)).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("user");
openapiFields.add("access_token");
openapiFields.add("refresh_token");
openapiFields.add("expires_in");
// 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 LoginResponse
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!LoginResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in LoginResponse is not found in the empty JSON string", LoginResponse.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 (!LoginResponse.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LoginResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
// validate the optional field `user`
if (jsonObj.get("user") != null && !jsonObj.get("user").isJsonNull()) {
UserInfo.validateJsonElement(jsonObj.get("user"));
}
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()));
}
if ((jsonObj.get("refresh_token") != null && !jsonObj.get("refresh_token").isJsonNull()) && !jsonObj.get("refresh_token").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `refresh_token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("refresh_token").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!LoginResponse.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'LoginResponse' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<LoginResponse> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(LoginResponse.class));
return (TypeAdapter<T>) new TypeAdapter<LoginResponse>() {
@Override
public void write(JsonWriter out, LoginResponse value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public LoginResponse read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of LoginResponse given an JSON string
*
* @param jsonString JSON string
* @return An instance of LoginResponse
* @throws IOException if the JSON string is invalid with respect to LoginResponse
*/
public static LoginResponse fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, LoginResponse.class);
}
/**
* Convert an instance of LoginResponse to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,534 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.time.OffsetDateTime;
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;
/**
* ModelPackage
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class ModelPackage {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
@javax.annotation.Nullable
private String id;
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
@javax.annotation.Nullable
private String name;
public static final String SERIALIZED_NAME_DESCRIPTION = "description";
@SerializedName(SERIALIZED_NAME_DESCRIPTION)
@javax.annotation.Nullable
private String description;
public static final String SERIALIZED_NAME_IMAGE_URL = "image_url";
@SerializedName(SERIALIZED_NAME_IMAGE_URL)
@javax.annotation.Nullable
private String imageUrl;
public static final String SERIALIZED_NAME_AUTHOR_ID = "author_id";
@SerializedName(SERIALIZED_NAME_AUTHOR_ID)
@javax.annotation.Nullable
private String authorId;
public static final String SERIALIZED_NAME_VERSION = "version";
@SerializedName(SERIALIZED_NAME_VERSION)
@javax.annotation.Nullable
private String version;
public static final String SERIALIZED_NAME_FILE_URL = "file_url";
@SerializedName(SERIALIZED_NAME_FILE_URL)
@javax.annotation.Nullable
private String fileUrl;
public static final String SERIALIZED_NAME_RAW_SIZE = "raw_size";
@SerializedName(SERIALIZED_NAME_RAW_SIZE)
@javax.annotation.Nullable
private Double rawSize;
public static final String SERIALIZED_NAME_DOWNLOAD_COUNT = "download_count";
@SerializedName(SERIALIZED_NAME_DOWNLOAD_COUNT)
@javax.annotation.Nullable
private Integer downloadCount;
public static final String SERIALIZED_NAME_LAST_DOWNLOAD = "last_download";
@SerializedName(SERIALIZED_NAME_LAST_DOWNLOAD)
@javax.annotation.Nullable
private OffsetDateTime lastDownload;
public static final String SERIALIZED_NAME_CREATED = "created";
@SerializedName(SERIALIZED_NAME_CREATED)
@javax.annotation.Nullable
private OffsetDateTime created;
public static final String SERIALIZED_NAME_UPDATED = "updated";
@SerializedName(SERIALIZED_NAME_UPDATED)
@javax.annotation.Nullable
private OffsetDateTime updated;
public ModelPackage() {
}
public ModelPackage id(@javax.annotation.Nullable String id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@javax.annotation.Nullable
public String getId() {
return id;
}
public void setId(@javax.annotation.Nullable String id) {
this.id = id;
}
public ModelPackage name(@javax.annotation.Nullable String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
*/
@javax.annotation.Nullable
public String getName() {
return name;
}
public void setName(@javax.annotation.Nullable String name) {
this.name = name;
}
public ModelPackage description(@javax.annotation.Nullable String description) {
this.description = description;
return this;
}
/**
* Get description
* @return description
*/
@javax.annotation.Nullable
public String getDescription() {
return description;
}
public void setDescription(@javax.annotation.Nullable String description) {
this.description = description;
}
public ModelPackage imageUrl(@javax.annotation.Nullable String imageUrl) {
this.imageUrl = imageUrl;
return this;
}
/**
* Get imageUrl
* @return imageUrl
*/
@javax.annotation.Nullable
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(@javax.annotation.Nullable String imageUrl) {
this.imageUrl = imageUrl;
}
public ModelPackage authorId(@javax.annotation.Nullable String authorId) {
this.authorId = authorId;
return this;
}
/**
* Get authorId
* @return authorId
*/
@javax.annotation.Nullable
public String getAuthorId() {
return authorId;
}
public void setAuthorId(@javax.annotation.Nullable String authorId) {
this.authorId = authorId;
}
public ModelPackage version(@javax.annotation.Nullable String version) {
this.version = version;
return this;
}
/**
* Get version
* @return version
*/
@javax.annotation.Nullable
public String getVersion() {
return version;
}
public void setVersion(@javax.annotation.Nullable String version) {
this.version = version;
}
public ModelPackage fileUrl(@javax.annotation.Nullable String fileUrl) {
this.fileUrl = fileUrl;
return this;
}
/**
* Get fileUrl
* @return fileUrl
*/
@javax.annotation.Nullable
public String getFileUrl() {
return fileUrl;
}
public void setFileUrl(@javax.annotation.Nullable String fileUrl) {
this.fileUrl = fileUrl;
}
public ModelPackage rawSize(@javax.annotation.Nullable Double rawSize) {
this.rawSize = rawSize;
return this;
}
/**
* Get rawSize
* @return rawSize
*/
@javax.annotation.Nullable
public Double getRawSize() {
return rawSize;
}
public void setRawSize(@javax.annotation.Nullable Double rawSize) {
this.rawSize = rawSize;
}
public ModelPackage downloadCount(@javax.annotation.Nullable Integer downloadCount) {
this.downloadCount = downloadCount;
return this;
}
/**
* Get downloadCount
* @return downloadCount
*/
@javax.annotation.Nullable
public Integer getDownloadCount() {
return downloadCount;
}
public void setDownloadCount(@javax.annotation.Nullable Integer downloadCount) {
this.downloadCount = downloadCount;
}
public ModelPackage lastDownload(@javax.annotation.Nullable OffsetDateTime lastDownload) {
this.lastDownload = lastDownload;
return this;
}
/**
* Get lastDownload
* @return lastDownload
*/
@javax.annotation.Nullable
public OffsetDateTime getLastDownload() {
return lastDownload;
}
public void setLastDownload(@javax.annotation.Nullable OffsetDateTime lastDownload) {
this.lastDownload = lastDownload;
}
public ModelPackage created(@javax.annotation.Nullable OffsetDateTime created) {
this.created = created;
return this;
}
/**
* Get created
* @return created
*/
@javax.annotation.Nullable
public OffsetDateTime getCreated() {
return created;
}
public void setCreated(@javax.annotation.Nullable OffsetDateTime created) {
this.created = created;
}
public ModelPackage updated(@javax.annotation.Nullable OffsetDateTime updated) {
this.updated = updated;
return this;
}
/**
* Get updated
* @return updated
*/
@javax.annotation.Nullable
public OffsetDateTime getUpdated() {
return updated;
}
public void setUpdated(@javax.annotation.Nullable OffsetDateTime updated) {
this.updated = updated;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ModelPackage _package = (ModelPackage) o;
return Objects.equals(this.id, _package.id) &&
Objects.equals(this.name, _package.name) &&
Objects.equals(this.description, _package.description) &&
Objects.equals(this.imageUrl, _package.imageUrl) &&
Objects.equals(this.authorId, _package.authorId) &&
Objects.equals(this.version, _package.version) &&
Objects.equals(this.fileUrl, _package.fileUrl) &&
Objects.equals(this.rawSize, _package.rawSize) &&
Objects.equals(this.downloadCount, _package.downloadCount) &&
Objects.equals(this.lastDownload, _package.lastDownload) &&
Objects.equals(this.created, _package.created) &&
Objects.equals(this.updated, _package.updated);
}
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(id, name, description, imageUrl, authorId, version, fileUrl, rawSize, downloadCount, lastDownload, created, updated);
}
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 ModelPackage {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" imageUrl: ").append(toIndentedString(imageUrl)).append("\n");
sb.append(" authorId: ").append(toIndentedString(authorId)).append("\n");
sb.append(" version: ").append(toIndentedString(version)).append("\n");
sb.append(" fileUrl: ").append(toIndentedString(fileUrl)).append("\n");
sb.append(" rawSize: ").append(toIndentedString(rawSize)).append("\n");
sb.append(" downloadCount: ").append(toIndentedString(downloadCount)).append("\n");
sb.append(" lastDownload: ").append(toIndentedString(lastDownload)).append("\n");
sb.append(" created: ").append(toIndentedString(created)).append("\n");
sb.append(" updated: ").append(toIndentedString(updated)).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("id");
openapiFields.add("name");
openapiFields.add("description");
openapiFields.add("image_url");
openapiFields.add("author_id");
openapiFields.add("version");
openapiFields.add("file_url");
openapiFields.add("raw_size");
openapiFields.add("download_count");
openapiFields.add("last_download");
openapiFields.add("created");
openapiFields.add("updated");
// 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 ModelPackage
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!ModelPackage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in ModelPackage is not found in the empty JSON string", ModelPackage.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 (!ModelPackage.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModelPackage` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString()));
}
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
}
if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString()));
}
if ((jsonObj.get("image_url") != null && !jsonObj.get("image_url").isJsonNull()) && !jsonObj.get("image_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `image_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("image_url").toString()));
}
if ((jsonObj.get("author_id") != null && !jsonObj.get("author_id").isJsonNull()) && !jsonObj.get("author_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `author_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("author_id").toString()));
}
if ((jsonObj.get("version") != null && !jsonObj.get("version").isJsonNull()) && !jsonObj.get("version").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `version` to be a primitive type in the JSON string but got `%s`", jsonObj.get("version").toString()));
}
if ((jsonObj.get("file_url") != null && !jsonObj.get("file_url").isJsonNull()) && !jsonObj.get("file_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `file_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("file_url").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!ModelPackage.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'ModelPackage' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<ModelPackage> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(ModelPackage.class));
return (TypeAdapter<T>) new TypeAdapter<ModelPackage>() {
@Override
public void write(JsonWriter out, ModelPackage value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public ModelPackage read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of ModelPackage given an JSON string
*
* @param jsonString JSON string
* @return An instance of ModelPackage
* @throws IOException if the JSON string is invalid with respect to ModelPackage
*/
public static ModelPackage fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, ModelPackage.class);
}
/**
* Convert an instance of ModelPackage to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,701 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Arrays;
import java.util.UUID;
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;
/**
* Profile
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class Profile {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
@javax.annotation.Nullable
private String id;
public static final String SERIALIZED_NAME_UUID = "uuid";
@SerializedName(SERIALIZED_NAME_UUID)
@javax.annotation.Nullable
private UUID uuid;
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
@javax.annotation.Nullable
private String name;
public static final String SERIALIZED_NAME_DISPLAY_NAME = "display_name";
@SerializedName(SERIALIZED_NAME_DISPLAY_NAME)
@javax.annotation.Nullable
private String displayName;
public static final String SERIALIZED_NAME_VERIFIED = "verified";
@SerializedName(SERIALIZED_NAME_VERIFIED)
@javax.annotation.Nullable
private Boolean verified;
public static final String SERIALIZED_NAME_LEVEL = "level";
@SerializedName(SERIALIZED_NAME_LEVEL)
@javax.annotation.Nullable
private Integer level;
public static final String SERIALIZED_NAME_EXPERIENCE = "experience";
@SerializedName(SERIALIZED_NAME_EXPERIENCE)
@javax.annotation.Nullable
private Double experience;
public static final String SERIALIZED_NAME_PUBLIC_BIRTHDAY = "public_birthday";
@SerializedName(SERIALIZED_NAME_PUBLIC_BIRTHDAY)
@javax.annotation.Nullable
private Boolean publicBirthday;
public static final String SERIALIZED_NAME_BIRTHDAY = "birthday";
@SerializedName(SERIALIZED_NAME_BIRTHDAY)
@javax.annotation.Nullable
private LocalDate birthday;
public static final String SERIALIZED_NAME_POINTS = "points";
@SerializedName(SERIALIZED_NAME_POINTS)
@javax.annotation.Nullable
private Double points;
public static final String SERIALIZED_NAME_LOCATION = "location";
@SerializedName(SERIALIZED_NAME_LOCATION)
@javax.annotation.Nullable
private String location;
public static final String SERIALIZED_NAME_PHOTO_URL = "photo_url";
@SerializedName(SERIALIZED_NAME_PHOTO_URL)
@javax.annotation.Nullable
private String photoUrl;
public static final String SERIALIZED_NAME_BANNER_URL = "banner_url";
@SerializedName(SERIALIZED_NAME_BANNER_URL)
@javax.annotation.Nullable
private String bannerUrl;
public static final String SERIALIZED_NAME_LAST_ONLINE = "last_online";
@SerializedName(SERIALIZED_NAME_LAST_ONLINE)
@javax.annotation.Nullable
private OffsetDateTime lastOnline;
public static final String SERIALIZED_NAME_BIOGRAPHY = "biography";
@SerializedName(SERIALIZED_NAME_BIOGRAPHY)
@javax.annotation.Nullable
private String biography;
public static final String SERIALIZED_NAME_VIEW_COUNT = "view_count";
@SerializedName(SERIALIZED_NAME_VIEW_COUNT)
@javax.annotation.Nullable
private Integer viewCount;
public static final String SERIALIZED_NAME_CREATED = "created";
@SerializedName(SERIALIZED_NAME_CREATED)
@javax.annotation.Nullable
private OffsetDateTime created;
public static final String SERIALIZED_NAME_UPDATED = "updated";
@SerializedName(SERIALIZED_NAME_UPDATED)
@javax.annotation.Nullable
private OffsetDateTime updated;
public Profile() {
}
public Profile id(@javax.annotation.Nullable String id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@javax.annotation.Nullable
public String getId() {
return id;
}
public void setId(@javax.annotation.Nullable String id) {
this.id = id;
}
public Profile uuid(@javax.annotation.Nullable UUID uuid) {
this.uuid = uuid;
return this;
}
/**
* Get uuid
* @return uuid
*/
@javax.annotation.Nullable
public UUID getUuid() {
return uuid;
}
public void setUuid(@javax.annotation.Nullable UUID uuid) {
this.uuid = uuid;
}
public Profile name(@javax.annotation.Nullable String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
*/
@javax.annotation.Nullable
public String getName() {
return name;
}
public void setName(@javax.annotation.Nullable String name) {
this.name = name;
}
public Profile displayName(@javax.annotation.Nullable String displayName) {
this.displayName = displayName;
return this;
}
/**
* Get displayName
* @return displayName
*/
@javax.annotation.Nullable
public String getDisplayName() {
return displayName;
}
public void setDisplayName(@javax.annotation.Nullable String displayName) {
this.displayName = displayName;
}
public Profile verified(@javax.annotation.Nullable Boolean verified) {
this.verified = verified;
return this;
}
/**
* Get verified
* @return verified
*/
@javax.annotation.Nullable
public Boolean getVerified() {
return verified;
}
public void setVerified(@javax.annotation.Nullable Boolean verified) {
this.verified = verified;
}
public Profile level(@javax.annotation.Nullable Integer level) {
this.level = level;
return this;
}
/**
* Get level
* @return level
*/
@javax.annotation.Nullable
public Integer getLevel() {
return level;
}
public void setLevel(@javax.annotation.Nullable Integer level) {
this.level = level;
}
public Profile experience(@javax.annotation.Nullable Double experience) {
this.experience = experience;
return this;
}
/**
* Get experience
* @return experience
*/
@javax.annotation.Nullable
public Double getExperience() {
return experience;
}
public void setExperience(@javax.annotation.Nullable Double experience) {
this.experience = experience;
}
public Profile publicBirthday(@javax.annotation.Nullable Boolean publicBirthday) {
this.publicBirthday = publicBirthday;
return this;
}
/**
* Get publicBirthday
* @return publicBirthday
*/
@javax.annotation.Nullable
public Boolean getPublicBirthday() {
return publicBirthday;
}
public void setPublicBirthday(@javax.annotation.Nullable Boolean publicBirthday) {
this.publicBirthday = publicBirthday;
}
public Profile birthday(@javax.annotation.Nullable LocalDate birthday) {
this.birthday = birthday;
return this;
}
/**
* Get birthday
* @return birthday
*/
@javax.annotation.Nullable
public LocalDate getBirthday() {
return birthday;
}
public void setBirthday(@javax.annotation.Nullable LocalDate birthday) {
this.birthday = birthday;
}
public Profile points(@javax.annotation.Nullable Double points) {
this.points = points;
return this;
}
/**
* Get points
* @return points
*/
@javax.annotation.Nullable
public Double getPoints() {
return points;
}
public void setPoints(@javax.annotation.Nullable Double points) {
this.points = points;
}
public Profile location(@javax.annotation.Nullable String location) {
this.location = location;
return this;
}
/**
* Get location
* @return location
*/
@javax.annotation.Nullable
public String getLocation() {
return location;
}
public void setLocation(@javax.annotation.Nullable String location) {
this.location = location;
}
public Profile photoUrl(@javax.annotation.Nullable String photoUrl) {
this.photoUrl = photoUrl;
return this;
}
/**
* Get photoUrl
* @return photoUrl
*/
@javax.annotation.Nullable
public String getPhotoUrl() {
return photoUrl;
}
public void setPhotoUrl(@javax.annotation.Nullable String photoUrl) {
this.photoUrl = photoUrl;
}
public Profile bannerUrl(@javax.annotation.Nullable String bannerUrl) {
this.bannerUrl = bannerUrl;
return this;
}
/**
* Get bannerUrl
* @return bannerUrl
*/
@javax.annotation.Nullable
public String getBannerUrl() {
return bannerUrl;
}
public void setBannerUrl(@javax.annotation.Nullable String bannerUrl) {
this.bannerUrl = bannerUrl;
}
public Profile lastOnline(@javax.annotation.Nullable OffsetDateTime lastOnline) {
this.lastOnline = lastOnline;
return this;
}
/**
* Get lastOnline
* @return lastOnline
*/
@javax.annotation.Nullable
public OffsetDateTime getLastOnline() {
return lastOnline;
}
public void setLastOnline(@javax.annotation.Nullable OffsetDateTime lastOnline) {
this.lastOnline = lastOnline;
}
public Profile biography(@javax.annotation.Nullable String biography) {
this.biography = biography;
return this;
}
/**
* Get biography
* @return biography
*/
@javax.annotation.Nullable
public String getBiography() {
return biography;
}
public void setBiography(@javax.annotation.Nullable String biography) {
this.biography = biography;
}
public Profile viewCount(@javax.annotation.Nullable Integer viewCount) {
this.viewCount = viewCount;
return this;
}
/**
* Get viewCount
* @return viewCount
*/
@javax.annotation.Nullable
public Integer getViewCount() {
return viewCount;
}
public void setViewCount(@javax.annotation.Nullable Integer viewCount) {
this.viewCount = viewCount;
}
public Profile created(@javax.annotation.Nullable OffsetDateTime created) {
this.created = created;
return this;
}
/**
* Get created
* @return created
*/
@javax.annotation.Nullable
public OffsetDateTime getCreated() {
return created;
}
public void setCreated(@javax.annotation.Nullable OffsetDateTime created) {
this.created = created;
}
public Profile updated(@javax.annotation.Nullable OffsetDateTime updated) {
this.updated = updated;
return this;
}
/**
* Get updated
* @return updated
*/
@javax.annotation.Nullable
public OffsetDateTime getUpdated() {
return updated;
}
public void setUpdated(@javax.annotation.Nullable OffsetDateTime updated) {
this.updated = updated;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Profile profile = (Profile) o;
return Objects.equals(this.id, profile.id) &&
Objects.equals(this.uuid, profile.uuid) &&
Objects.equals(this.name, profile.name) &&
Objects.equals(this.displayName, profile.displayName) &&
Objects.equals(this.verified, profile.verified) &&
Objects.equals(this.level, profile.level) &&
Objects.equals(this.experience, profile.experience) &&
Objects.equals(this.publicBirthday, profile.publicBirthday) &&
Objects.equals(this.birthday, profile.birthday) &&
Objects.equals(this.points, profile.points) &&
Objects.equals(this.location, profile.location) &&
Objects.equals(this.photoUrl, profile.photoUrl) &&
Objects.equals(this.bannerUrl, profile.bannerUrl) &&
Objects.equals(this.lastOnline, profile.lastOnline) &&
Objects.equals(this.biography, profile.biography) &&
Objects.equals(this.viewCount, profile.viewCount) &&
Objects.equals(this.created, profile.created) &&
Objects.equals(this.updated, profile.updated);
}
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(id, uuid, name, displayName, verified, level, experience, publicBirthday, birthday, points, location, photoUrl, bannerUrl, lastOnline, biography, viewCount, created, updated);
}
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 Profile {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n");
sb.append(" verified: ").append(toIndentedString(verified)).append("\n");
sb.append(" level: ").append(toIndentedString(level)).append("\n");
sb.append(" experience: ").append(toIndentedString(experience)).append("\n");
sb.append(" publicBirthday: ").append(toIndentedString(publicBirthday)).append("\n");
sb.append(" birthday: ").append(toIndentedString(birthday)).append("\n");
sb.append(" points: ").append(toIndentedString(points)).append("\n");
sb.append(" location: ").append(toIndentedString(location)).append("\n");
sb.append(" photoUrl: ").append(toIndentedString(photoUrl)).append("\n");
sb.append(" bannerUrl: ").append(toIndentedString(bannerUrl)).append("\n");
sb.append(" lastOnline: ").append(toIndentedString(lastOnline)).append("\n");
sb.append(" biography: ").append(toIndentedString(biography)).append("\n");
sb.append(" viewCount: ").append(toIndentedString(viewCount)).append("\n");
sb.append(" created: ").append(toIndentedString(created)).append("\n");
sb.append(" updated: ").append(toIndentedString(updated)).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("id");
openapiFields.add("uuid");
openapiFields.add("name");
openapiFields.add("display_name");
openapiFields.add("verified");
openapiFields.add("level");
openapiFields.add("experience");
openapiFields.add("public_birthday");
openapiFields.add("birthday");
openapiFields.add("points");
openapiFields.add("location");
openapiFields.add("photo_url");
openapiFields.add("banner_url");
openapiFields.add("last_online");
openapiFields.add("biography");
openapiFields.add("view_count");
openapiFields.add("created");
openapiFields.add("updated");
// 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 Profile
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!Profile.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in Profile is not found in the empty JSON string", Profile.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 (!Profile.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Profile` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString()));
}
if ((jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString()));
}
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
}
if ((jsonObj.get("display_name") != null && !jsonObj.get("display_name").isJsonNull()) && !jsonObj.get("display_name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `display_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("display_name").toString()));
}
if ((jsonObj.get("location") != null && !jsonObj.get("location").isJsonNull()) && !jsonObj.get("location").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `location` to be a primitive type in the JSON string but got `%s`", jsonObj.get("location").toString()));
}
if ((jsonObj.get("photo_url") != null && !jsonObj.get("photo_url").isJsonNull()) && !jsonObj.get("photo_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `photo_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("photo_url").toString()));
}
if ((jsonObj.get("banner_url") != null && !jsonObj.get("banner_url").isJsonNull()) && !jsonObj.get("banner_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `banner_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("banner_url").toString()));
}
if ((jsonObj.get("biography") != null && !jsonObj.get("biography").isJsonNull()) && !jsonObj.get("biography").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `biography` to be a primitive type in the JSON string but got `%s`", jsonObj.get("biography").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!Profile.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'Profile' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<Profile> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(Profile.class));
return (TypeAdapter<T>) new TypeAdapter<Profile>() {
@Override
public void write(JsonWriter out, Profile value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public Profile read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of Profile given an JSON string
*
* @param jsonString JSON string
* @return An instance of Profile
* @throws IOException if the JSON string is invalid with respect to Profile
*/
public static Profile fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, Profile.class);
}
/**
* Convert an instance of Profile to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,501 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.time.OffsetDateTime;
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;
/**
* ProfileGame
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class ProfileGame {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
@javax.annotation.Nullable
private String id;
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
@javax.annotation.Nullable
private String name;
public static final String SERIALIZED_NAME_CAPSULE_IMAGE_URL = "capsule_image_url";
@SerializedName(SERIALIZED_NAME_CAPSULE_IMAGE_URL)
@javax.annotation.Nullable
private String capsuleImageUrl;
public static final String SERIALIZED_NAME_LIBRARY_IMAGE_URL = "library_image_url";
@SerializedName(SERIALIZED_NAME_LIBRARY_IMAGE_URL)
@javax.annotation.Nullable
private String libraryImageUrl;
public static final String SERIALIZED_NAME_SLUG = "slug";
@SerializedName(SERIALIZED_NAME_SLUG)
@javax.annotation.Nullable
private String slug;
public static final String SERIALIZED_NAME_TIME_USED = "time_used";
@SerializedName(SERIALIZED_NAME_TIME_USED)
@javax.annotation.Nullable
private Double timeUsed;
public static final String SERIALIZED_NAME_UNLOCKED_ACHIEVEMENTS = "unlocked_achievements";
@SerializedName(SERIALIZED_NAME_UNLOCKED_ACHIEVEMENTS)
@javax.annotation.Nullable
private Integer unlockedAchievements;
public static final String SERIALIZED_NAME_TOTAL_ACHIEVEMENTS = "total_achievements";
@SerializedName(SERIALIZED_NAME_TOTAL_ACHIEVEMENTS)
@javax.annotation.Nullable
private Integer totalAchievements;
public static final String SERIALIZED_NAME_STATS = "stats";
@SerializedName(SERIALIZED_NAME_STATS)
@javax.annotation.Nullable
private Object stats = null;
public static final String SERIALIZED_NAME_ACQUIRED = "acquired";
@SerializedName(SERIALIZED_NAME_ACQUIRED)
@javax.annotation.Nullable
private OffsetDateTime acquired;
public static final String SERIALIZED_NAME_LAST_USED = "last_used";
@SerializedName(SERIALIZED_NAME_LAST_USED)
@javax.annotation.Nullable
private OffsetDateTime lastUsed;
public ProfileGame() {
}
public ProfileGame id(@javax.annotation.Nullable String id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@javax.annotation.Nullable
public String getId() {
return id;
}
public void setId(@javax.annotation.Nullable String id) {
this.id = id;
}
public ProfileGame name(@javax.annotation.Nullable String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
*/
@javax.annotation.Nullable
public String getName() {
return name;
}
public void setName(@javax.annotation.Nullable String name) {
this.name = name;
}
public ProfileGame capsuleImageUrl(@javax.annotation.Nullable String capsuleImageUrl) {
this.capsuleImageUrl = capsuleImageUrl;
return this;
}
/**
* Get capsuleImageUrl
* @return capsuleImageUrl
*/
@javax.annotation.Nullable
public String getCapsuleImageUrl() {
return capsuleImageUrl;
}
public void setCapsuleImageUrl(@javax.annotation.Nullable String capsuleImageUrl) {
this.capsuleImageUrl = capsuleImageUrl;
}
public ProfileGame libraryImageUrl(@javax.annotation.Nullable String libraryImageUrl) {
this.libraryImageUrl = libraryImageUrl;
return this;
}
/**
* Get libraryImageUrl
* @return libraryImageUrl
*/
@javax.annotation.Nullable
public String getLibraryImageUrl() {
return libraryImageUrl;
}
public void setLibraryImageUrl(@javax.annotation.Nullable String libraryImageUrl) {
this.libraryImageUrl = libraryImageUrl;
}
public ProfileGame slug(@javax.annotation.Nullable String slug) {
this.slug = slug;
return this;
}
/**
* Get slug
* @return slug
*/
@javax.annotation.Nullable
public String getSlug() {
return slug;
}
public void setSlug(@javax.annotation.Nullable String slug) {
this.slug = slug;
}
public ProfileGame timeUsed(@javax.annotation.Nullable Double timeUsed) {
this.timeUsed = timeUsed;
return this;
}
/**
* Get timeUsed
* @return timeUsed
*/
@javax.annotation.Nullable
public Double getTimeUsed() {
return timeUsed;
}
public void setTimeUsed(@javax.annotation.Nullable Double timeUsed) {
this.timeUsed = timeUsed;
}
public ProfileGame unlockedAchievements(@javax.annotation.Nullable Integer unlockedAchievements) {
this.unlockedAchievements = unlockedAchievements;
return this;
}
/**
* Get unlockedAchievements
* @return unlockedAchievements
*/
@javax.annotation.Nullable
public Integer getUnlockedAchievements() {
return unlockedAchievements;
}
public void setUnlockedAchievements(@javax.annotation.Nullable Integer unlockedAchievements) {
this.unlockedAchievements = unlockedAchievements;
}
public ProfileGame totalAchievements(@javax.annotation.Nullable Integer totalAchievements) {
this.totalAchievements = totalAchievements;
return this;
}
/**
* Get totalAchievements
* @return totalAchievements
*/
@javax.annotation.Nullable
public Integer getTotalAchievements() {
return totalAchievements;
}
public void setTotalAchievements(@javax.annotation.Nullable Integer totalAchievements) {
this.totalAchievements = totalAchievements;
}
public ProfileGame stats(@javax.annotation.Nullable Object stats) {
this.stats = stats;
return this;
}
/**
* Get stats
* @return stats
*/
@javax.annotation.Nullable
public Object getStats() {
return stats;
}
public void setStats(@javax.annotation.Nullable Object stats) {
this.stats = stats;
}
public ProfileGame acquired(@javax.annotation.Nullable OffsetDateTime acquired) {
this.acquired = acquired;
return this;
}
/**
* Get acquired
* @return acquired
*/
@javax.annotation.Nullable
public OffsetDateTime getAcquired() {
return acquired;
}
public void setAcquired(@javax.annotation.Nullable OffsetDateTime acquired) {
this.acquired = acquired;
}
public ProfileGame lastUsed(@javax.annotation.Nullable OffsetDateTime lastUsed) {
this.lastUsed = lastUsed;
return this;
}
/**
* Get lastUsed
* @return lastUsed
*/
@javax.annotation.Nullable
public OffsetDateTime getLastUsed() {
return lastUsed;
}
public void setLastUsed(@javax.annotation.Nullable OffsetDateTime lastUsed) {
this.lastUsed = lastUsed;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ProfileGame profileGame = (ProfileGame) o;
return Objects.equals(this.id, profileGame.id) &&
Objects.equals(this.name, profileGame.name) &&
Objects.equals(this.capsuleImageUrl, profileGame.capsuleImageUrl) &&
Objects.equals(this.libraryImageUrl, profileGame.libraryImageUrl) &&
Objects.equals(this.slug, profileGame.slug) &&
Objects.equals(this.timeUsed, profileGame.timeUsed) &&
Objects.equals(this.unlockedAchievements, profileGame.unlockedAchievements) &&
Objects.equals(this.totalAchievements, profileGame.totalAchievements) &&
Objects.equals(this.stats, profileGame.stats) &&
Objects.equals(this.acquired, profileGame.acquired) &&
Objects.equals(this.lastUsed, profileGame.lastUsed);
}
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(id, name, capsuleImageUrl, libraryImageUrl, slug, timeUsed, unlockedAchievements, totalAchievements, stats, acquired, lastUsed);
}
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 ProfileGame {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" capsuleImageUrl: ").append(toIndentedString(capsuleImageUrl)).append("\n");
sb.append(" libraryImageUrl: ").append(toIndentedString(libraryImageUrl)).append("\n");
sb.append(" slug: ").append(toIndentedString(slug)).append("\n");
sb.append(" timeUsed: ").append(toIndentedString(timeUsed)).append("\n");
sb.append(" unlockedAchievements: ").append(toIndentedString(unlockedAchievements)).append("\n");
sb.append(" totalAchievements: ").append(toIndentedString(totalAchievements)).append("\n");
sb.append(" stats: ").append(toIndentedString(stats)).append("\n");
sb.append(" acquired: ").append(toIndentedString(acquired)).append("\n");
sb.append(" lastUsed: ").append(toIndentedString(lastUsed)).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("id");
openapiFields.add("name");
openapiFields.add("capsule_image_url");
openapiFields.add("library_image_url");
openapiFields.add("slug");
openapiFields.add("time_used");
openapiFields.add("unlocked_achievements");
openapiFields.add("total_achievements");
openapiFields.add("stats");
openapiFields.add("acquired");
openapiFields.add("last_used");
// 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 ProfileGame
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!ProfileGame.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in ProfileGame is not found in the empty JSON string", ProfileGame.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 (!ProfileGame.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProfileGame` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString()));
}
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
}
if ((jsonObj.get("capsule_image_url") != null && !jsonObj.get("capsule_image_url").isJsonNull()) && !jsonObj.get("capsule_image_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `capsule_image_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("capsule_image_url").toString()));
}
if ((jsonObj.get("library_image_url") != null && !jsonObj.get("library_image_url").isJsonNull()) && !jsonObj.get("library_image_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `library_image_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("library_image_url").toString()));
}
if ((jsonObj.get("slug") != null && !jsonObj.get("slug").isJsonNull()) && !jsonObj.get("slug").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!ProfileGame.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'ProfileGame' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<ProfileGame> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(ProfileGame.class));
return (TypeAdapter<T>) new TypeAdapter<ProfileGame>() {
@Override
public void write(JsonWriter out, ProfileGame value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public ProfileGame read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of ProfileGame given an JSON string
*
* @param jsonString JSON string
* @return An instance of ProfileGame
* @throws IOException if the JSON string is invalid with respect to ProfileGame
*/
public static ProfileGame fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, ProfileGame.class);
}
/**
* Convert an instance of ProfileGame to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,480 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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 com.tribufu.generated.models.GroupRank;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.Arrays;
import java.util.UUID;
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;
/**
* ProfileGroup
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class ProfileGroup {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
@javax.annotation.Nullable
private String id;
public static final String SERIALIZED_NAME_UUID = "uuid";
@SerializedName(SERIALIZED_NAME_UUID)
@javax.annotation.Nullable
private UUID uuid;
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
@javax.annotation.Nullable
private String name;
public static final String SERIALIZED_NAME_TAG = "tag";
@SerializedName(SERIALIZED_NAME_TAG)
@javax.annotation.Nullable
private String tag;
public static final String SERIALIZED_NAME_PRIVACY = "privacy";
@SerializedName(SERIALIZED_NAME_PRIVACY)
@javax.annotation.Nullable
private Integer privacy;
public static final String SERIALIZED_NAME_VERIFIED = "verified";
@SerializedName(SERIALIZED_NAME_VERIFIED)
@javax.annotation.Nullable
private Boolean verified;
public static final String SERIALIZED_NAME_PHOTO_URL = "photo_url";
@SerializedName(SERIALIZED_NAME_PHOTO_URL)
@javax.annotation.Nullable
private String photoUrl;
public static final String SERIALIZED_NAME_MEMBER_COUNT = "member_count";
@SerializedName(SERIALIZED_NAME_MEMBER_COUNT)
@javax.annotation.Nullable
private Integer memberCount;
public static final String SERIALIZED_NAME_RANK = "rank";
@SerializedName(SERIALIZED_NAME_RANK)
@javax.annotation.Nullable
private GroupRank rank;
public static final String SERIALIZED_NAME_SINCE = "since";
@SerializedName(SERIALIZED_NAME_SINCE)
@javax.annotation.Nullable
private OffsetDateTime since;
public ProfileGroup() {
}
public ProfileGroup id(@javax.annotation.Nullable String id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@javax.annotation.Nullable
public String getId() {
return id;
}
public void setId(@javax.annotation.Nullable String id) {
this.id = id;
}
public ProfileGroup uuid(@javax.annotation.Nullable UUID uuid) {
this.uuid = uuid;
return this;
}
/**
* Get uuid
* @return uuid
*/
@javax.annotation.Nullable
public UUID getUuid() {
return uuid;
}
public void setUuid(@javax.annotation.Nullable UUID uuid) {
this.uuid = uuid;
}
public ProfileGroup name(@javax.annotation.Nullable String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
*/
@javax.annotation.Nullable
public String getName() {
return name;
}
public void setName(@javax.annotation.Nullable String name) {
this.name = name;
}
public ProfileGroup tag(@javax.annotation.Nullable String tag) {
this.tag = tag;
return this;
}
/**
* Get tag
* @return tag
*/
@javax.annotation.Nullable
public String getTag() {
return tag;
}
public void setTag(@javax.annotation.Nullable String tag) {
this.tag = tag;
}
public ProfileGroup privacy(@javax.annotation.Nullable Integer privacy) {
this.privacy = privacy;
return this;
}
/**
* Get privacy
* @return privacy
*/
@javax.annotation.Nullable
public Integer getPrivacy() {
return privacy;
}
public void setPrivacy(@javax.annotation.Nullable Integer privacy) {
this.privacy = privacy;
}
public ProfileGroup verified(@javax.annotation.Nullable Boolean verified) {
this.verified = verified;
return this;
}
/**
* Get verified
* @return verified
*/
@javax.annotation.Nullable
public Boolean getVerified() {
return verified;
}
public void setVerified(@javax.annotation.Nullable Boolean verified) {
this.verified = verified;
}
public ProfileGroup photoUrl(@javax.annotation.Nullable String photoUrl) {
this.photoUrl = photoUrl;
return this;
}
/**
* Get photoUrl
* @return photoUrl
*/
@javax.annotation.Nullable
public String getPhotoUrl() {
return photoUrl;
}
public void setPhotoUrl(@javax.annotation.Nullable String photoUrl) {
this.photoUrl = photoUrl;
}
public ProfileGroup memberCount(@javax.annotation.Nullable Integer memberCount) {
this.memberCount = memberCount;
return this;
}
/**
* Get memberCount
* @return memberCount
*/
@javax.annotation.Nullable
public Integer getMemberCount() {
return memberCount;
}
public void setMemberCount(@javax.annotation.Nullable Integer memberCount) {
this.memberCount = memberCount;
}
public ProfileGroup rank(@javax.annotation.Nullable GroupRank rank) {
this.rank = rank;
return this;
}
/**
* Get rank
* @return rank
*/
@javax.annotation.Nullable
public GroupRank getRank() {
return rank;
}
public void setRank(@javax.annotation.Nullable GroupRank rank) {
this.rank = rank;
}
public ProfileGroup since(@javax.annotation.Nullable OffsetDateTime since) {
this.since = since;
return this;
}
/**
* Get since
* @return since
*/
@javax.annotation.Nullable
public OffsetDateTime getSince() {
return since;
}
public void setSince(@javax.annotation.Nullable OffsetDateTime since) {
this.since = since;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ProfileGroup profileGroup = (ProfileGroup) o;
return Objects.equals(this.id, profileGroup.id) &&
Objects.equals(this.uuid, profileGroup.uuid) &&
Objects.equals(this.name, profileGroup.name) &&
Objects.equals(this.tag, profileGroup.tag) &&
Objects.equals(this.privacy, profileGroup.privacy) &&
Objects.equals(this.verified, profileGroup.verified) &&
Objects.equals(this.photoUrl, profileGroup.photoUrl) &&
Objects.equals(this.memberCount, profileGroup.memberCount) &&
Objects.equals(this.rank, profileGroup.rank) &&
Objects.equals(this.since, profileGroup.since);
}
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(id, uuid, name, tag, privacy, verified, photoUrl, memberCount, rank, since);
}
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 ProfileGroup {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" tag: ").append(toIndentedString(tag)).append("\n");
sb.append(" privacy: ").append(toIndentedString(privacy)).append("\n");
sb.append(" verified: ").append(toIndentedString(verified)).append("\n");
sb.append(" photoUrl: ").append(toIndentedString(photoUrl)).append("\n");
sb.append(" memberCount: ").append(toIndentedString(memberCount)).append("\n");
sb.append(" rank: ").append(toIndentedString(rank)).append("\n");
sb.append(" since: ").append(toIndentedString(since)).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("id");
openapiFields.add("uuid");
openapiFields.add("name");
openapiFields.add("tag");
openapiFields.add("privacy");
openapiFields.add("verified");
openapiFields.add("photo_url");
openapiFields.add("member_count");
openapiFields.add("rank");
openapiFields.add("since");
// 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 ProfileGroup
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!ProfileGroup.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in ProfileGroup is not found in the empty JSON string", ProfileGroup.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 (!ProfileGroup.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProfileGroup` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString()));
}
if ((jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString()));
}
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
}
if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString()));
}
if ((jsonObj.get("photo_url") != null && !jsonObj.get("photo_url").isJsonNull()) && !jsonObj.get("photo_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `photo_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("photo_url").toString()));
}
// validate the optional field `rank`
if (jsonObj.get("rank") != null && !jsonObj.get("rank").isJsonNull()) {
GroupRank.validateJsonElement(jsonObj.get("rank"));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!ProfileGroup.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'ProfileGroup' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<ProfileGroup> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(ProfileGroup.class));
return (TypeAdapter<T>) new TypeAdapter<ProfileGroup>() {
@Override
public void write(JsonWriter out, ProfileGroup value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public ProfileGroup read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of ProfileGroup given an JSON string
*
* @param jsonString JSON string
* @return An instance of ProfileGroup
* @throws IOException if the JSON string is invalid with respect to ProfileGroup
*/
public static ProfileGroup fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, ProfileGroup.class);
}
/**
* Convert an instance of ProfileGroup to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,218 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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;
/**
* RefreshRequest
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class RefreshRequest {
public static final String SERIALIZED_NAME_REFRESH_TOKEN = "refresh_token";
@SerializedName(SERIALIZED_NAME_REFRESH_TOKEN)
@javax.annotation.Nullable
private String refreshToken;
public RefreshRequest() {
}
public RefreshRequest refreshToken(@javax.annotation.Nullable String refreshToken) {
this.refreshToken = refreshToken;
return this;
}
/**
* Get refreshToken
* @return refreshToken
*/
@javax.annotation.Nullable
public String getRefreshToken() {
return refreshToken;
}
public void setRefreshToken(@javax.annotation.Nullable String refreshToken) {
this.refreshToken = refreshToken;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RefreshRequest refreshRequest = (RefreshRequest) o;
return Objects.equals(this.refreshToken, refreshRequest.refreshToken);
}
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(refreshToken);
}
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 RefreshRequest {\n");
sb.append(" refreshToken: ").append(toIndentedString(refreshToken)).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("refresh_token");
// 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 RefreshRequest
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!RefreshRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in RefreshRequest is not found in the empty JSON string", RefreshRequest.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 (!RefreshRequest.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefreshRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("refresh_token") != null && !jsonObj.get("refresh_token").isJsonNull()) && !jsonObj.get("refresh_token").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `refresh_token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("refresh_token").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!RefreshRequest.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'RefreshRequest' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<RefreshRequest> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(RefreshRequest.class));
return (TypeAdapter<T>) new TypeAdapter<RefreshRequest>() {
@Override
public void write(JsonWriter out, RefreshRequest value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public RefreshRequest read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of RefreshRequest given an JSON string
*
* @param jsonString JSON string
* @return An instance of RefreshRequest
* @throws IOException if the JSON string is invalid with respect to RefreshRequest
*/
public static RefreshRequest fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, RefreshRequest.class);
}
/**
* Convert an instance of RefreshRequest to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,318 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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 java.util.UUID;
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;
/**
* RegisterRequest
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class RegisterRequest {
public static final String SERIALIZED_NAME_UUID = "uuid";
@SerializedName(SERIALIZED_NAME_UUID)
@javax.annotation.Nullable
private UUID uuid;
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
@javax.annotation.Nonnull
private String name;
public static final String SERIALIZED_NAME_EMAIL = "email";
@SerializedName(SERIALIZED_NAME_EMAIL)
@javax.annotation.Nullable
private String email;
public static final String SERIALIZED_NAME_PASSWORD = "password";
@SerializedName(SERIALIZED_NAME_PASSWORD)
@javax.annotation.Nonnull
private String password;
public RegisterRequest() {
}
public RegisterRequest uuid(@javax.annotation.Nullable UUID uuid) {
this.uuid = uuid;
return this;
}
/**
* Get uuid
* @return uuid
*/
@javax.annotation.Nullable
public UUID getUuid() {
return uuid;
}
public void setUuid(@javax.annotation.Nullable UUID uuid) {
this.uuid = uuid;
}
public RegisterRequest name(@javax.annotation.Nonnull String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
*/
@javax.annotation.Nonnull
public String getName() {
return name;
}
public void setName(@javax.annotation.Nonnull String name) {
this.name = name;
}
public RegisterRequest email(@javax.annotation.Nullable String email) {
this.email = email;
return this;
}
/**
* Get email
* @return email
*/
@javax.annotation.Nullable
public String getEmail() {
return email;
}
public void setEmail(@javax.annotation.Nullable String email) {
this.email = email;
}
public RegisterRequest password(@javax.annotation.Nonnull String password) {
this.password = password;
return this;
}
/**
* Get password
* @return password
*/
@javax.annotation.Nonnull
public String getPassword() {
return password;
}
public void setPassword(@javax.annotation.Nonnull String password) {
this.password = password;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RegisterRequest registerRequest = (RegisterRequest) o;
return Objects.equals(this.uuid, registerRequest.uuid) &&
Objects.equals(this.name, registerRequest.name) &&
Objects.equals(this.email, registerRequest.email) &&
Objects.equals(this.password, registerRequest.password);
}
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(uuid, name, email, password);
}
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 RegisterRequest {\n");
sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" email: ").append(toIndentedString(email)).append("\n");
sb.append(" password: ").append("*").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("uuid");
openapiFields.add("name");
openapiFields.add("email");
openapiFields.add("password");
// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet<String>();
openapiRequiredFields.add("name");
openapiRequiredFields.add("password");
}
/**
* 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 RegisterRequest
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!RegisterRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in RegisterRequest is not found in the empty JSON string", RegisterRequest.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 (!RegisterRequest.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RegisterRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
// check to make sure all required properties/fields are present in the JSON string
for (String requiredField : RegisterRequest.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("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString()));
}
if (!jsonObj.get("name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
}
if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString()));
}
if (!jsonObj.get("password").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!RegisterRequest.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'RegisterRequest' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<RegisterRequest> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(RegisterRequest.class));
return (TypeAdapter<T>) new TypeAdapter<RegisterRequest>() {
@Override
public void write(JsonWriter out, RegisterRequest value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public RegisterRequest read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of RegisterRequest given an JSON string
*
* @param jsonString JSON string
* @return An instance of RegisterRequest
* @throws IOException if the JSON string is invalid with respect to RegisterRequest
*/
public static RegisterRequest fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, RegisterRequest.class);
}
/**
* Convert an instance of RegisterRequest to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,78 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.annotations.SerializedName;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* Gets or Sets ResponseType
*/
@JsonAdapter(ResponseType.Adapter.class)
public enum ResponseType {
CODE("code"),
TOKEN("token");
private String value;
ResponseType(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static ResponseType fromValue(String value) {
for (ResponseType b : ResponseType.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter<ResponseType> {
@Override
public void write(final JsonWriter jsonWriter, final ResponseType enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public ResponseType read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return ResponseType.fromValue(value);
}
}
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
ResponseType.fromValue(value);
}
}

View file

@ -0,0 +1,250 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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 com.tribufu.generated.models.TokenHintType;
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;
/**
* RevokeRequest
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class RevokeRequest {
public static final String SERIALIZED_NAME_TOKEN = "token";
@SerializedName(SERIALIZED_NAME_TOKEN)
@javax.annotation.Nullable
private String token;
public static final String SERIALIZED_NAME_TOKEN_TYPE_HINT = "token_type_hint";
@SerializedName(SERIALIZED_NAME_TOKEN_TYPE_HINT)
@javax.annotation.Nullable
private TokenHintType tokenTypeHint;
public RevokeRequest() {
}
public RevokeRequest token(@javax.annotation.Nullable String token) {
this.token = token;
return this;
}
/**
* Get token
* @return token
*/
@javax.annotation.Nullable
public String getToken() {
return token;
}
public void setToken(@javax.annotation.Nullable String token) {
this.token = token;
}
public RevokeRequest tokenTypeHint(@javax.annotation.Nullable TokenHintType tokenTypeHint) {
this.tokenTypeHint = tokenTypeHint;
return this;
}
/**
* Get tokenTypeHint
* @return tokenTypeHint
*/
@javax.annotation.Nullable
public TokenHintType getTokenTypeHint() {
return tokenTypeHint;
}
public void setTokenTypeHint(@javax.annotation.Nullable TokenHintType tokenTypeHint) {
this.tokenTypeHint = tokenTypeHint;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RevokeRequest revokeRequest = (RevokeRequest) o;
return Objects.equals(this.token, revokeRequest.token) &&
Objects.equals(this.tokenTypeHint, revokeRequest.tokenTypeHint);
}
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(token, tokenTypeHint);
}
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 RevokeRequest {\n");
sb.append(" token: ").append(toIndentedString(token)).append("\n");
sb.append(" tokenTypeHint: ").append(toIndentedString(tokenTypeHint)).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("token");
openapiFields.add("token_type_hint");
// 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 RevokeRequest
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!RevokeRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in RevokeRequest is not found in the empty JSON string", RevokeRequest.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 (!RevokeRequest.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RevokeRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("token") != null && !jsonObj.get("token").isJsonNull()) && !jsonObj.get("token").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token").toString()));
}
// validate the optional field `token_type_hint`
if (jsonObj.get("token_type_hint") != null && !jsonObj.get("token_type_hint").isJsonNull()) {
TokenHintType.validateJsonElement(jsonObj.get("token_type_hint"));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!RevokeRequest.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'RevokeRequest' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<RevokeRequest> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(RevokeRequest.class));
return (TypeAdapter<T>) new TypeAdapter<RevokeRequest>() {
@Override
public void write(JsonWriter out, RevokeRequest value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public RevokeRequest read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of RevokeRequest given an JSON string
*
* @param jsonString JSON string
* @return An instance of RevokeRequest
* @throws IOException if the JSON string is invalid with respect to RevokeRequest
*/
public static RevokeRequest fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, RevokeRequest.class);
}
/**
* Convert an instance of RevokeRequest to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,307 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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 com.tribufu.generated.models.SearchType;
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;
/**
* SearchRequest
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class SearchRequest {
public static final String SERIALIZED_NAME_TYPE = "type";
@SerializedName(SERIALIZED_NAME_TYPE)
@javax.annotation.Nullable
private SearchType type;
public static final String SERIALIZED_NAME_QUERY = "query";
@SerializedName(SERIALIZED_NAME_QUERY)
@javax.annotation.Nullable
private String query;
public static final String SERIALIZED_NAME_PAGE = "page";
@SerializedName(SERIALIZED_NAME_PAGE)
@javax.annotation.Nullable
private Integer page;
public static final String SERIALIZED_NAME_GAME_ID = "game_id";
@SerializedName(SERIALIZED_NAME_GAME_ID)
@javax.annotation.Nullable
private String gameId;
public SearchRequest() {
}
public SearchRequest type(@javax.annotation.Nullable SearchType type) {
this.type = type;
return this;
}
/**
* Get type
* @return type
*/
@javax.annotation.Nullable
public SearchType getType() {
return type;
}
public void setType(@javax.annotation.Nullable SearchType type) {
this.type = type;
}
public SearchRequest query(@javax.annotation.Nullable String query) {
this.query = query;
return this;
}
/**
* Get query
* @return query
*/
@javax.annotation.Nullable
public String getQuery() {
return query;
}
public void setQuery(@javax.annotation.Nullable String query) {
this.query = query;
}
public SearchRequest page(@javax.annotation.Nullable Integer page) {
this.page = page;
return this;
}
/**
* Get page
* @return page
*/
@javax.annotation.Nullable
public Integer getPage() {
return page;
}
public void setPage(@javax.annotation.Nullable Integer page) {
this.page = page;
}
public SearchRequest gameId(@javax.annotation.Nullable String gameId) {
this.gameId = gameId;
return this;
}
/**
* Get gameId
* @return gameId
*/
@javax.annotation.Nullable
public String getGameId() {
return gameId;
}
public void setGameId(@javax.annotation.Nullable String gameId) {
this.gameId = gameId;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SearchRequest searchRequest = (SearchRequest) o;
return Objects.equals(this.type, searchRequest.type) &&
Objects.equals(this.query, searchRequest.query) &&
Objects.equals(this.page, searchRequest.page) &&
Objects.equals(this.gameId, searchRequest.gameId);
}
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(type, query, page, gameId);
}
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 SearchRequest {\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" query: ").append(toIndentedString(query)).append("\n");
sb.append(" page: ").append(toIndentedString(page)).append("\n");
sb.append(" gameId: ").append(toIndentedString(gameId)).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("type");
openapiFields.add("query");
openapiFields.add("page");
openapiFields.add("game_id");
// 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 SearchRequest
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!SearchRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in SearchRequest is not found in the empty JSON string", SearchRequest.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 (!SearchRequest.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SearchRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
// validate the optional field `type`
if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) {
SearchType.validateJsonElement(jsonObj.get("type"));
}
if ((jsonObj.get("query") != null && !jsonObj.get("query").isJsonNull()) && !jsonObj.get("query").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `query` to be a primitive type in the JSON string but got `%s`", jsonObj.get("query").toString()));
}
if ((jsonObj.get("game_id") != null && !jsonObj.get("game_id").isJsonNull()) && !jsonObj.get("game_id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `game_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("game_id").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!SearchRequest.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'SearchRequest' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<SearchRequest> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(SearchRequest.class));
return (TypeAdapter<T>) new TypeAdapter<SearchRequest>() {
@Override
public void write(JsonWriter out, SearchRequest value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public SearchRequest read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of SearchRequest given an JSON string
*
* @param jsonString JSON string
* @return An instance of SearchRequest
* @throws IOException if the JSON string is invalid with respect to SearchRequest
*/
public static SearchRequest fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, SearchRequest.class);
}
/**
* Convert an instance of SearchRequest to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,82 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.annotations.SerializedName;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* Gets or Sets SearchType
*/
@JsonAdapter(SearchType.Adapter.class)
public enum SearchType {
USER("user"),
GROUP("group"),
SERVER("server"),
CLUSTER("cluster");
private String value;
SearchType(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static SearchType fromValue(String value) {
for (SearchType b : SearchType.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter<SearchType> {
@Override
public void write(final JsonWriter jsonWriter, final SearchType enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public SearchType read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return SearchType.fromValue(value);
}
}
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
SearchType.fromValue(value);
}
}

View file

@ -0,0 +1,257 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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 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;
/**
* ServerMetrics
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class ServerMetrics {
public static final String SERIALIZED_NAME_SERVER_COUNT = "server_count";
@SerializedName(SERIALIZED_NAME_SERVER_COUNT)
@javax.annotation.Nullable
private Integer serverCount;
public static final String SERIALIZED_NAME_PACKAGE_COUNT = "package_count";
@SerializedName(SERIALIZED_NAME_PACKAGE_COUNT)
@javax.annotation.Nullable
private Integer packageCount;
public static final String SERIALIZED_NAME_COUNTRY_COUNT = "country_count";
@SerializedName(SERIALIZED_NAME_COUNTRY_COUNT)
@javax.annotation.Nullable
private Integer countryCount;
public ServerMetrics() {
}
public ServerMetrics serverCount(@javax.annotation.Nullable Integer serverCount) {
this.serverCount = serverCount;
return this;
}
/**
* Get serverCount
* @return serverCount
*/
@javax.annotation.Nullable
public Integer getServerCount() {
return serverCount;
}
public void setServerCount(@javax.annotation.Nullable Integer serverCount) {
this.serverCount = serverCount;
}
public ServerMetrics packageCount(@javax.annotation.Nullable Integer packageCount) {
this.packageCount = packageCount;
return this;
}
/**
* Get packageCount
* @return packageCount
*/
@javax.annotation.Nullable
public Integer getPackageCount() {
return packageCount;
}
public void setPackageCount(@javax.annotation.Nullable Integer packageCount) {
this.packageCount = packageCount;
}
public ServerMetrics countryCount(@javax.annotation.Nullable Integer countryCount) {
this.countryCount = countryCount;
return this;
}
/**
* Get countryCount
* @return countryCount
*/
@javax.annotation.Nullable
public Integer getCountryCount() {
return countryCount;
}
public void setCountryCount(@javax.annotation.Nullable Integer countryCount) {
this.countryCount = countryCount;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ServerMetrics serverMetrics = (ServerMetrics) o;
return Objects.equals(this.serverCount, serverMetrics.serverCount) &&
Objects.equals(this.packageCount, serverMetrics.packageCount) &&
Objects.equals(this.countryCount, serverMetrics.countryCount);
}
@Override
public int hashCode() {
return Objects.hash(serverCount, packageCount, countryCount);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ServerMetrics {\n");
sb.append(" serverCount: ").append(toIndentedString(serverCount)).append("\n");
sb.append(" packageCount: ").append(toIndentedString(packageCount)).append("\n");
sb.append(" countryCount: ").append(toIndentedString(countryCount)).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("server_count");
openapiFields.add("package_count");
openapiFields.add("country_count");
// 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 ServerMetrics
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!ServerMetrics.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in ServerMetrics is not found in the empty JSON string", ServerMetrics.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 (!ServerMetrics.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ServerMetrics` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!ServerMetrics.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'ServerMetrics' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<ServerMetrics> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(ServerMetrics.class));
return (TypeAdapter<T>) new TypeAdapter<ServerMetrics>() {
@Override
public void write(JsonWriter out, ServerMetrics value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public ServerMetrics read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of ServerMetrics given an JSON string
*
* @param jsonString JSON string
* @return An instance of ServerMetrics
* @throws IOException if the JSON string is invalid with respect to ServerMetrics
*/
public static ServerMetrics fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, ServerMetrics.class);
}
/**
* Convert an instance of ServerMetrics to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,80 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.annotations.SerializedName;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* Gets or Sets ServerStatus
*/
@JsonAdapter(ServerStatus.Adapter.class)
public enum ServerStatus {
UNKNOWN("unknown"),
OFFLINE("offline"),
ONLINE("online");
private String value;
ServerStatus(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static ServerStatus fromValue(String value) {
for (ServerStatus b : ServerStatus.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter<ServerStatus> {
@Override
public void write(final JsonWriter jsonWriter, final ServerStatus enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public ServerStatus read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return ServerStatus.fromValue(value);
}
}
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
ServerStatus.fromValue(value);
}
}

View file

@ -0,0 +1,391 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.time.OffsetDateTime;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
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;
/**
* Subscription
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class Subscription {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
@javax.annotation.Nullable
private String id;
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
@javax.annotation.Nullable
private String name;
public static final String SERIALIZED_NAME_DESCRIPTION = "description";
@SerializedName(SERIALIZED_NAME_DESCRIPTION)
@javax.annotation.Nullable
private String description;
public static final String SERIALIZED_NAME_IMAGE_URL = "image_url";
@SerializedName(SERIALIZED_NAME_IMAGE_URL)
@javax.annotation.Nullable
private String imageUrl;
public static final String SERIALIZED_NAME_PRICES = "prices";
@SerializedName(SERIALIZED_NAME_PRICES)
@javax.annotation.Nullable
private Map<String, Double> prices;
public static final String SERIALIZED_NAME_CREATED = "created";
@SerializedName(SERIALIZED_NAME_CREATED)
@javax.annotation.Nullable
private OffsetDateTime created;
public static final String SERIALIZED_NAME_UPDATED = "updated";
@SerializedName(SERIALIZED_NAME_UPDATED)
@javax.annotation.Nullable
private OffsetDateTime updated;
public Subscription() {
}
public Subscription(
Map<String, Double> prices
) {
this();
this.prices = prices;
}
public Subscription id(@javax.annotation.Nullable String id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@javax.annotation.Nullable
public String getId() {
return id;
}
public void setId(@javax.annotation.Nullable String id) {
this.id = id;
}
public Subscription name(@javax.annotation.Nullable String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
*/
@javax.annotation.Nullable
public String getName() {
return name;
}
public void setName(@javax.annotation.Nullable String name) {
this.name = name;
}
public Subscription description(@javax.annotation.Nullable String description) {
this.description = description;
return this;
}
/**
* Get description
* @return description
*/
@javax.annotation.Nullable
public String getDescription() {
return description;
}
public void setDescription(@javax.annotation.Nullable String description) {
this.description = description;
}
public Subscription imageUrl(@javax.annotation.Nullable String imageUrl) {
this.imageUrl = imageUrl;
return this;
}
/**
* Get imageUrl
* @return imageUrl
*/
@javax.annotation.Nullable
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(@javax.annotation.Nullable String imageUrl) {
this.imageUrl = imageUrl;
}
/**
* Get prices
* @return prices
*/
@javax.annotation.Nullable
public Map<String, Double> getPrices() {
return prices;
}
public Subscription created(@javax.annotation.Nullable OffsetDateTime created) {
this.created = created;
return this;
}
/**
* Get created
* @return created
*/
@javax.annotation.Nullable
public OffsetDateTime getCreated() {
return created;
}
public void setCreated(@javax.annotation.Nullable OffsetDateTime created) {
this.created = created;
}
public Subscription updated(@javax.annotation.Nullable OffsetDateTime updated) {
this.updated = updated;
return this;
}
/**
* Get updated
* @return updated
*/
@javax.annotation.Nullable
public OffsetDateTime getUpdated() {
return updated;
}
public void setUpdated(@javax.annotation.Nullable OffsetDateTime updated) {
this.updated = updated;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Subscription subscription = (Subscription) o;
return Objects.equals(this.id, subscription.id) &&
Objects.equals(this.name, subscription.name) &&
Objects.equals(this.description, subscription.description) &&
Objects.equals(this.imageUrl, subscription.imageUrl) &&
Objects.equals(this.prices, subscription.prices) &&
Objects.equals(this.created, subscription.created) &&
Objects.equals(this.updated, subscription.updated);
}
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(id, name, description, imageUrl, prices, created, updated);
}
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 Subscription {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" imageUrl: ").append(toIndentedString(imageUrl)).append("\n");
sb.append(" prices: ").append(toIndentedString(prices)).append("\n");
sb.append(" created: ").append(toIndentedString(created)).append("\n");
sb.append(" updated: ").append(toIndentedString(updated)).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("id");
openapiFields.add("name");
openapiFields.add("description");
openapiFields.add("image_url");
openapiFields.add("prices");
openapiFields.add("created");
openapiFields.add("updated");
// 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 Subscription
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!Subscription.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in Subscription is not found in the empty JSON string", Subscription.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 (!Subscription.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Subscription` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString()));
}
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
}
if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString()));
}
if ((jsonObj.get("image_url") != null && !jsonObj.get("image_url").isJsonNull()) && !jsonObj.get("image_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `image_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("image_url").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!Subscription.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'Subscription' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<Subscription> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(Subscription.class));
return (TypeAdapter<T>) new TypeAdapter<Subscription>() {
@Override
public void write(JsonWriter out, Subscription value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public Subscription read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of Subscription given an JSON string
*
* @param jsonString JSON string
* @return An instance of Subscription
* @throws IOException if the JSON string is invalid with respect to Subscription
*/
public static Subscription fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, Subscription.class);
}
/**
* Convert an instance of Subscription to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,78 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.annotations.SerializedName;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* Gets or Sets TokenHintType
*/
@JsonAdapter(TokenHintType.Adapter.class)
public enum TokenHintType {
ACCESS_TOKEN("access_token"),
REFRESH_TOKEN("refresh_token");
private String value;
TokenHintType(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static TokenHintType fromValue(String value) {
for (TokenHintType b : TokenHintType.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter<TokenHintType> {
@Override
public void write(final JsonWriter jsonWriter, final TokenHintType enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public TokenHintType read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return TokenHintType.fromValue(value);
}
}
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
TokenHintType.fromValue(value);
}
}

View file

@ -0,0 +1,430 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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 com.tribufu.generated.models.GrantType;
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;
/**
* TokenRequest
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class TokenRequest {
public static final String SERIALIZED_NAME_GRANT_TYPE = "grant_type";
@SerializedName(SERIALIZED_NAME_GRANT_TYPE)
@javax.annotation.Nullable
private GrantType grantType;
public static final String SERIALIZED_NAME_CODE = "code";
@SerializedName(SERIALIZED_NAME_CODE)
@javax.annotation.Nullable
private String code;
public static final String SERIALIZED_NAME_USERNAME = "username";
@SerializedName(SERIALIZED_NAME_USERNAME)
@javax.annotation.Nullable
private String username;
public static final String SERIALIZED_NAME_PASSWORD = "password";
@SerializedName(SERIALIZED_NAME_PASSWORD)
@javax.annotation.Nullable
private String password;
public static final String SERIALIZED_NAME_REFRESH_TOKEN = "refresh_token";
@SerializedName(SERIALIZED_NAME_REFRESH_TOKEN)
@javax.annotation.Nullable
private String refreshToken;
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_REDIRECT_URI = "redirect_uri";
@SerializedName(SERIALIZED_NAME_REDIRECT_URI)
@javax.annotation.Nullable
private String redirectUri;
public static final String SERIALIZED_NAME_CODE_VERIFIER = "code_verifier";
@SerializedName(SERIALIZED_NAME_CODE_VERIFIER)
@javax.annotation.Nullable
private String codeVerifier;
public TokenRequest() {
}
public TokenRequest grantType(@javax.annotation.Nullable GrantType grantType) {
this.grantType = grantType;
return this;
}
/**
* Get grantType
* @return grantType
*/
@javax.annotation.Nullable
public GrantType getGrantType() {
return grantType;
}
public void setGrantType(@javax.annotation.Nullable GrantType grantType) {
this.grantType = grantType;
}
public TokenRequest code(@javax.annotation.Nullable String code) {
this.code = code;
return this;
}
/**
* Get code
* @return code
*/
@javax.annotation.Nullable
public String getCode() {
return code;
}
public void setCode(@javax.annotation.Nullable String code) {
this.code = code;
}
public TokenRequest 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 TokenRequest password(@javax.annotation.Nullable String password) {
this.password = password;
return this;
}
/**
* Get password
* @return password
*/
@javax.annotation.Nullable
public String getPassword() {
return password;
}
public void setPassword(@javax.annotation.Nullable String password) {
this.password = password;
}
public TokenRequest refreshToken(@javax.annotation.Nullable String refreshToken) {
this.refreshToken = refreshToken;
return this;
}
/**
* Get refreshToken
* @return refreshToken
*/
@javax.annotation.Nullable
public String getRefreshToken() {
return refreshToken;
}
public void setRefreshToken(@javax.annotation.Nullable String refreshToken) {
this.refreshToken = refreshToken;
}
public TokenRequest 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 TokenRequest redirectUri(@javax.annotation.Nullable String redirectUri) {
this.redirectUri = redirectUri;
return this;
}
/**
* Get redirectUri
* @return redirectUri
*/
@javax.annotation.Nullable
public String getRedirectUri() {
return redirectUri;
}
public void setRedirectUri(@javax.annotation.Nullable String redirectUri) {
this.redirectUri = redirectUri;
}
public TokenRequest codeVerifier(@javax.annotation.Nullable String codeVerifier) {
this.codeVerifier = codeVerifier;
return this;
}
/**
* Get codeVerifier
* @return codeVerifier
*/
@javax.annotation.Nullable
public String getCodeVerifier() {
return codeVerifier;
}
public void setCodeVerifier(@javax.annotation.Nullable String codeVerifier) {
this.codeVerifier = codeVerifier;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
TokenRequest tokenRequest = (TokenRequest) o;
return Objects.equals(this.grantType, tokenRequest.grantType) &&
Objects.equals(this.code, tokenRequest.code) &&
Objects.equals(this.username, tokenRequest.username) &&
Objects.equals(this.password, tokenRequest.password) &&
Objects.equals(this.refreshToken, tokenRequest.refreshToken) &&
Objects.equals(this.clientId, tokenRequest.clientId) &&
Objects.equals(this.redirectUri, tokenRequest.redirectUri) &&
Objects.equals(this.codeVerifier, tokenRequest.codeVerifier);
}
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(grantType, code, username, password, refreshToken, clientId, redirectUri, codeVerifier);
}
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 TokenRequest {\n");
sb.append(" grantType: ").append(toIndentedString(grantType)).append("\n");
sb.append(" code: ").append(toIndentedString(code)).append("\n");
sb.append(" username: ").append(toIndentedString(username)).append("\n");
sb.append(" password: ").append(toIndentedString(password)).append("\n");
sb.append(" refreshToken: ").append(toIndentedString(refreshToken)).append("\n");
sb.append(" clientId: ").append(toIndentedString(clientId)).append("\n");
sb.append(" redirectUri: ").append(toIndentedString(redirectUri)).append("\n");
sb.append(" codeVerifier: ").append(toIndentedString(codeVerifier)).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("grant_type");
openapiFields.add("code");
openapiFields.add("username");
openapiFields.add("password");
openapiFields.add("refresh_token");
openapiFields.add("client_id");
openapiFields.add("redirect_uri");
openapiFields.add("code_verifier");
// 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 TokenRequest
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!TokenRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in TokenRequest is not found in the empty JSON string", TokenRequest.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 (!TokenRequest.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TokenRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
// validate the optional field `grant_type`
if (jsonObj.get("grant_type") != null && !jsonObj.get("grant_type").isJsonNull()) {
GrantType.validateJsonElement(jsonObj.get("grant_type"));
}
if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").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("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString()));
}
if ((jsonObj.get("refresh_token") != null && !jsonObj.get("refresh_token").isJsonNull()) && !jsonObj.get("refresh_token").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `refresh_token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("refresh_token").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("redirect_uri") != null && !jsonObj.get("redirect_uri").isJsonNull()) && !jsonObj.get("redirect_uri").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `redirect_uri` to be a primitive type in the JSON string but got `%s`", jsonObj.get("redirect_uri").toString()));
}
if ((jsonObj.get("code_verifier") != null && !jsonObj.get("code_verifier").isJsonNull()) && !jsonObj.get("code_verifier").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `code_verifier` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code_verifier").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!TokenRequest.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'TokenRequest' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<TokenRequest> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(TokenRequest.class));
return (TypeAdapter<T>) new TypeAdapter<TokenRequest>() {
@Override
public void write(JsonWriter out, TokenRequest value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public TokenRequest read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of TokenRequest given an JSON string
*
* @param jsonString JSON string
* @return An instance of TokenRequest
* @throws IOException if the JSON string is invalid with respect to TokenRequest
*/
public static TokenRequest fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, TokenRequest.class);
}
/**
* Convert an instance of TokenRequest to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,367 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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 com.tribufu.generated.models.TokenType;
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;
/**
* TokenResponse
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class TokenResponse {
public static final String SERIALIZED_NAME_TOKEN_TYPE = "token_type";
@SerializedName(SERIALIZED_NAME_TOKEN_TYPE)
@javax.annotation.Nullable
private TokenType tokenType;
public static final String SERIALIZED_NAME_ACCESS_TOKEN = "access_token";
@SerializedName(SERIALIZED_NAME_ACCESS_TOKEN)
@javax.annotation.Nullable
private String accessToken;
public static final String SERIALIZED_NAME_REFRESH_TOKEN = "refresh_token";
@SerializedName(SERIALIZED_NAME_REFRESH_TOKEN)
@javax.annotation.Nullable
private String refreshToken;
public static final String SERIALIZED_NAME_SCOPE = "scope";
@SerializedName(SERIALIZED_NAME_SCOPE)
@javax.annotation.Nullable
private String scope;
public static final String SERIALIZED_NAME_STATE = "state";
@SerializedName(SERIALIZED_NAME_STATE)
@javax.annotation.Nullable
private String state;
public static final String SERIALIZED_NAME_EXPIRES_IN = "expires_in";
@SerializedName(SERIALIZED_NAME_EXPIRES_IN)
@javax.annotation.Nullable
private Long expiresIn;
public TokenResponse() {
}
public TokenResponse tokenType(@javax.annotation.Nullable TokenType tokenType) {
this.tokenType = tokenType;
return this;
}
/**
* Get tokenType
* @return tokenType
*/
@javax.annotation.Nullable
public TokenType getTokenType() {
return tokenType;
}
public void setTokenType(@javax.annotation.Nullable TokenType tokenType) {
this.tokenType = tokenType;
}
public TokenResponse accessToken(@javax.annotation.Nullable String accessToken) {
this.accessToken = accessToken;
return this;
}
/**
* Get accessToken
* @return accessToken
*/
@javax.annotation.Nullable
public String getAccessToken() {
return accessToken;
}
public void setAccessToken(@javax.annotation.Nullable String accessToken) {
this.accessToken = accessToken;
}
public TokenResponse refreshToken(@javax.annotation.Nullable String refreshToken) {
this.refreshToken = refreshToken;
return this;
}
/**
* Get refreshToken
* @return refreshToken
*/
@javax.annotation.Nullable
public String getRefreshToken() {
return refreshToken;
}
public void setRefreshToken(@javax.annotation.Nullable String refreshToken) {
this.refreshToken = refreshToken;
}
public TokenResponse 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 TokenResponse state(@javax.annotation.Nullable String state) {
this.state = state;
return this;
}
/**
* Get state
* @return state
*/
@javax.annotation.Nullable
public String getState() {
return state;
}
public void setState(@javax.annotation.Nullable String state) {
this.state = state;
}
public TokenResponse expiresIn(@javax.annotation.Nullable Long expiresIn) {
this.expiresIn = expiresIn;
return this;
}
/**
* Get expiresIn
* @return expiresIn
*/
@javax.annotation.Nullable
public Long getExpiresIn() {
return expiresIn;
}
public void setExpiresIn(@javax.annotation.Nullable Long expiresIn) {
this.expiresIn = expiresIn;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
TokenResponse tokenResponse = (TokenResponse) o;
return Objects.equals(this.tokenType, tokenResponse.tokenType) &&
Objects.equals(this.accessToken, tokenResponse.accessToken) &&
Objects.equals(this.refreshToken, tokenResponse.refreshToken) &&
Objects.equals(this.scope, tokenResponse.scope) &&
Objects.equals(this.state, tokenResponse.state) &&
Objects.equals(this.expiresIn, tokenResponse.expiresIn);
}
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(tokenType, accessToken, refreshToken, scope, state, expiresIn);
}
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 TokenResponse {\n");
sb.append(" tokenType: ").append(toIndentedString(tokenType)).append("\n");
sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n");
sb.append(" refreshToken: ").append(toIndentedString(refreshToken)).append("\n");
sb.append(" scope: ").append(toIndentedString(scope)).append("\n");
sb.append(" state: ").append(toIndentedString(state)).append("\n");
sb.append(" expiresIn: ").append(toIndentedString(expiresIn)).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("token_type");
openapiFields.add("access_token");
openapiFields.add("refresh_token");
openapiFields.add("scope");
openapiFields.add("state");
openapiFields.add("expires_in");
// 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 TokenResponse
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!TokenResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in TokenResponse is not found in the empty JSON string", TokenResponse.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 (!TokenResponse.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TokenResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
// validate the optional field `token_type`
if (jsonObj.get("token_type") != null && !jsonObj.get("token_type").isJsonNull()) {
TokenType.validateJsonElement(jsonObj.get("token_type"));
}
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()));
}
if ((jsonObj.get("refresh_token") != null && !jsonObj.get("refresh_token").isJsonNull()) && !jsonObj.get("refresh_token").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `refresh_token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("refresh_token").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("state") != null && !jsonObj.get("state").isJsonNull()) && !jsonObj.get("state").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!TokenResponse.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'TokenResponse' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<TokenResponse> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(TokenResponse.class));
return (TypeAdapter<T>) new TypeAdapter<TokenResponse>() {
@Override
public void write(JsonWriter out, TokenResponse value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public TokenResponse read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of TokenResponse given an JSON string
*
* @param jsonString JSON string
* @return An instance of TokenResponse
* @throws IOException if the JSON string is invalid with respect to TokenResponse
*/
public static TokenResponse fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, TokenResponse.class);
}
/**
* Convert an instance of TokenResponse to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,76 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.annotations.SerializedName;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* Gets or Sets TokenType
*/
@JsonAdapter(TokenType.Adapter.class)
public enum TokenType {
BEARER("bearer");
private String value;
TokenType(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static TokenType fromValue(String value) {
for (TokenType b : TokenType.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter<TokenType> {
@Override
public void write(final JsonWriter jsonWriter, final TokenType enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public TokenType read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return TokenType.fromValue(value);
}
}
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
TokenType.fromValue(value);
}
}

View file

@ -0,0 +1,248 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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;
/**
* UpdateProfile
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class UpdateProfile {
public static final String SERIALIZED_NAME_DISPLAY_NAME = "display_name";
@SerializedName(SERIALIZED_NAME_DISPLAY_NAME)
@javax.annotation.Nullable
private String displayName;
public static final String SERIALIZED_NAME_BIOGRAPHY = "biography";
@SerializedName(SERIALIZED_NAME_BIOGRAPHY)
@javax.annotation.Nullable
private String biography;
public UpdateProfile() {
}
public UpdateProfile displayName(@javax.annotation.Nullable String displayName) {
this.displayName = displayName;
return this;
}
/**
* Get displayName
* @return displayName
*/
@javax.annotation.Nullable
public String getDisplayName() {
return displayName;
}
public void setDisplayName(@javax.annotation.Nullable String displayName) {
this.displayName = displayName;
}
public UpdateProfile biography(@javax.annotation.Nullable String biography) {
this.biography = biography;
return this;
}
/**
* Get biography
* @return biography
*/
@javax.annotation.Nullable
public String getBiography() {
return biography;
}
public void setBiography(@javax.annotation.Nullable String biography) {
this.biography = biography;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
UpdateProfile updateProfile = (UpdateProfile) o;
return Objects.equals(this.displayName, updateProfile.displayName) &&
Objects.equals(this.biography, updateProfile.biography);
}
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(displayName, biography);
}
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 UpdateProfile {\n");
sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n");
sb.append(" biography: ").append(toIndentedString(biography)).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("display_name");
openapiFields.add("biography");
// 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 UpdateProfile
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!UpdateProfile.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateProfile is not found in the empty JSON string", UpdateProfile.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 (!UpdateProfile.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateProfile` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("display_name") != null && !jsonObj.get("display_name").isJsonNull()) && !jsonObj.get("display_name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `display_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("display_name").toString()));
}
if ((jsonObj.get("biography") != null && !jsonObj.get("biography").isJsonNull()) && !jsonObj.get("biography").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `biography` to be a primitive type in the JSON string but got `%s`", jsonObj.get("biography").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!UpdateProfile.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'UpdateProfile' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<UpdateProfile> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(UpdateProfile.class));
return (TypeAdapter<T>) new TypeAdapter<UpdateProfile>() {
@Override
public void write(JsonWriter out, UpdateProfile value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public UpdateProfile read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of UpdateProfile given an JSON string
*
* @param jsonString JSON string
* @return An instance of UpdateProfile
* @throws IOException if the JSON string is invalid with respect to UpdateProfile
*/
public static UpdateProfile fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, UpdateProfile.class);
}
/**
* Convert an instance of UpdateProfile to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,913 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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 com.tribufu.generated.models.UserType;
import java.io.IOException;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Arrays;
import java.util.UUID;
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;
/**
* UserInfo
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class UserInfo {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
@javax.annotation.Nullable
private String id;
public static final String SERIALIZED_NAME_UUID = "uuid";
@SerializedName(SERIALIZED_NAME_UUID)
@javax.annotation.Nullable
private UUID uuid;
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
@javax.annotation.Nullable
private String name;
public static final String SERIALIZED_NAME_DISPLAY_NAME = "display_name";
@SerializedName(SERIALIZED_NAME_DISPLAY_NAME)
@javax.annotation.Nullable
private String displayName;
public static final String SERIALIZED_NAME_EMAIL = "email";
@SerializedName(SERIALIZED_NAME_EMAIL)
@javax.annotation.Nullable
private String email;
public static final String SERIALIZED_NAME_TYPE = "type";
@SerializedName(SERIALIZED_NAME_TYPE)
@javax.annotation.Nullable
private UserType type;
public static final String SERIALIZED_NAME_FLAGS = "flags";
@SerializedName(SERIALIZED_NAME_FLAGS)
@javax.annotation.Nullable
private String flags;
public static final String SERIALIZED_NAME_PERMISSIONS = "permissions";
@SerializedName(SERIALIZED_NAME_PERMISSIONS)
@javax.annotation.Nullable
private String permissions;
public static final String SERIALIZED_NAME_VERIFIED = "verified";
@SerializedName(SERIALIZED_NAME_VERIFIED)
@javax.annotation.Nullable
private Boolean verified;
public static final String SERIALIZED_NAME_LEVEL = "level";
@SerializedName(SERIALIZED_NAME_LEVEL)
@javax.annotation.Nullable
private Integer level;
public static final String SERIALIZED_NAME_EXPERIENCE = "experience";
@SerializedName(SERIALIZED_NAME_EXPERIENCE)
@javax.annotation.Nullable
private Double experience;
public static final String SERIALIZED_NAME_PUBLIC_BIRTHDAY = "public_birthday";
@SerializedName(SERIALIZED_NAME_PUBLIC_BIRTHDAY)
@javax.annotation.Nullable
private Boolean publicBirthday;
public static final String SERIALIZED_NAME_BIRTHDAY = "birthday";
@SerializedName(SERIALIZED_NAME_BIRTHDAY)
@javax.annotation.Nullable
private LocalDate birthday;
public static final String SERIALIZED_NAME_POINTS = "points";
@SerializedName(SERIALIZED_NAME_POINTS)
@javax.annotation.Nullable
private Double points;
public static final String SERIALIZED_NAME_LOCATION = "location";
@SerializedName(SERIALIZED_NAME_LOCATION)
@javax.annotation.Nullable
private String location;
public static final String SERIALIZED_NAME_LANGUAGE = "language";
@SerializedName(SERIALIZED_NAME_LANGUAGE)
@javax.annotation.Nullable
private String language;
public static final String SERIALIZED_NAME_TIMEZONE = "timezone";
@SerializedName(SERIALIZED_NAME_TIMEZONE)
@javax.annotation.Nullable
private String timezone;
public static final String SERIALIZED_NAME_CURRENCY = "currency";
@SerializedName(SERIALIZED_NAME_CURRENCY)
@javax.annotation.Nullable
private String currency;
public static final String SERIALIZED_NAME_PHOTO_URL = "photo_url";
@SerializedName(SERIALIZED_NAME_PHOTO_URL)
@javax.annotation.Nullable
private String photoUrl;
public static final String SERIALIZED_NAME_BANNER_URL = "banner_url";
@SerializedName(SERIALIZED_NAME_BANNER_URL)
@javax.annotation.Nullable
private String bannerUrl;
public static final String SERIALIZED_NAME_LAST_ONLINE = "last_online";
@SerializedName(SERIALIZED_NAME_LAST_ONLINE)
@javax.annotation.Nullable
private OffsetDateTime lastOnline;
public static final String SERIALIZED_NAME_BIOGRAPHY = "biography";
@SerializedName(SERIALIZED_NAME_BIOGRAPHY)
@javax.annotation.Nullable
private String biography;
public static final String SERIALIZED_NAME_VIEW_COUNT = "view_count";
@SerializedName(SERIALIZED_NAME_VIEW_COUNT)
@javax.annotation.Nullable
private Integer viewCount;
public static final String SERIALIZED_NAME_CREATED = "created";
@SerializedName(SERIALIZED_NAME_CREATED)
@javax.annotation.Nullable
private OffsetDateTime created;
public static final String SERIALIZED_NAME_UPDATED = "updated";
@SerializedName(SERIALIZED_NAME_UPDATED)
@javax.annotation.Nullable
private OffsetDateTime updated;
public UserInfo() {
}
public UserInfo id(@javax.annotation.Nullable String id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@javax.annotation.Nullable
public String getId() {
return id;
}
public void setId(@javax.annotation.Nullable String id) {
this.id = id;
}
public UserInfo uuid(@javax.annotation.Nullable UUID uuid) {
this.uuid = uuid;
return this;
}
/**
* Get uuid
* @return uuid
*/
@javax.annotation.Nullable
public UUID getUuid() {
return uuid;
}
public void setUuid(@javax.annotation.Nullable UUID uuid) {
this.uuid = uuid;
}
public UserInfo name(@javax.annotation.Nullable String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
*/
@javax.annotation.Nullable
public String getName() {
return name;
}
public void setName(@javax.annotation.Nullable String name) {
this.name = name;
}
public UserInfo displayName(@javax.annotation.Nullable String displayName) {
this.displayName = displayName;
return this;
}
/**
* Get displayName
* @return displayName
*/
@javax.annotation.Nullable
public String getDisplayName() {
return displayName;
}
public void setDisplayName(@javax.annotation.Nullable String displayName) {
this.displayName = displayName;
}
public UserInfo email(@javax.annotation.Nullable String email) {
this.email = email;
return this;
}
/**
* Get email
* @return email
*/
@javax.annotation.Nullable
public String getEmail() {
return email;
}
public void setEmail(@javax.annotation.Nullable String email) {
this.email = email;
}
public UserInfo type(@javax.annotation.Nullable UserType type) {
this.type = type;
return this;
}
/**
* Get type
* @return type
*/
@javax.annotation.Nullable
public UserType getType() {
return type;
}
public void setType(@javax.annotation.Nullable UserType type) {
this.type = type;
}
public UserInfo flags(@javax.annotation.Nullable String flags) {
this.flags = flags;
return this;
}
/**
* Get flags
* @return flags
*/
@javax.annotation.Nullable
public String getFlags() {
return flags;
}
public void setFlags(@javax.annotation.Nullable String flags) {
this.flags = flags;
}
public UserInfo permissions(@javax.annotation.Nullable String permissions) {
this.permissions = permissions;
return this;
}
/**
* Get permissions
* @return permissions
*/
@javax.annotation.Nullable
public String getPermissions() {
return permissions;
}
public void setPermissions(@javax.annotation.Nullable String permissions) {
this.permissions = permissions;
}
public UserInfo verified(@javax.annotation.Nullable Boolean verified) {
this.verified = verified;
return this;
}
/**
* Get verified
* @return verified
*/
@javax.annotation.Nullable
public Boolean getVerified() {
return verified;
}
public void setVerified(@javax.annotation.Nullable Boolean verified) {
this.verified = verified;
}
public UserInfo level(@javax.annotation.Nullable Integer level) {
this.level = level;
return this;
}
/**
* Get level
* @return level
*/
@javax.annotation.Nullable
public Integer getLevel() {
return level;
}
public void setLevel(@javax.annotation.Nullable Integer level) {
this.level = level;
}
public UserInfo experience(@javax.annotation.Nullable Double experience) {
this.experience = experience;
return this;
}
/**
* Get experience
* @return experience
*/
@javax.annotation.Nullable
public Double getExperience() {
return experience;
}
public void setExperience(@javax.annotation.Nullable Double experience) {
this.experience = experience;
}
public UserInfo publicBirthday(@javax.annotation.Nullable Boolean publicBirthday) {
this.publicBirthday = publicBirthday;
return this;
}
/**
* Get publicBirthday
* @return publicBirthday
*/
@javax.annotation.Nullable
public Boolean getPublicBirthday() {
return publicBirthday;
}
public void setPublicBirthday(@javax.annotation.Nullable Boolean publicBirthday) {
this.publicBirthday = publicBirthday;
}
public UserInfo birthday(@javax.annotation.Nullable LocalDate birthday) {
this.birthday = birthday;
return this;
}
/**
* Get birthday
* @return birthday
*/
@javax.annotation.Nullable
public LocalDate getBirthday() {
return birthday;
}
public void setBirthday(@javax.annotation.Nullable LocalDate birthday) {
this.birthday = birthday;
}
public UserInfo points(@javax.annotation.Nullable Double points) {
this.points = points;
return this;
}
/**
* Get points
* @return points
*/
@javax.annotation.Nullable
public Double getPoints() {
return points;
}
public void setPoints(@javax.annotation.Nullable Double points) {
this.points = points;
}
public UserInfo location(@javax.annotation.Nullable String location) {
this.location = location;
return this;
}
/**
* Get location
* @return location
*/
@javax.annotation.Nullable
public String getLocation() {
return location;
}
public void setLocation(@javax.annotation.Nullable String location) {
this.location = location;
}
public UserInfo language(@javax.annotation.Nullable String language) {
this.language = language;
return this;
}
/**
* Get language
* @return language
*/
@javax.annotation.Nullable
public String getLanguage() {
return language;
}
public void setLanguage(@javax.annotation.Nullable String language) {
this.language = language;
}
public UserInfo timezone(@javax.annotation.Nullable String timezone) {
this.timezone = timezone;
return this;
}
/**
* Get timezone
* @return timezone
*/
@javax.annotation.Nullable
public String getTimezone() {
return timezone;
}
public void setTimezone(@javax.annotation.Nullable String timezone) {
this.timezone = timezone;
}
public UserInfo currency(@javax.annotation.Nullable String currency) {
this.currency = currency;
return this;
}
/**
* Get currency
* @return currency
*/
@javax.annotation.Nullable
public String getCurrency() {
return currency;
}
public void setCurrency(@javax.annotation.Nullable String currency) {
this.currency = currency;
}
public UserInfo photoUrl(@javax.annotation.Nullable String photoUrl) {
this.photoUrl = photoUrl;
return this;
}
/**
* Get photoUrl
* @return photoUrl
*/
@javax.annotation.Nullable
public String getPhotoUrl() {
return photoUrl;
}
public void setPhotoUrl(@javax.annotation.Nullable String photoUrl) {
this.photoUrl = photoUrl;
}
public UserInfo bannerUrl(@javax.annotation.Nullable String bannerUrl) {
this.bannerUrl = bannerUrl;
return this;
}
/**
* Get bannerUrl
* @return bannerUrl
*/
@javax.annotation.Nullable
public String getBannerUrl() {
return bannerUrl;
}
public void setBannerUrl(@javax.annotation.Nullable String bannerUrl) {
this.bannerUrl = bannerUrl;
}
public UserInfo lastOnline(@javax.annotation.Nullable OffsetDateTime lastOnline) {
this.lastOnline = lastOnline;
return this;
}
/**
* Get lastOnline
* @return lastOnline
*/
@javax.annotation.Nullable
public OffsetDateTime getLastOnline() {
return lastOnline;
}
public void setLastOnline(@javax.annotation.Nullable OffsetDateTime lastOnline) {
this.lastOnline = lastOnline;
}
public UserInfo biography(@javax.annotation.Nullable String biography) {
this.biography = biography;
return this;
}
/**
* Get biography
* @return biography
*/
@javax.annotation.Nullable
public String getBiography() {
return biography;
}
public void setBiography(@javax.annotation.Nullable String biography) {
this.biography = biography;
}
public UserInfo viewCount(@javax.annotation.Nullable Integer viewCount) {
this.viewCount = viewCount;
return this;
}
/**
* Get viewCount
* @return viewCount
*/
@javax.annotation.Nullable
public Integer getViewCount() {
return viewCount;
}
public void setViewCount(@javax.annotation.Nullable Integer viewCount) {
this.viewCount = viewCount;
}
public UserInfo created(@javax.annotation.Nullable OffsetDateTime created) {
this.created = created;
return this;
}
/**
* Get created
* @return created
*/
@javax.annotation.Nullable
public OffsetDateTime getCreated() {
return created;
}
public void setCreated(@javax.annotation.Nullable OffsetDateTime created) {
this.created = created;
}
public UserInfo updated(@javax.annotation.Nullable OffsetDateTime updated) {
this.updated = updated;
return this;
}
/**
* Get updated
* @return updated
*/
@javax.annotation.Nullable
public OffsetDateTime getUpdated() {
return updated;
}
public void setUpdated(@javax.annotation.Nullable OffsetDateTime updated) {
this.updated = updated;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
UserInfo userInfo = (UserInfo) o;
return Objects.equals(this.id, userInfo.id) &&
Objects.equals(this.uuid, userInfo.uuid) &&
Objects.equals(this.name, userInfo.name) &&
Objects.equals(this.displayName, userInfo.displayName) &&
Objects.equals(this.email, userInfo.email) &&
Objects.equals(this.type, userInfo.type) &&
Objects.equals(this.flags, userInfo.flags) &&
Objects.equals(this.permissions, userInfo.permissions) &&
Objects.equals(this.verified, userInfo.verified) &&
Objects.equals(this.level, userInfo.level) &&
Objects.equals(this.experience, userInfo.experience) &&
Objects.equals(this.publicBirthday, userInfo.publicBirthday) &&
Objects.equals(this.birthday, userInfo.birthday) &&
Objects.equals(this.points, userInfo.points) &&
Objects.equals(this.location, userInfo.location) &&
Objects.equals(this.language, userInfo.language) &&
Objects.equals(this.timezone, userInfo.timezone) &&
Objects.equals(this.currency, userInfo.currency) &&
Objects.equals(this.photoUrl, userInfo.photoUrl) &&
Objects.equals(this.bannerUrl, userInfo.bannerUrl) &&
Objects.equals(this.lastOnline, userInfo.lastOnline) &&
Objects.equals(this.biography, userInfo.biography) &&
Objects.equals(this.viewCount, userInfo.viewCount) &&
Objects.equals(this.created, userInfo.created) &&
Objects.equals(this.updated, userInfo.updated);
}
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(id, uuid, name, displayName, email, type, flags, permissions, verified, level, experience, publicBirthday, birthday, points, location, language, timezone, currency, photoUrl, bannerUrl, lastOnline, biography, viewCount, created, updated);
}
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 UserInfo {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n");
sb.append(" email: ").append(toIndentedString(email)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" flags: ").append(toIndentedString(flags)).append("\n");
sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n");
sb.append(" verified: ").append(toIndentedString(verified)).append("\n");
sb.append(" level: ").append(toIndentedString(level)).append("\n");
sb.append(" experience: ").append(toIndentedString(experience)).append("\n");
sb.append(" publicBirthday: ").append(toIndentedString(publicBirthday)).append("\n");
sb.append(" birthday: ").append(toIndentedString(birthday)).append("\n");
sb.append(" points: ").append(toIndentedString(points)).append("\n");
sb.append(" location: ").append(toIndentedString(location)).append("\n");
sb.append(" language: ").append(toIndentedString(language)).append("\n");
sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n");
sb.append(" currency: ").append(toIndentedString(currency)).append("\n");
sb.append(" photoUrl: ").append(toIndentedString(photoUrl)).append("\n");
sb.append(" bannerUrl: ").append(toIndentedString(bannerUrl)).append("\n");
sb.append(" lastOnline: ").append(toIndentedString(lastOnline)).append("\n");
sb.append(" biography: ").append(toIndentedString(biography)).append("\n");
sb.append(" viewCount: ").append(toIndentedString(viewCount)).append("\n");
sb.append(" created: ").append(toIndentedString(created)).append("\n");
sb.append(" updated: ").append(toIndentedString(updated)).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("id");
openapiFields.add("uuid");
openapiFields.add("name");
openapiFields.add("display_name");
openapiFields.add("email");
openapiFields.add("type");
openapiFields.add("flags");
openapiFields.add("permissions");
openapiFields.add("verified");
openapiFields.add("level");
openapiFields.add("experience");
openapiFields.add("public_birthday");
openapiFields.add("birthday");
openapiFields.add("points");
openapiFields.add("location");
openapiFields.add("language");
openapiFields.add("timezone");
openapiFields.add("currency");
openapiFields.add("photo_url");
openapiFields.add("banner_url");
openapiFields.add("last_online");
openapiFields.add("biography");
openapiFields.add("view_count");
openapiFields.add("created");
openapiFields.add("updated");
// 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 UserInfo
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!UserInfo.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in UserInfo is not found in the empty JSON string", UserInfo.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 (!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()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString()));
}
if ((jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString()));
}
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
}
if ((jsonObj.get("display_name") != null && !jsonObj.get("display_name").isJsonNull()) && !jsonObj.get("display_name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `display_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("display_name").toString()));
}
if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString()));
}
// validate the optional field `type`
if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) {
UserType.validateJsonElement(jsonObj.get("type"));
}
if ((jsonObj.get("flags") != null && !jsonObj.get("flags").isJsonNull()) && !jsonObj.get("flags").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `flags` to be a primitive type in the JSON string but got `%s`", jsonObj.get("flags").toString()));
}
if ((jsonObj.get("permissions") != null && !jsonObj.get("permissions").isJsonNull()) && !jsonObj.get("permissions").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `permissions` to be a primitive type in the JSON string but got `%s`", jsonObj.get("permissions").toString()));
}
if ((jsonObj.get("location") != null && !jsonObj.get("location").isJsonNull()) && !jsonObj.get("location").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `location` to be a primitive type in the JSON string but got `%s`", jsonObj.get("location").toString()));
}
if ((jsonObj.get("language") != null && !jsonObj.get("language").isJsonNull()) && !jsonObj.get("language").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString()));
}
if ((jsonObj.get("timezone") != null && !jsonObj.get("timezone").isJsonNull()) && !jsonObj.get("timezone").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `timezone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timezone").toString()));
}
if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString()));
}
if ((jsonObj.get("photo_url") != null && !jsonObj.get("photo_url").isJsonNull()) && !jsonObj.get("photo_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `photo_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("photo_url").toString()));
}
if ((jsonObj.get("banner_url") != null && !jsonObj.get("banner_url").isJsonNull()) && !jsonObj.get("banner_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `banner_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("banner_url").toString()));
}
if ((jsonObj.get("biography") != null && !jsonObj.get("biography").isJsonNull()) && !jsonObj.get("biography").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `biography` to be a primitive type in the JSON string but got `%s`", jsonObj.get("biography").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!UserInfo.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'UserInfo' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<UserInfo> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(UserInfo.class));
return (TypeAdapter<T>) new TypeAdapter<UserInfo>() {
@Override
public void write(JsonWriter out, UserInfo value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public UserInfo read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of UserInfo given an JSON string
*
* @param jsonString JSON string
* @return An instance of UserInfo
* @throws IOException if the JSON string is invalid with respect to UserInfo
*/
public static UserInfo fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, UserInfo.class);
}
/**
* Convert an instance of UserInfo to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

View file

@ -0,0 +1,78 @@
/*
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* 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.annotations.SerializedName;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* Gets or Sets UserType
*/
@JsonAdapter(UserType.Adapter.class)
public enum UserType {
USER("user"),
BOT("bot");
private String value;
UserType(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static UserType fromValue(String value) {
for (UserType b : UserType.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter<UserType> {
@Override
public void write(final JsonWriter jsonWriter, final UserType enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public UserType read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return UserType.fromValue(value);
}
}
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
String value = jsonElement.getAsString();
UserType.fromValue(value);
}
}