mirror of
https://github.com/tribufu/tribufu-java
synced 2026-05-06 06:47:27 +00:00
Merge branch 'main' of https://github.com/tribufu/sdk-jvm
This commit is contained in:
commit
dfddc79ff4
92 changed files with 28324 additions and 808 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -1,6 +1,5 @@
|
|||
.bloop/
|
||||
.gradle/
|
||||
.gradle/
|
||||
.idea/
|
||||
.metals/
|
||||
.vscode/
|
||||
|
|
@ -8,3 +7,7 @@ bin/
|
|||
build/
|
||||
|
||||
.DS_Store
|
||||
.env
|
||||
*.filters
|
||||
*.user
|
||||
desktop.ini
|
||||
|
|
|
|||
17
.openapi-generator-ignore
Normal file
17
.openapi-generator-ignore
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
.github/
|
||||
docs/
|
||||
gradle/
|
||||
|
||||
.gitignore
|
||||
.travis.yml
|
||||
AndroidManifest.xml
|
||||
api/openapi.yaml
|
||||
build.gradle
|
||||
build.sbt
|
||||
git_push.sh
|
||||
gradle.properties
|
||||
gradlew
|
||||
gradlew.bat
|
||||
pom.xml
|
||||
README.md
|
||||
settings.gradle
|
||||
62
.openapi-generator/FILES
Normal file
62
.openapi-generator/FILES
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
src/main/AndroidManifest.xml
|
||||
src/main/java/com/tribufu/generated/ApiCallback.java
|
||||
src/main/java/com/tribufu/generated/ApiClient.java
|
||||
src/main/java/com/tribufu/generated/ApiException.java
|
||||
src/main/java/com/tribufu/generated/ApiResponse.java
|
||||
src/main/java/com/tribufu/generated/Configuration.java
|
||||
src/main/java/com/tribufu/generated/GzipRequestInterceptor.java
|
||||
src/main/java/com/tribufu/generated/JSON.java
|
||||
src/main/java/com/tribufu/generated/Pair.java
|
||||
src/main/java/com/tribufu/generated/ProgressRequestBody.java
|
||||
src/main/java/com/tribufu/generated/ProgressResponseBody.java
|
||||
src/main/java/com/tribufu/generated/ServerConfiguration.java
|
||||
src/main/java/com/tribufu/generated/ServerVariable.java
|
||||
src/main/java/com/tribufu/generated/StringUtil.java
|
||||
src/main/java/com/tribufu/generated/api/TribufuGeneratedApi.java
|
||||
src/main/java/com/tribufu/generated/auth/ApiKeyAuth.java
|
||||
src/main/java/com/tribufu/generated/auth/Authentication.java
|
||||
src/main/java/com/tribufu/generated/auth/HttpBasicAuth.java
|
||||
src/main/java/com/tribufu/generated/auth/HttpBearerAuth.java
|
||||
src/main/java/com/tribufu/generated/models/AbstractOpenApiSchema.java
|
||||
src/main/java/com/tribufu/generated/models/Account.java
|
||||
src/main/java/com/tribufu/generated/models/Application.java
|
||||
src/main/java/com/tribufu/generated/models/ApplicationType.java
|
||||
src/main/java/com/tribufu/generated/models/AuthorizeRequest.java
|
||||
src/main/java/com/tribufu/generated/models/CodeChallengeMethod.java
|
||||
src/main/java/com/tribufu/generated/models/CryptoViewModel.java
|
||||
src/main/java/com/tribufu/generated/models/Game.java
|
||||
src/main/java/com/tribufu/generated/models/GameServer.java
|
||||
src/main/java/com/tribufu/generated/models/GameServerCluster.java
|
||||
src/main/java/com/tribufu/generated/models/GrantType.java
|
||||
src/main/java/com/tribufu/generated/models/Group.java
|
||||
src/main/java/com/tribufu/generated/models/GroupGame.java
|
||||
src/main/java/com/tribufu/generated/models/GroupMember.java
|
||||
src/main/java/com/tribufu/generated/models/GroupRank.java
|
||||
src/main/java/com/tribufu/generated/models/HashViewModel.java
|
||||
src/main/java/com/tribufu/generated/models/IntrospectRequest.java
|
||||
src/main/java/com/tribufu/generated/models/IpAddress.java
|
||||
src/main/java/com/tribufu/generated/models/LeaderboardItem.java
|
||||
src/main/java/com/tribufu/generated/models/LeaderboardOrder.java
|
||||
src/main/java/com/tribufu/generated/models/LoginProvider.java
|
||||
src/main/java/com/tribufu/generated/models/LoginRequest.java
|
||||
src/main/java/com/tribufu/generated/models/LoginResponse.java
|
||||
src/main/java/com/tribufu/generated/models/ModelPackage.java
|
||||
src/main/java/com/tribufu/generated/models/Profile.java
|
||||
src/main/java/com/tribufu/generated/models/ProfileGame.java
|
||||
src/main/java/com/tribufu/generated/models/ProfileGroup.java
|
||||
src/main/java/com/tribufu/generated/models/RefreshRequest.java
|
||||
src/main/java/com/tribufu/generated/models/RegisterRequest.java
|
||||
src/main/java/com/tribufu/generated/models/ResponseType.java
|
||||
src/main/java/com/tribufu/generated/models/RevokeRequest.java
|
||||
src/main/java/com/tribufu/generated/models/SearchRequest.java
|
||||
src/main/java/com/tribufu/generated/models/SearchType.java
|
||||
src/main/java/com/tribufu/generated/models/ServerMetrics.java
|
||||
src/main/java/com/tribufu/generated/models/ServerStatus.java
|
||||
src/main/java/com/tribufu/generated/models/Subscription.java
|
||||
src/main/java/com/tribufu/generated/models/TokenHintType.java
|
||||
src/main/java/com/tribufu/generated/models/TokenRequest.java
|
||||
src/main/java/com/tribufu/generated/models/TokenResponse.java
|
||||
src/main/java/com/tribufu/generated/models/TokenType.java
|
||||
src/main/java/com/tribufu/generated/models/UpdateProfile.java
|
||||
src/main/java/com/tribufu/generated/models/UserInfo.java
|
||||
src/main/java/com/tribufu/generated/models/UserType.java
|
||||
1
.openapi-generator/VERSION
Normal file
1
.openapi-generator/VERSION
Normal file
|
|
@ -0,0 +1 @@
|
|||
7.12.0
|
||||
155
build.gradle
Normal file
155
build.gradle
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
apply plugin: "idea"
|
||||
apply plugin: "eclipse"
|
||||
apply plugin: "java"
|
||||
apply plugin: "com.diffplug.spotless"
|
||||
|
||||
group = "com.tribufu"
|
||||
version = "1.1.0"
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = "https://mvn.tribufu.com/releases" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:2.3.+"
|
||||
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.11.0"
|
||||
classpath "com.github.dcendents:android-maven-gradle-plugin:2.1"
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = "https://mvn.tribufu.com/releases" }
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main.java.srcDirs = ["src/main/java"]
|
||||
}
|
||||
|
||||
if(hasProperty("target") && target == "android") {
|
||||
apply plugin: "com.android.library"
|
||||
apply plugin: "com.github.dcendents.android-maven"
|
||||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion "25.0.2"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 25
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
libraryVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
def outputFile = output.outputFile
|
||||
if (outputFile != null && outputFile.name.endsWith(".aar")) {
|
||||
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
|
||||
output.outputFile = new File(outputFile.parent, fileName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
android.libraryVariants.all { variant ->
|
||||
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
|
||||
task.description = "Create jar artifact for ${variant.name}"
|
||||
task.dependsOn variant.javaCompile
|
||||
task.from variant.javaCompile.destinationDirectory
|
||||
task.destinationDirectory = project.file("${project.buildDir}/outputs/jar")
|
||||
task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar"
|
||||
artifacts.add("archives", task)
|
||||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
classifier = "sources"
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
}
|
||||
} else {
|
||||
apply plugin: "java"
|
||||
apply plugin: "maven-publish"
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
artifactId = "tribufu"
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task execute(type:JavaExec) {
|
||||
main = System.getProperty("mainClass")
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "com.google.code.findbugs:jsr305:3.0.2"
|
||||
implementation "com.google.code.gson:gson:2.9.1"
|
||||
implementation "com.squareup.okhttp3:logging-interceptor:4.12.0"
|
||||
implementation "com.squareup.okhttp3:okhttp:4.12.0"
|
||||
implementation "io.gsonfire:gson-fire:1.9.0"
|
||||
implementation "io.swagger:swagger-annotations:1.6.8"
|
||||
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
|
||||
implementation "jakarta.ws.rs:jakarta.ws.rs-api:2.1.6"
|
||||
implementation "org.openapitools:jackson-databind-nullable:0.2.6"
|
||||
implementation group: "org.apache.commons", name: "commons-lang3", version: "3.17.0"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.3"
|
||||
testImplementation "org.mockito:mockito-core:3.12.4"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.3"
|
||||
}
|
||||
|
||||
javadoc {
|
||||
options.tags = [ "http.response.details:a:Http Response Details" ]
|
||||
}
|
||||
|
||||
spotless {
|
||||
enforceCheck false
|
||||
|
||||
format "misc", {
|
||||
target ".gitignore"
|
||||
trimTrailingWhitespace()
|
||||
indentWithSpaces()
|
||||
endWithNewline()
|
||||
}
|
||||
|
||||
java {
|
||||
googleJavaFormat("1.8").aosp().reflowLongStrings()
|
||||
removeUnusedImports()
|
||||
importOrder()
|
||||
}
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
|
||||
dependsOn "cleanTest"
|
||||
|
||||
testLogging {
|
||||
events "passed", "skipped", "failed"
|
||||
}
|
||||
}
|
||||
1
gradle.properties
Normal file
1
gradle.properties
Normal file
|
|
@ -0,0 +1 @@
|
|||
#target = android
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
plugins {
|
||||
id "java-library"
|
||||
}
|
||||
|
||||
version = "0.1.0"
|
||||
archivesBaseName = "Tribufu"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = "https://mvn.tribufu.com/releases" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api "org.apache.commons:commons-math3:3.6.1"
|
||||
implementation "com.google.code.gson:gson:2.8.9"
|
||||
implementation "com.google.guava:guava:31.1-jre"
|
||||
implementation "dev.mintaka:Mintaka:0.1.0"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter:5.9.1"
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(11)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("test") {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
|
@ -1,284 +0,0 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu;
|
||||
|
||||
import com.tribufu.types.games.Game;
|
||||
import com.tribufu.types.servers.Server;
|
||||
import com.tribufu.types.users.Profile;
|
||||
import dev.mintaka.http.HttpClient;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Tribufu API
|
||||
*
|
||||
* Use this class to interact with the Tribufu API.
|
||||
*
|
||||
* There are three ways to use the Tribufu API:
|
||||
* 1. A api key give you public read only access to the Tribufu API.
|
||||
* 2. A bot give you read and write access to the Tribufu API as a bot account.
|
||||
* 3. A client give you read and write access to the Tribufu API as a client
|
||||
* application.
|
||||
*/
|
||||
public class TribufuApi {
|
||||
private static final String VERSION = "0.0.0";
|
||||
private static final String API_URL = "http://localhost:5000";
|
||||
|
||||
protected final String baseUrl;
|
||||
protected final TribufuApiOptions options;
|
||||
protected final HttpClient http;
|
||||
|
||||
/**
|
||||
* Create a TribufuApi with the default options.
|
||||
*/
|
||||
public TribufuApi() {
|
||||
this(new TribufuApiOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a TribufuApi with the given api key.
|
||||
*
|
||||
* A api key give you public read only access to the Tribufu API.
|
||||
*
|
||||
* @param apiKey
|
||||
*/
|
||||
public TribufuApi(String apiKey) {
|
||||
this(new TribufuApiOptions(apiKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a TribufuApi with the given options.
|
||||
*
|
||||
* @param options
|
||||
*/
|
||||
public TribufuApi(TribufuApiOptions options) {
|
||||
this.options = options;
|
||||
this.baseUrl = TribufuApi.getBaseUrl();
|
||||
this.http = new HttpClient(baseUrl, TribufuApi.defaultHeaders(), true, TribufuApi.API_URL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to create a TribufuApi from environment variables.
|
||||
*
|
||||
* This will only work if the environment variables are set.
|
||||
*/
|
||||
public static TribufuApi fromEnv() {
|
||||
return TribufuApi.fromEnv(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to create a TribufuApi from environment variables.
|
||||
*
|
||||
* This will only work if the environment variables are set.
|
||||
*
|
||||
* @param prefix A prefix for the environment variables.
|
||||
*/
|
||||
public static TribufuApi fromEnv(String prefix) {
|
||||
var envPrefix = "";
|
||||
|
||||
if (prefix != null && !prefix.isEmpty()) {
|
||||
envPrefix = prefix + "_";
|
||||
}
|
||||
|
||||
var apiKey = System.getenv(envPrefix + "API_KEY");
|
||||
|
||||
if (apiKey != null && !apiKey.isEmpty()) {
|
||||
return new TribufuApi(apiKey);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a TribufuApi from environment variables or the default api.
|
||||
*
|
||||
* This will fallback to the default api if the environment variables are not
|
||||
* set.
|
||||
*/
|
||||
public static TribufuApi fromEnvOrDefault() {
|
||||
return TribufuApi.fromEnvOrDefault(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a TribufuApi from environment variables or the default api.
|
||||
*
|
||||
* This will fallback to the default api if the environment variables are not
|
||||
* set.
|
||||
*
|
||||
* @param prefix A prefix for the environment variables.
|
||||
*/
|
||||
public static TribufuApi fromEnvOrDefault(String prefix) {
|
||||
var api = TribufuApi.fromEnv(prefix);
|
||||
|
||||
if (api != null) {
|
||||
return api;
|
||||
}
|
||||
|
||||
return new TribufuApi();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base url for the Tribufu API.
|
||||
*
|
||||
* The base url can be set using the environment variable TRIBUFU_API_URL.
|
||||
* The custom base url is only used if debug mode is enabled.
|
||||
* The default base url is https://api.tribufu.com.
|
||||
*/
|
||||
private static String getBaseUrl() {
|
||||
var baseUrl = System.getenv("TRIBUFU_API_URL");
|
||||
|
||||
if (baseUrl != null && !baseUrl.isEmpty()) {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
return TribufuApi.API_URL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default headers for the Tribufu API.
|
||||
*/
|
||||
public static Map<String, String> defaultHeaders() {
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put("X-Tribufu-Language", "java");
|
||||
headers.put("X-Tribufu-Version", VERSION);
|
||||
return headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current headers with the api key or access token.
|
||||
*/
|
||||
protected Map<String, String> getHeaders() {
|
||||
Map<String, String> headers = TribufuApi.defaultHeaders();
|
||||
|
||||
if (this.options.apiKey != null && !this.options.apiKey.isEmpty()) {
|
||||
headers.put("Authorization", "ApiKey " + this.options.apiKey);
|
||||
return headers;
|
||||
}
|
||||
|
||||
if (this.options.accessToken != null && !this.options.accessToken.isEmpty()) {
|
||||
headers.put("Authorization", "Bearer " + this.options.accessToken);
|
||||
return headers;
|
||||
}
|
||||
|
||||
return headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get games from the Tribufu API.
|
||||
*
|
||||
* @param page
|
||||
*/
|
||||
public List<Game> getGames() {
|
||||
Map<String, String> headers = this.getHeaders();
|
||||
return this.http.getArray("/v1/packages", headers, Game[].class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a game from the Tribufu API.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public CompletableFuture<Game> getGameById(String id) {
|
||||
Map<String, String> headers = this.getHeaders();
|
||||
return this.http.get("/v1/packages/" + id, headers, Game.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a game from the Tribufu API.
|
||||
*
|
||||
* @param page
|
||||
*/
|
||||
public List<Server> getServers() {
|
||||
Map<String, String> headers = this.getHeaders();
|
||||
return this.http.getArray("/v1/servers", headers, Server[].class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a server by id from the Tribufu API.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public CompletableFuture<Server> getServerById(String id) {
|
||||
Map<String, String> headers = this.getHeaders();
|
||||
return this.http.get("/v1/servers/" + id, headers, Server.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a server by address from the Tribufu API.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public CompletableFuture<Server> getServerByAddress(String address) {
|
||||
Map<String, String> headers = this.getHeaders();
|
||||
return this.http.get("/v1/servers/address/" + address, headers, Server.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a user by id from the Tribufu API.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public CompletableFuture<Profile> getUsersById(String id) {
|
||||
Map<String, String> headers = this.getHeaders();
|
||||
return this.http.get("/v1/users/" + id, headers, Profile.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a user by name from the Tribufu API.
|
||||
*
|
||||
* @param uuid
|
||||
*/
|
||||
public CompletableFuture<Profile> getUsersByUuid(String uuid) {
|
||||
return this.getUserByKey("uuid", uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a user by email from the Tribufu API.
|
||||
*
|
||||
* @param email
|
||||
*/
|
||||
public CompletableFuture<Profile> getUsersByName(String email) {
|
||||
return this.getUserByKey("email", email);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a user by custom key from the Tribufu API.
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
private CompletableFuture<Profile> getUserByKey(String key, String value) {
|
||||
Map<String, String> headers = this.getHeaders();
|
||||
return this.http.get("/v1/users?" + key + "=" + value, headers, Profile.class);
|
||||
}
|
||||
|
||||
/*
|
||||
* private OAuth2TokenResponse getOAuthToken(OAuth2GrantType grantType, String
|
||||
* grantValue, String clientId,
|
||||
* String clientSecret, String subjectKey, String subjectValue) {
|
||||
* try {
|
||||
* var headers = defaultHeaders();
|
||||
* headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||
*
|
||||
* var requestBuilder = HttpRequest.newBuilder();
|
||||
* for (var entry : headers.entrySet()) {
|
||||
* requestBuilder.header(entry.getKey(), entry.getValue());
|
||||
* }
|
||||
*
|
||||
* var request = requestBuilder.build();
|
||||
* var response = this.http.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
*
|
||||
* if (response.statusCode() != 200) {
|
||||
* return null;
|
||||
* }
|
||||
*
|
||||
* return null;
|
||||
* } catch (Exception e) {
|
||||
* return null;
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu;
|
||||
|
||||
public class TribufuApiOptions {
|
||||
public String apiKey = null;
|
||||
public String accessToken = null;
|
||||
public String refreshToken = null;
|
||||
public float expiresIn = 0;
|
||||
|
||||
public TribufuApiOptions() {
|
||||
this(null, null, null, 0);
|
||||
}
|
||||
|
||||
public TribufuApiOptions(String apiKey) {
|
||||
this(apiKey, null, null, 0);
|
||||
}
|
||||
|
||||
public TribufuApiOptions(String accessToken, String refreshToken, float expiresIn) {
|
||||
this(null, accessToken, refreshToken, expiresIn);
|
||||
}
|
||||
|
||||
private TribufuApiOptions(String apiKey, String accessToken, String refreshToken, float expiresIn) {
|
||||
this.apiKey = apiKey;
|
||||
this.accessToken = accessToken;
|
||||
this.refreshToken = refreshToken;
|
||||
this.expiresIn = expiresIn;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu;
|
||||
|
||||
/**
|
||||
* Tribufu Bot
|
||||
*
|
||||
* To authenticate a bot you need to use the bot token obtained from the Tribufu
|
||||
* Developer Portal.
|
||||
*
|
||||
* 1. A bot is a special type of user account.
|
||||
* 2. A bot give you read and write access to the Tribufu API.
|
||||
*/
|
||||
public class TribufuBot extends TribufuApi {
|
||||
private final String botId;
|
||||
|
||||
/**
|
||||
* Create a TribufuBot.
|
||||
*
|
||||
* @param botId
|
||||
* @param botToken
|
||||
*/
|
||||
public TribufuBot(String botId, String botToken) {
|
||||
super(new TribufuApiOptions(botToken, null, 0));
|
||||
this.botId = botId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to create a TribufuBot from environment variables.
|
||||
*
|
||||
* This will only work if the environment variables are set.
|
||||
*/
|
||||
public static TribufuBot fromEnv() {
|
||||
return TribufuBot.fromEnv(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to create a TribufuBot from environment variables.
|
||||
*
|
||||
* This will only work if the environment variables are set.
|
||||
*
|
||||
* @param prefix A prefix for the environment variables.
|
||||
*/
|
||||
public static TribufuBot fromEnv(String prefix) {
|
||||
var envPrefix = "";
|
||||
|
||||
if (prefix != null && !prefix.isEmpty()) {
|
||||
envPrefix = prefix + "_";
|
||||
}
|
||||
|
||||
var botId = System.getenv(envPrefix + "BOT_ID");
|
||||
var botToken = System.getenv(envPrefix + "BOT_TOKEN");
|
||||
|
||||
if (botId != null && botToken != null) {
|
||||
return new TribufuBot(botId, botToken);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the bot id.
|
||||
*/
|
||||
public String getBotId() {
|
||||
return this.botId;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu;
|
||||
|
||||
import java.util.Base64;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Tribufu Client
|
||||
*
|
||||
* To authenticate a client you need to use the client id and client secret
|
||||
* obtained from the Tribufu Developer Portal
|
||||
*
|
||||
* 1. A client is how external applications interact with the Tribufu API.
|
||||
* 2. A client give you read and write access to the Tribufu API.
|
||||
* 3. A client can be used to login users.
|
||||
*/
|
||||
public class TribufuClient extends TribufuApi {
|
||||
private final String clientId;
|
||||
private final String clientSecret;
|
||||
|
||||
/**
|
||||
* Create a TribufuClient.
|
||||
*
|
||||
* @param clientId
|
||||
* @param clientSecret
|
||||
*/
|
||||
public TribufuClient(String clientId, String clientSecret) {
|
||||
super();
|
||||
this.clientId = clientId;
|
||||
this.clientSecret = clientSecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to create a TribufuClient from environment variables.
|
||||
*
|
||||
* This will only work if the environment variables are set.
|
||||
*/
|
||||
public static TribufuClient fromEnv() {
|
||||
return TribufuClient.fromEnv(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to create a TribufuClient from environment variables.
|
||||
*
|
||||
* This will only work if the environment variables are set.
|
||||
*
|
||||
* @param prefix A prefix for the environment variables.
|
||||
*/
|
||||
public static TribufuClient fromEnv(String prefix) {
|
||||
var envPrefix = "";
|
||||
if (prefix != null && !prefix.isEmpty()) {
|
||||
envPrefix = prefix + "_";
|
||||
}
|
||||
|
||||
var clientId = System.getenv(envPrefix + "CLIENT_ID");
|
||||
var clientSecret = System.getenv(envPrefix + "CLIENT_SECRET");
|
||||
|
||||
if (clientId != null && clientSecret != null) {
|
||||
return new TribufuClient(clientId, clientSecret);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the tokens.
|
||||
*
|
||||
* @param accessToken
|
||||
* @param refreshToken
|
||||
* @param expiresIn
|
||||
*/
|
||||
private void setTokens(String accessToken, String refreshToken, float expiresIn) {
|
||||
this.options.accessToken = accessToken;
|
||||
this.options.refreshToken = refreshToken;
|
||||
this.options.expiresIn = expiresIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the tokens.
|
||||
*/
|
||||
protected void clearTokens() {
|
||||
this.setTokens(null, null, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the headers for a oauth2 request.
|
||||
*/
|
||||
protected Map<String, String> getOAuthHeaders() {
|
||||
var headers = this.getHeaders();
|
||||
var credentials = this.clientId + ":" + this.clientSecret;
|
||||
var credentialsBase64 = Base64.getEncoder().encodeToString(credentials.getBytes());
|
||||
headers.put("Authorization", "Basic " + credentialsBase64);
|
||||
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||
return headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the client id.
|
||||
*/
|
||||
public String getClientId() {
|
||||
return this.clientId;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu;
|
||||
|
||||
import com.tribufu.types.servers.Server;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* Tribufu Server
|
||||
*
|
||||
* To authenticate a server you need to use the server id, client id and client
|
||||
* secret obtained from your server subscription.
|
||||
*
|
||||
* 1. A server is a special type of client application.
|
||||
* 2. A server is how game servers interact with the Tribufu API.
|
||||
* 3. A server give you read and write access to the Tribufu API.
|
||||
*/
|
||||
public class TribufuServer extends TribufuClient {
|
||||
private final String serverId;
|
||||
|
||||
/**
|
||||
* Create a TribufuServer.
|
||||
*
|
||||
* @param serverId
|
||||
* @param clientId
|
||||
* @param clientSecret
|
||||
*/
|
||||
public TribufuServer(String serverId, String clientId, String clientSecret) {
|
||||
super(clientId, clientSecret);
|
||||
this.serverId = serverId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to create a TribufuServer from environment variables.
|
||||
*
|
||||
* This will only work if the environment variables are set.
|
||||
*/
|
||||
public static TribufuServer fromEnv() {
|
||||
return TribufuServer.fromEnv(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to create a TribufuServer from environment variables.
|
||||
*
|
||||
* This will only work if the environment variables are set.
|
||||
*
|
||||
* @param prefix A prefix for the environment variables.
|
||||
*/
|
||||
public static TribufuServer fromEnv(String prefix) {
|
||||
var envPrefix = "";
|
||||
|
||||
if (prefix != null && !prefix.isEmpty()) {
|
||||
envPrefix = prefix + "_";
|
||||
}
|
||||
|
||||
var serverId = System.getenv(envPrefix + "SERVER_ID");
|
||||
var clientId = System.getenv(envPrefix + "CLIENT_ID");
|
||||
var clientSecret = System.getenv(envPrefix + "CLIENT_SECRET");
|
||||
|
||||
if (serverId != null && clientId != null && clientSecret != null) {
|
||||
return new TribufuServer(serverId, clientId, clientSecret);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the server id.
|
||||
*/
|
||||
public String getServerId() {
|
||||
return this.serverId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get information about the current server.
|
||||
*/
|
||||
public CompletableFuture<Server> getServerInfo() {
|
||||
return this.getServerById(this.serverId);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu.socket;
|
||||
|
||||
/**
|
||||
* Tribufu Socket
|
||||
*
|
||||
* Helper class to connect to the Tribufu Socket API.
|
||||
*/
|
||||
public class TribufuSocket {
|
||||
public TribufuSocket() {
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu.types.games;
|
||||
|
||||
public class Game {
|
||||
public String id;
|
||||
public String name;
|
||||
public String description;
|
||||
public String iconUrl;
|
||||
public String bannerUrl;
|
||||
public String capsuleImageUrl;
|
||||
public String libraryImageUrl;
|
||||
public String slug;
|
||||
public Integer gamePort;
|
||||
public Integer queryPort;
|
||||
public Integer rconPort;
|
||||
public String steamAppId;
|
||||
public String steamServerAppId;
|
||||
public String rustGamedigId;
|
||||
public String nodeGamedigId;
|
||||
public String serverConnectUrl;
|
||||
public String created;
|
||||
public String updated;
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu.types.servers;
|
||||
|
||||
import com.tribufu.types.users.MiniProfile;
|
||||
|
||||
public class Server {
|
||||
public long id;
|
||||
public String name;
|
||||
public String description;
|
||||
public String address;
|
||||
public Short gamePort;
|
||||
public short queryPort;
|
||||
public Short rconPort;
|
||||
public String rconPassword;
|
||||
public long packageId;
|
||||
public String packageIconUrl;
|
||||
public ServerPackage packageObj;
|
||||
public String version;
|
||||
public Integer clusterId;
|
||||
public String websiteUrl;
|
||||
public String bannerUrl;
|
||||
public Long ownerId;
|
||||
public MiniProfile owner;
|
||||
public double uptime;
|
||||
public String lastOnline;
|
||||
public ServerStatus status;
|
||||
public Integer ping;
|
||||
public String map;
|
||||
public Integer usedSlots;
|
||||
public Integer maxSlots;
|
||||
public String motd;
|
||||
public Object players;
|
||||
public String country;
|
||||
public boolean steam;
|
||||
public String discordServerId;
|
||||
public String youtubeVideoUrl;
|
||||
public Object tags;
|
||||
public int commentCount;
|
||||
public String secret;
|
||||
public String created;
|
||||
public String updated;
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu.types.servers;
|
||||
|
||||
public class ServerPackage {
|
||||
public long id;
|
||||
public String name;
|
||||
public String slug;
|
||||
public String rustGamedigId;
|
||||
public String nodeGamedigId;
|
||||
public String serverConnectUrl;
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu.types.servers;
|
||||
|
||||
public enum ServerStatus {
|
||||
Unknown,
|
||||
Offline,
|
||||
Online
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu.types.users;
|
||||
|
||||
public class MiniProfile {
|
||||
public long id;
|
||||
public String uuid;
|
||||
public String name;
|
||||
public String displayName;
|
||||
public UserType kind;
|
||||
public boolean verified;
|
||||
public String photoUrl;
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu.types.users;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class Profile {
|
||||
public long id;
|
||||
public String uuid;
|
||||
public String name;
|
||||
public String displayName;
|
||||
public UserType kind;
|
||||
public long publicFlags;
|
||||
public boolean verified;
|
||||
public int level;
|
||||
public double experience;
|
||||
public boolean publicBirthday;
|
||||
public LocalDate birthday;
|
||||
public double points;
|
||||
public String location;
|
||||
public String photoUrl;
|
||||
public String bannerUrl;
|
||||
public String lastOnline;
|
||||
public String biography;
|
||||
public int viewCount;
|
||||
public String created;
|
||||
public String updated;
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
package com.tribufu.types.users;
|
||||
|
||||
public enum UserType {
|
||||
User,
|
||||
Bot,
|
||||
Org,
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved
|
||||
|
||||
package com.tribufu;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class TribufuApiTest {
|
||||
@Test
|
||||
void defaultApi() {
|
||||
TribufuApi api = new TribufuApi();
|
||||
assertNotEquals(null, api);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved
|
||||
|
||||
package com.tribufu;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class TribufuBotTest {
|
||||
@Test
|
||||
void defaultApi() {
|
||||
TribufuBot bot = new TribufuBot("0", "...");
|
||||
assertEquals("0", bot.getBotId());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved
|
||||
|
||||
package com.tribufu;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class TribufuClientTest {
|
||||
@Test
|
||||
void defaultApi() {
|
||||
TribufuClient client = new TribufuClient("0", "...");
|
||||
assertEquals("0", client.getClientId());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved
|
||||
|
||||
package com.tribufu;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class TribufuServerTest {
|
||||
@Test
|
||||
void defaultApi() {
|
||||
TribufuServer server = new TribufuServer("0", "1", "...");
|
||||
assertEquals("0", server.getServerId());
|
||||
assertEquals("1", server.getClientId());
|
||||
}
|
||||
}
|
||||
12
scripts/generate.ps1
Normal file
12
scripts/generate.ps1
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env pwsh
|
||||
|
||||
$env:JAVA_POST_PROCESS_FILE = ""
|
||||
|
||||
java -jar ./vendor/openapi-generator/openapi-generator-cli.jar generate `
|
||||
-i https://api.tribufu.com/openapi.json `
|
||||
-g java `
|
||||
-o . `
|
||||
--global-property apis,models,supportingFiles,apiDocs=false,modelDocs=false,apiTests=false,modelTests=false `
|
||||
--additional-properties=groupId=com.tribufu,library=okhttp-gson,invokerPackage=com.tribufu.generated,apiPackage=com.tribufu.generated.api,modelPackage=com.tribufu.generated.models,javaIndent=4`
|
||||
--openapi-normalizer SET_TAGS_FOR_ALL_OPERATIONS=TribufuGenerated `
|
||||
--skip-validate-spec
|
||||
|
|
@ -1,6 +1 @@
|
|||
plugins {
|
||||
id "org.gradle.toolchains.foojay-resolver-convention" version "0.4.0"
|
||||
}
|
||||
|
||||
rootProject.name = "TribufuJvm"
|
||||
include("lib")
|
||||
rootProject.name = "tribufu"
|
||||
|
|
|
|||
3
src/main/AndroidManifest.xml
Normal file
3
src/main/AndroidManifest.xml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<manifest package="com.tribufu" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<application />
|
||||
</manifest>
|
||||
158
src/main/java/com/tribufu/TribufuApi.java
Normal file
158
src/main/java/com/tribufu/TribufuApi.java
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package com.tribufu;
|
||||
|
||||
import com.tribufu.generated.api.TribufuGeneratedApi;
|
||||
import com.tribufu.generated.ApiClient;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Tribufu API
|
||||
*
|
||||
* Use this class to interact with the Tribufu API.
|
||||
*/
|
||||
public class TribufuApi extends TribufuGeneratedApi {
|
||||
/**
|
||||
* The default base URL for the Tribufu API.
|
||||
*/
|
||||
public static final String DEFAULT_BASE_URL = "https://api.tribufu.com";
|
||||
|
||||
/**
|
||||
* Create a TribufuApi with no API key (public access).
|
||||
*/
|
||||
public TribufuApi() {
|
||||
this("");
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a TribufuApi with the given API key.
|
||||
*
|
||||
* @param apiKey The API key for authentication.
|
||||
*/
|
||||
public TribufuApi(String apiKey) {
|
||||
super(createClient(apiKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a default TribufuApi instance.
|
||||
*
|
||||
* @return TribufuApi instance with default config.
|
||||
*/
|
||||
public static TribufuApi defaultInstance() {
|
||||
return new TribufuApi();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a TribufuApi with the given API key.
|
||||
*
|
||||
* @param apiKey The API key.
|
||||
* @return TribufuApi instance.
|
||||
*/
|
||||
public static TribufuApi withApiKey(String apiKey) {
|
||||
return new TribufuApi(apiKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a TribufuApi from environment variables (e.g., TRIBUFU_API_KEY).
|
||||
*
|
||||
* @param prefix Optional prefix for env vars (default: TRIBUFU).
|
||||
* @return TribufuApi instance or null.
|
||||
*/
|
||||
public static TribufuApi fromEnv(String prefix) {
|
||||
if (prefix == null || prefix.isEmpty()) {
|
||||
prefix = "TRIBUFU";
|
||||
}
|
||||
|
||||
String apiKey = System.getenv(prefix + "_API_KEY");
|
||||
if (apiKey != null && !apiKey.isEmpty()) {
|
||||
return withApiKey(apiKey);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a TribufuApi from env vars or fallback to default instance.
|
||||
*
|
||||
* @param prefix Optional env var prefix (default: TRIBUFU).
|
||||
* @return TribufuApi instance.
|
||||
*/
|
||||
public static TribufuApi fromEnvOrDefault(String prefix) {
|
||||
TribufuApi fromEnv = fromEnv(prefix);
|
||||
return (fromEnv != null) ? fromEnv : defaultInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a TribufuApi from env vars or fallback to default instance.
|
||||
*
|
||||
* @return TribufuApi instance.
|
||||
*/
|
||||
public static TribufuApi fromEnvOrDefault() {
|
||||
return fromEnvOrDefault("TRIBUFU");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and configures the ApiClient.
|
||||
*/
|
||||
private static ApiClient createClient(String apiKey) {
|
||||
ApiClient client = new ApiClient();
|
||||
|
||||
client.setBasePath(getBaseUrl());
|
||||
|
||||
try {
|
||||
client.setUserAgent(urlEncode(getUserAgent()));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
}
|
||||
|
||||
if (apiKey != null && !apiKey.isEmpty()) {
|
||||
client.addDefaultHeader("Authorization", "ApiKey " + apiKey);
|
||||
}
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base URL, uses TRIBUFU_API_URL if debug mode is on.
|
||||
*/
|
||||
private static String getBaseUrl() {
|
||||
String debug = System.getenv("DEBUG");
|
||||
String envUrl = System.getenv("TRIBUFU_API_URL");
|
||||
|
||||
if ("1".equals(debug) || "true".equalsIgnoreCase(debug)) {
|
||||
if (envUrl != null && !envUrl.isEmpty()) {
|
||||
return envUrl;
|
||||
}
|
||||
}
|
||||
|
||||
return DEFAULT_BASE_URL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the version of the Tribufu client.
|
||||
*/
|
||||
public static String getVersion() {
|
||||
Package pkg = TribufuApi.class.getPackage();
|
||||
String version = Optional.ofNullable(pkg.getImplementationVersion()).orElse("dev");
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the User-Agent string for the API.
|
||||
*/
|
||||
private static String getUserAgent() {
|
||||
String version = getVersion();
|
||||
String os = System.getProperty("os.name");
|
||||
String arch = System.getProperty("os.arch");
|
||||
String javaVersion = System.getProperty("java.version");
|
||||
return String.format("Tribufu/%s (Java %s; %s; %s)", version, javaVersion, os, arch);
|
||||
}
|
||||
|
||||
private static String urlEncode(String value) throws UnsupportedEncodingException {
|
||||
return URLEncoder.encode(value, StandardCharsets.UTF_8.toString());
|
||||
}
|
||||
}
|
||||
36
src/main/java/com/tribufu/TribufuApiSingleton.java
Normal file
36
src/main/java/com/tribufu/TribufuApiSingleton.java
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package com.tribufu;
|
||||
|
||||
/**
|
||||
* Tribufu API
|
||||
*
|
||||
* Helper class to get a singleton instance of the Tribufu API.
|
||||
*/
|
||||
public final class TribufuApiSingleton {
|
||||
private static TribufuApi instance = null;
|
||||
|
||||
private TribufuApiSingleton() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the singleton instance of {@link TribufuApi}.
|
||||
*
|
||||
* @return Singleton instance
|
||||
*/
|
||||
public static synchronized TribufuApi getInstance() {
|
||||
if (instance == null) {
|
||||
instance = TribufuApi.fromEnvOrDefault();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the singleton instance of {@link TribufuApi}.
|
||||
*/
|
||||
public static synchronized void resetInstance() {
|
||||
instance = null;
|
||||
}
|
||||
}
|
||||
62
src/main/java/com/tribufu/generated/ApiCallback.java
Normal file
62
src/main/java/com/tribufu/generated/ApiCallback.java
Normal 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);
|
||||
}
|
||||
1589
src/main/java/com/tribufu/generated/ApiClient.java
Normal file
1589
src/main/java/com/tribufu/generated/ApiClient.java
Normal file
File diff suppressed because it is too large
Load diff
167
src/main/java/com/tribufu/generated/ApiException.java
Normal file
167
src/main/java/com/tribufu/generated/ApiException.java
Normal 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());
|
||||
}
|
||||
}
|
||||
76
src/main/java/com/tribufu/generated/ApiResponse.java
Normal file
76
src/main/java/com/tribufu/generated/ApiResponse.java
Normal 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;
|
||||
}
|
||||
}
|
||||
41
src/main/java/com/tribufu/generated/Configuration.java
Normal file
41
src/main/java/com/tribufu/generated/Configuration.java
Normal 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
430
src/main/java/com/tribufu/generated/JSON.java
Normal file
430
src/main/java/com/tribufu/generated/JSON.java
Normal 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);
|
||||
}
|
||||
}
|
||||
57
src/main/java/com/tribufu/generated/Pair.java
Normal file
57
src/main/java/com/tribufu/generated/Pair.java
Normal 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;
|
||||
}
|
||||
}
|
||||
73
src/main/java/com/tribufu/generated/ProgressRequestBody.java
Normal file
73
src/main/java/com/tribufu/generated/ProgressRequestBody.java
Normal 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);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
72
src/main/java/com/tribufu/generated/ServerConfiguration.java
Normal file
72
src/main/java/com/tribufu/generated/ServerConfiguration.java
Normal 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);
|
||||
}
|
||||
}
|
||||
37
src/main/java/com/tribufu/generated/ServerVariable.java
Normal file
37
src/main/java/com/tribufu/generated/ServerVariable.java
Normal 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;
|
||||
}
|
||||
}
|
||||
83
src/main/java/com/tribufu/generated/StringUtil.java
Normal file
83
src/main/java/com/tribufu/generated/StringUtil.java
Normal 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();
|
||||
}
|
||||
}
|
||||
9379
src/main/java/com/tribufu/generated/api/TribufuGeneratedApi.java
Normal file
9379
src/main/java/com/tribufu/generated/api/TribufuGeneratedApi.java
Normal file
File diff suppressed because it is too large
Load diff
80
src/main/java/com/tribufu/generated/auth/ApiKeyAuth.java
Normal file
80
src/main/java/com/tribufu/generated/auth/ApiKeyAuth.java
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
36
src/main/java/com/tribufu/generated/auth/Authentication.java
Normal file
36
src/main/java/com/tribufu/generated/auth/Authentication.java
Normal 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;
|
||||
}
|
||||
55
src/main/java/com/tribufu/generated/auth/HttpBasicAuth.java
Normal file
55
src/main/java/com/tribufu/generated/auth/HttpBasicAuth.java
Normal 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));
|
||||
}
|
||||
}
|
||||
75
src/main/java/com/tribufu/generated/auth/HttpBearerAuth.java
Normal file
75
src/main/java/com/tribufu/generated/auth/HttpBearerAuth.java
Normal 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
419
src/main/java/com/tribufu/generated/models/Account.java
Normal file
419
src/main/java/com/tribufu/generated/models/Account.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
768
src/main/java/com/tribufu/generated/models/Application.java
Normal file
768
src/main/java/com/tribufu/generated/models/Application.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
402
src/main/java/com/tribufu/generated/models/AuthorizeRequest.java
Normal file
402
src/main/java/com/tribufu/generated/models/AuthorizeRequest.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
248
src/main/java/com/tribufu/generated/models/CryptoViewModel.java
Normal file
248
src/main/java/com/tribufu/generated/models/CryptoViewModel.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
1077
src/main/java/com/tribufu/generated/models/Game.java
Normal file
1077
src/main/java/com/tribufu/generated/models/Game.java
Normal file
File diff suppressed because it is too large
Load diff
1085
src/main/java/com/tribufu/generated/models/GameServer.java
Normal file
1085
src/main/java/com/tribufu/generated/models/GameServer.java
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
82
src/main/java/com/tribufu/generated/models/GrantType.java
Normal file
82
src/main/java/com/tribufu/generated/models/GrantType.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
646
src/main/java/com/tribufu/generated/models/Group.java
Normal file
646
src/main/java/com/tribufu/generated/models/Group.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
394
src/main/java/com/tribufu/generated/models/GroupGame.java
Normal file
394
src/main/java/com/tribufu/generated/models/GroupGame.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
453
src/main/java/com/tribufu/generated/models/GroupMember.java
Normal file
453
src/main/java/com/tribufu/generated/models/GroupMember.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
80
src/main/java/com/tribufu/generated/models/GroupRank.java
Normal file
80
src/main/java/com/tribufu/generated/models/GroupRank.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
218
src/main/java/com/tribufu/generated/models/HashViewModel.java
Normal file
218
src/main/java/com/tribufu/generated/models/HashViewModel.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
716
src/main/java/com/tribufu/generated/models/IpAddress.java
Normal file
716
src/main/java/com/tribufu/generated/models/IpAddress.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
359
src/main/java/com/tribufu/generated/models/LeaderboardItem.java
Normal file
359
src/main/java/com/tribufu/generated/models/LeaderboardItem.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
248
src/main/java/com/tribufu/generated/models/LoginRequest.java
Normal file
248
src/main/java/com/tribufu/generated/models/LoginRequest.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
307
src/main/java/com/tribufu/generated/models/LoginResponse.java
Normal file
307
src/main/java/com/tribufu/generated/models/LoginResponse.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
534
src/main/java/com/tribufu/generated/models/ModelPackage.java
Normal file
534
src/main/java/com/tribufu/generated/models/ModelPackage.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
701
src/main/java/com/tribufu/generated/models/Profile.java
Normal file
701
src/main/java/com/tribufu/generated/models/Profile.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
501
src/main/java/com/tribufu/generated/models/ProfileGame.java
Normal file
501
src/main/java/com/tribufu/generated/models/ProfileGame.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
480
src/main/java/com/tribufu/generated/models/ProfileGroup.java
Normal file
480
src/main/java/com/tribufu/generated/models/ProfileGroup.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
218
src/main/java/com/tribufu/generated/models/RefreshRequest.java
Normal file
218
src/main/java/com/tribufu/generated/models/RefreshRequest.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
318
src/main/java/com/tribufu/generated/models/RegisterRequest.java
Normal file
318
src/main/java/com/tribufu/generated/models/RegisterRequest.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
78
src/main/java/com/tribufu/generated/models/ResponseType.java
Normal file
78
src/main/java/com/tribufu/generated/models/ResponseType.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
250
src/main/java/com/tribufu/generated/models/RevokeRequest.java
Normal file
250
src/main/java/com/tribufu/generated/models/RevokeRequest.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
307
src/main/java/com/tribufu/generated/models/SearchRequest.java
Normal file
307
src/main/java/com/tribufu/generated/models/SearchRequest.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
82
src/main/java/com/tribufu/generated/models/SearchType.java
Normal file
82
src/main/java/com/tribufu/generated/models/SearchType.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
257
src/main/java/com/tribufu/generated/models/ServerMetrics.java
Normal file
257
src/main/java/com/tribufu/generated/models/ServerMetrics.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
80
src/main/java/com/tribufu/generated/models/ServerStatus.java
Normal file
80
src/main/java/com/tribufu/generated/models/ServerStatus.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
391
src/main/java/com/tribufu/generated/models/Subscription.java
Normal file
391
src/main/java/com/tribufu/generated/models/Subscription.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
430
src/main/java/com/tribufu/generated/models/TokenRequest.java
Normal file
430
src/main/java/com/tribufu/generated/models/TokenRequest.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
367
src/main/java/com/tribufu/generated/models/TokenResponse.java
Normal file
367
src/main/java/com/tribufu/generated/models/TokenResponse.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
76
src/main/java/com/tribufu/generated/models/TokenType.java
Normal file
76
src/main/java/com/tribufu/generated/models/TokenType.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
248
src/main/java/com/tribufu/generated/models/UpdateProfile.java
Normal file
248
src/main/java/com/tribufu/generated/models/UpdateProfile.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
913
src/main/java/com/tribufu/generated/models/UserInfo.java
Normal file
913
src/main/java/com/tribufu/generated/models/UserInfo.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
78
src/main/java/com/tribufu/generated/models/UserType.java
Normal file
78
src/main/java/com/tribufu/generated/models/UserType.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
202
vendor/openapi-generator/LICENSE
vendored
Normal file
202
vendor/openapi-generator/LICENSE
vendored
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
Copyright 2018 SmartBear Software
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
BIN
vendor/openapi-generator/openapi-generator-cli.jar
vendored
Normal file
BIN
vendor/openapi-generator/openapi-generator-cli.jar
vendored
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue