diff --git a/.gitignore b/.gitignore index d65d5b7..f310d3b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ .bloop/ .gradle/ -.gradle/ .idea/ .metals/ .vscode/ @@ -8,3 +7,7 @@ bin/ build/ .DS_Store +.env +*.filters +*.user +desktop.ini diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..710afcd --- /dev/null +++ b/.openapi-generator-ignore @@ -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 diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 0000000..9953bfc --- /dev/null +++ b/.openapi-generator/FILES @@ -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 diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..5f84a81 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.12.0 diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..fddd294 --- /dev/null +++ b/build.gradle @@ -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" + } +} diff --git a/examples/build.gradle b/examples/build.gradle deleted file mode 100644 index 4453ceb..0000000 --- a/examples/build.gradle +++ /dev/null @@ -1,21 +0,0 @@ -plugins { - id 'application' -} - -version = "0.0.4" -archivesBaseName = "TribufuExample" - -repositories { - mavenCentral() - maven { url = "https://mvn.tribufu.com/releases" } -} - -dependencies { - implementation project(':lib') - implementation 'com.google.guava:guava:30.0-jre' - testImplementation 'junit:junit:4.13.1' -} - -application { - mainClass = 'com.tribufu.example.ExampleApp' -} diff --git a/examples/src/main/java/com/tribufu/example/ExampleApp.java b/examples/src/main/java/com/tribufu/example/ExampleApp.java deleted file mode 100644 index 3f7fff5..0000000 --- a/examples/src/main/java/com/tribufu/example/ExampleApp.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Tribufu. All Rights Reserved. - -package com.tribufu.example; - -import com.tribufu.TribufuApi; - -public class ExampleApp { - public static void main(String[] args) { - var api = new TribufuApi(); - - var games = api.getGames(); - System.out.println("\n---- GAMES ----"); - for (var game : games) { - System.out.println(game.name); - } - - var servers = api.getServers(); - System.out.println("\n---- SERVERS ----"); - for (var server : servers) { - System.out.println(server.name); - } - } -} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..d766a53 --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +#target = android diff --git a/lib/build.gradle b/lib/build.gradle deleted file mode 100644 index da898eb..0000000 --- a/lib/build.gradle +++ /dev/null @@ -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() -} diff --git a/lib/src/main/java/com/tribufu/TribufuApi.java b/lib/src/main/java/com/tribufu/TribufuApi.java deleted file mode 100644 index 745c882..0000000 --- a/lib/src/main/java/com/tribufu/TribufuApi.java +++ /dev/null @@ -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 defaultHeaders() { - Map 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 getHeaders() { - Map 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 getGames() { - Map headers = this.getHeaders(); - return this.http.getArray("/v1/packages", headers, Game[].class); - } - - /** - * Get a game from the Tribufu API. - * - * @param id - */ - public CompletableFuture getGameById(String id) { - Map headers = this.getHeaders(); - return this.http.get("/v1/packages/" + id, headers, Game.class); - } - - /** - * Get a game from the Tribufu API. - * - * @param page - */ - public List getServers() { - Map 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 getServerById(String id) { - Map 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 getServerByAddress(String address) { - Map 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 getUsersById(String id) { - Map 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 getUsersByUuid(String uuid) { - return this.getUserByKey("uuid", uuid); - } - - /** - * Get a user by email from the Tribufu API. - * - * @param email - */ - public CompletableFuture getUsersByName(String email) { - return this.getUserByKey("email", email); - } - - /** - * Get a user by custom key from the Tribufu API. - * - * @param key - * @param value - */ - private CompletableFuture getUserByKey(String key, String value) { - Map 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; - * } - * } - */ -} diff --git a/lib/src/main/java/com/tribufu/TribufuApiOptions.java b/lib/src/main/java/com/tribufu/TribufuApiOptions.java deleted file mode 100644 index e75306d..0000000 --- a/lib/src/main/java/com/tribufu/TribufuApiOptions.java +++ /dev/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; - } -} diff --git a/lib/src/main/java/com/tribufu/TribufuBot.java b/lib/src/main/java/com/tribufu/TribufuBot.java deleted file mode 100644 index b1fe69b..0000000 --- a/lib/src/main/java/com/tribufu/TribufuBot.java +++ /dev/null @@ -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; - } -} diff --git a/lib/src/main/java/com/tribufu/TribufuClient.java b/lib/src/main/java/com/tribufu/TribufuClient.java deleted file mode 100644 index 0b038e0..0000000 --- a/lib/src/main/java/com/tribufu/TribufuClient.java +++ /dev/null @@ -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 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; - } -} diff --git a/lib/src/main/java/com/tribufu/TribufuServer.java b/lib/src/main/java/com/tribufu/TribufuServer.java deleted file mode 100644 index fafe31a..0000000 --- a/lib/src/main/java/com/tribufu/TribufuServer.java +++ /dev/null @@ -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 getServerInfo() { - return this.getServerById(this.serverId); - } -} diff --git a/lib/src/main/java/com/tribufu/socket/TribufuSocket.java b/lib/src/main/java/com/tribufu/socket/TribufuSocket.java deleted file mode 100644 index 0ec84d4..0000000 --- a/lib/src/main/java/com/tribufu/socket/TribufuSocket.java +++ /dev/null @@ -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() { - } -} diff --git a/lib/src/main/java/com/tribufu/types/games/Game.java b/lib/src/main/java/com/tribufu/types/games/Game.java deleted file mode 100644 index 7c2b38b..0000000 --- a/lib/src/main/java/com/tribufu/types/games/Game.java +++ /dev/null @@ -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; -} diff --git a/lib/src/main/java/com/tribufu/types/servers/Server.java b/lib/src/main/java/com/tribufu/types/servers/Server.java deleted file mode 100644 index 2f34907..0000000 --- a/lib/src/main/java/com/tribufu/types/servers/Server.java +++ /dev/null @@ -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; -} diff --git a/lib/src/main/java/com/tribufu/types/servers/ServerPackage.java b/lib/src/main/java/com/tribufu/types/servers/ServerPackage.java deleted file mode 100644 index 223e12a..0000000 --- a/lib/src/main/java/com/tribufu/types/servers/ServerPackage.java +++ /dev/null @@ -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; -} diff --git a/lib/src/main/java/com/tribufu/types/servers/ServerStatus.java b/lib/src/main/java/com/tribufu/types/servers/ServerStatus.java deleted file mode 100644 index 62fa8cc..0000000 --- a/lib/src/main/java/com/tribufu/types/servers/ServerStatus.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Tribufu. All Rights Reserved. - -package com.tribufu.types.servers; - -public enum ServerStatus { - Unknown, - Offline, - Online -} diff --git a/lib/src/main/java/com/tribufu/types/users/MiniProfile.java b/lib/src/main/java/com/tribufu/types/users/MiniProfile.java deleted file mode 100644 index 4751755..0000000 --- a/lib/src/main/java/com/tribufu/types/users/MiniProfile.java +++ /dev/null @@ -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; -} diff --git a/lib/src/main/java/com/tribufu/types/users/Profile.java b/lib/src/main/java/com/tribufu/types/users/Profile.java deleted file mode 100644 index 6db252b..0000000 --- a/lib/src/main/java/com/tribufu/types/users/Profile.java +++ /dev/null @@ -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; -} diff --git a/lib/src/main/java/com/tribufu/types/users/UserType.java b/lib/src/main/java/com/tribufu/types/users/UserType.java deleted file mode 100644 index af28909..0000000 --- a/lib/src/main/java/com/tribufu/types/users/UserType.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Tribufu. All Rights Reserved. - -package com.tribufu.types.users; - -public enum UserType { - User, - Bot, - Org, -} diff --git a/lib/src/test/java/com/tribufu/TribufuApiTest.java b/lib/src/test/java/com/tribufu/TribufuApiTest.java deleted file mode 100644 index e038b4f..0000000 --- a/lib/src/test/java/com/tribufu/TribufuApiTest.java +++ /dev/null @@ -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); - } -} diff --git a/lib/src/test/java/com/tribufu/TribufuBotTest.java b/lib/src/test/java/com/tribufu/TribufuBotTest.java deleted file mode 100644 index 57b2ccf..0000000 --- a/lib/src/test/java/com/tribufu/TribufuBotTest.java +++ /dev/null @@ -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()); - } -} diff --git a/lib/src/test/java/com/tribufu/TribufuClientTest.java b/lib/src/test/java/com/tribufu/TribufuClientTest.java deleted file mode 100644 index 6c0cbbe..0000000 --- a/lib/src/test/java/com/tribufu/TribufuClientTest.java +++ /dev/null @@ -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()); - } -} diff --git a/lib/src/test/java/com/tribufu/TribufuServerTest.java b/lib/src/test/java/com/tribufu/TribufuServerTest.java deleted file mode 100644 index e698735..0000000 --- a/lib/src/test/java/com/tribufu/TribufuServerTest.java +++ /dev/null @@ -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()); - } -} diff --git a/scripts/generate.ps1 b/scripts/generate.ps1 new file mode 100644 index 0000000..40715b1 --- /dev/null +++ b/scripts/generate.ps1 @@ -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 diff --git a/settings.gradle b/settings.gradle index 901c9f6..6e06618 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,7 +1 @@ -plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' -} - -rootProject.name = 'TribufuJvm' -include('lib') -include('examples') +rootProject.name = "tribufu" diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml new file mode 100644 index 0000000..9b1be85 --- /dev/null +++ b/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/src/main/java/com/tribufu/TribufuApi.java b/src/main/java/com/tribufu/TribufuApi.java new file mode 100644 index 0000000..ff84940 --- /dev/null +++ b/src/main/java/com/tribufu/TribufuApi.java @@ -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()); + } +} diff --git a/src/main/java/com/tribufu/TribufuApiSingleton.java b/src/main/java/com/tribufu/TribufuApiSingleton.java new file mode 100644 index 0000000..3491c60 --- /dev/null +++ b/src/main/java/com/tribufu/TribufuApiSingleton.java @@ -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; + } +} diff --git a/src/main/java/com/tribufu/generated/ApiCallback.java b/src/main/java/com/tribufu/generated/ApiCallback.java new file mode 100644 index 0000000..19ab1a9 --- /dev/null +++ b/src/main/java/com/tribufu/generated/ApiCallback.java @@ -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 The return type + */ +public interface ApiCallback { + /** + * 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> 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> 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); +} diff --git a/src/main/java/com/tribufu/generated/ApiClient.java b/src/main/java/com/tribufu/generated/ApiClient.java new file mode 100644 index 0000000..508a614 --- /dev/null +++ b/src/main/java/com/tribufu/generated/ApiClient.java @@ -0,0 +1,1589 @@ +/* + * 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 okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.tribufu.generated.auth.Authentication; +import com.tribufu.generated.auth.HttpBasicAuth; +import com.tribufu.generated.auth.HttpBearerAuth; +import com.tribufu.generated.auth.ApiKeyAuth; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + private String basePath = "http://localhost"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + private boolean debugging = false; + private Map defaultHeaderMap = new HashMap(); + private Map defaultCookieMap = new HashMap(); + private String tempFolderPath = null; + + private Map authentications; + + private DateFormat dateFormat; + private DateFormat datetimeFormat; + private boolean lenientDatetimeFormat; + private int dateLength; + + private InputStream sslCaCert; + private boolean verifyingSsl; + private KeyManager[] keyManagers; + + private OkHttpClient httpClient; + private JSON json; + + private HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("ApiKey", new ApiKeyAuth("header", "Authorization")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("ApiKey", new ApiKeyAuth("header", "Authorization")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + private void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + private void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + private void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.1.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://localhost + * @return An instance of OkHttpClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return Api Client + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link com.tribufu.generated.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link com.tribufu.generated.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link com.tribufu.generated.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link com.tribufu.generated.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link com.tribufu.generated.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + * + * @param apiKey API key + */ + public void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return ApiClient + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Add a default cookie. + * + * @param key The cookie's key + * @param value The cookie's value + * @return ApiClient + */ + public ApiClient addDefaultCookie(String key, String value) { + defaultCookieMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * + * @return True if debugging is enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = debugging; + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = JSON.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceAll(".*[/\\\\]", ""); + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON + * @param mime MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + return "application/json"; + } + + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * + * @param str String to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws com.tribufu.generated.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + String respBody; + try { + if (response.body() != null) + respBody = response.body().string(); + else + respBody = null; + } catch (IOException e) { + throw new ApiException(e); + } + + if (respBody == null || "".equals(respBody)) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody, returnType); + } else if (returnType.equals(String.class)) { + // Expecting string, return the raw response body. + return (T) respBody; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + respBody); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws com.tribufu.generated.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = JSON.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws com.tribufu.generated.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) { + filename = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf("."); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws com.tribufu.generated.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws com.tribufu.generated.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws com.tribufu.generated.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws com.tribufu.generated.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws com.tribufu.generated.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @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 com.tribufu.generated.ApiException If fails to update the parameters + */ + public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, + Map cookieParams, String payload, String method, URI uri) throws ApiException { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = JSON.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + private Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + private void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws com.tribufu.generated.ApiException If fail to serialize the request body object into a string + */ + private String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/src/main/java/com/tribufu/generated/ApiException.java b/src/main/java/com/tribufu/generated/ApiException.java new file mode 100644 index 0000000..831428c --- /dev/null +++ b/src/main/java/com/tribufu/generated/ApiException.java @@ -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; + + +/** + *

ApiException class.

+ */ +@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> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @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> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @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> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @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> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @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> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @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> 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> 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()); + } +} diff --git a/src/main/java/com/tribufu/generated/ApiResponse.java b/src/main/java/com/tribufu/generated/ApiResponse.java new file mode 100644 index 0000000..a8dca04 --- /dev/null +++ b/src/main/java/com/tribufu/generated/ApiResponse.java @@ -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 { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + *

Constructor for ApiResponse.

+ * + * @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> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + /** + *

Get the status code.

+ * + * @return the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/src/main/java/com/tribufu/generated/Configuration.java b/src/main/java/com/tribufu/generated/Configuration.java new file mode 100644 index 0000000..cc049f6 --- /dev/null +++ b/src/main/java/com/tribufu/generated/Configuration.java @@ -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; + } +} diff --git a/src/main/java/com/tribufu/generated/GzipRequestInterceptor.java b/src/main/java/com/tribufu/generated/GzipRequestInterceptor.java new file mode 100644 index 0000000..954aa08 --- /dev/null +++ b/src/main/java/com/tribufu/generated/GzipRequestInterceptor.java @@ -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(); + } + }; + } +} diff --git a/src/main/java/com/tribufu/generated/JSON.java b/src/main/java/com/tribufu/generated/JSON.java new file mode 100644 index 0000000..d0f8ef5 --- /dev/null +++ b/src/main/java/com/tribufu/generated/JSON.java @@ -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 Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static 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 { + + @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 { + + 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 { + + 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 { + + 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 { + + 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); + } +} diff --git a/src/main/java/com/tribufu/generated/Pair.java b/src/main/java/com/tribufu/generated/Pair.java new file mode 100644 index 0000000..198e3c8 --- /dev/null +++ b/src/main/java/com/tribufu/generated/Pair.java @@ -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; + } +} diff --git a/src/main/java/com/tribufu/generated/ProgressRequestBody.java b/src/main/java/com/tribufu/generated/ProgressRequestBody.java new file mode 100644 index 0000000..86cbdd4 --- /dev/null +++ b/src/main/java/com/tribufu/generated/ProgressRequestBody.java @@ -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); + } + }; + } +} diff --git a/src/main/java/com/tribufu/generated/ProgressResponseBody.java b/src/main/java/com/tribufu/generated/ProgressResponseBody.java new file mode 100644 index 0000000..d120fee --- /dev/null +++ b/src/main/java/com/tribufu/generated/ProgressResponseBody.java @@ -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; + } + }; + } +} diff --git a/src/main/java/com/tribufu/generated/ServerConfiguration.java b/src/main/java/com/tribufu/generated/ServerConfiguration.java new file mode 100644 index 0000000..e6b20f2 --- /dev/null +++ b/src/main/java/com/tribufu/generated/ServerConfiguration.java @@ -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 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 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 variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry 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); + } +} diff --git a/src/main/java/com/tribufu/generated/ServerVariable.java b/src/main/java/com/tribufu/generated/ServerVariable.java new file mode 100644 index 0000000..153a024 --- /dev/null +++ b/src/main/java/com/tribufu/generated/ServerVariable.java @@ -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 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 enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/src/main/java/com/tribufu/generated/StringUtil.java b/src/main/java/com/tribufu/generated/StringUtil.java new file mode 100644 index 0000000..757c8ee --- /dev/null +++ b/src/main/java/com/tribufu/generated/StringUtil.java @@ -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. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @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 list, String separator) { + Iterator 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(); + } +} diff --git a/src/main/java/com/tribufu/generated/api/TribufuGeneratedApi.java b/src/main/java/com/tribufu/generated/api/TribufuGeneratedApi.java new file mode 100644 index 0000000..e3067a2 --- /dev/null +++ b/src/main/java/com/tribufu/generated/api/TribufuGeneratedApi.java @@ -0,0 +1,9379 @@ +/* + * 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.api; + +import com.tribufu.generated.ApiCallback; +import com.tribufu.generated.ApiClient; +import com.tribufu.generated.ApiException; +import com.tribufu.generated.ApiResponse; +import com.tribufu.generated.Configuration; +import com.tribufu.generated.Pair; +import com.tribufu.generated.ProgressRequestBody; +import com.tribufu.generated.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.tribufu.generated.models.Account; +import com.tribufu.generated.models.AuthorizeRequest; +import com.tribufu.generated.models.CryptoViewModel; +import com.tribufu.generated.models.Game; +import com.tribufu.generated.models.GameServer; +import com.tribufu.generated.models.GameServerCluster; +import com.tribufu.generated.models.Group; +import com.tribufu.generated.models.GroupGame; +import com.tribufu.generated.models.GroupMember; +import com.tribufu.generated.models.HashViewModel; +import com.tribufu.generated.models.IntrospectRequest; +import com.tribufu.generated.models.IpAddress; +import com.tribufu.generated.models.LeaderboardItem; +import com.tribufu.generated.models.LeaderboardOrder; +import com.tribufu.generated.models.LoginRequest; +import com.tribufu.generated.models.LoginResponse; +import com.tribufu.generated.models.ModelPackage; +import com.tribufu.generated.models.Profile; +import com.tribufu.generated.models.ProfileGame; +import com.tribufu.generated.models.ProfileGroup; +import com.tribufu.generated.models.RefreshRequest; +import com.tribufu.generated.models.RegisterRequest; +import com.tribufu.generated.models.RevokeRequest; +import com.tribufu.generated.models.SearchRequest; +import com.tribufu.generated.models.ServerMetrics; +import com.tribufu.generated.models.Subscription; +import com.tribufu.generated.models.TokenRequest; +import com.tribufu.generated.models.TokenResponse; +import java.util.UUID; +import com.tribufu.generated.models.UpdateProfile; +import com.tribufu.generated.models.UserInfo; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class TribufuGeneratedApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public TribufuGeneratedApi() { + this(Configuration.getDefaultApiClient()); + } + + public TribufuGeneratedApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for authorize + * @param authorizeRequest (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call authorizeCall(AuthorizeRequest authorizeRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = authorizeRequest; + + // create path and map variables + String localVarPath = "/v1/oauth2/authorize"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call authorizeValidateBeforeCall(AuthorizeRequest authorizeRequest, final ApiCallback _callback) throws ApiException { + return authorizeCall(authorizeRequest, _callback); + + } + + /** + * Authorize the client to access the user information. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.authorize</code> + * @param authorizeRequest (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void authorize(AuthorizeRequest authorizeRequest) throws ApiException { + authorizeWithHttpInfo(authorizeRequest); + } + + /** + * Authorize the client to access the user information. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.authorize</code> + * @param authorizeRequest (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse authorizeWithHttpInfo(AuthorizeRequest authorizeRequest) throws ApiException { + okhttp3.Call localVarCall = authorizeValidateBeforeCall(authorizeRequest, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Authorize the client to access the user information. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.authorize</code> + * @param authorizeRequest (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call authorizeAsync(AuthorizeRequest authorizeRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = authorizeValidateBeforeCall(authorizeRequest, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for changeEmail + * @param id (required) + * @param body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call changeEmailCall(String id, Object body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/v1/users/{id}/email" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call changeEmailValidateBeforeCall(String id, Object body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling changeEmail(Async)"); + } + + return changeEmailCall(id, body, _callback); + + } + + /** + * Change the email of a user. + * This endpoint is not available with an api key, only with a bearer token.<br/><br/><b>🔒 Required permissions:</b> <code>tribufu.identity.user.email.update</code> + * @param id (required) + * @param body (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void changeEmail(String id, Object body) throws ApiException { + changeEmailWithHttpInfo(id, body); + } + + /** + * Change the email of a user. + * This endpoint is not available with an api key, only with a bearer token.<br/><br/><b>🔒 Required permissions:</b> <code>tribufu.identity.user.email.update</code> + * @param id (required) + * @param body (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse changeEmailWithHttpInfo(String id, Object body) throws ApiException { + okhttp3.Call localVarCall = changeEmailValidateBeforeCall(id, body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Change the email of a user. (asynchronously) + * This endpoint is not available with an api key, only with a bearer token.<br/><br/><b>🔒 Required permissions:</b> <code>tribufu.identity.user.email.update</code> + * @param id (required) + * @param body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call changeEmailAsync(String id, Object body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = changeEmailValidateBeforeCall(id, body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for changePassword + * @param id (required) + * @param body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call changePasswordCall(String id, Object body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/v1/users/{id}/password" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call changePasswordValidateBeforeCall(String id, Object body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling changePassword(Async)"); + } + + return changePasswordCall(id, body, _callback); + + } + + /** + * Change the password of a user. + * This endpoint is not available with an api key, only with a bearer token.<br/><br/><b>🔒 Required permissions:</b> <code>tribufu.identity.user.password.update</code> + * @param id (required) + * @param body (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void changePassword(String id, Object body) throws ApiException { + changePasswordWithHttpInfo(id, body); + } + + /** + * Change the password of a user. + * This endpoint is not available with an api key, only with a bearer token.<br/><br/><b>🔒 Required permissions:</b> <code>tribufu.identity.user.password.update</code> + * @param id (required) + * @param body (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse changePasswordWithHttpInfo(String id, Object body) throws ApiException { + okhttp3.Call localVarCall = changePasswordValidateBeforeCall(id, body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Change the password of a user. (asynchronously) + * This endpoint is not available with an api key, only with a bearer token.<br/><br/><b>🔒 Required permissions:</b> <code>tribufu.identity.user.password.update</code> + * @param id (required) + * @param body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call changePasswordAsync(String id, Object body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = changePasswordValidateBeforeCall(id, body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for claimGameServer + * @param id (required) + * @param body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call claimGameServerCall(String id, Object body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/v1/servers/{id}/claim" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call claimGameServerValidateBeforeCall(String id, Object body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling claimGameServer(Async)"); + } + + return claimGameServerCall(id, body, _callback); + + } + + /** + * Claim a game server. + * This endpoint is not available with an api key, only with a bearer token.<br/><br/><b>🔒 Required permissions:</b> <code>tribufu.community.game.server.claim</code> + * @param id (required) + * @param body (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void claimGameServer(String id, Object body) throws ApiException { + claimGameServerWithHttpInfo(id, body); + } + + /** + * Claim a game server. + * This endpoint is not available with an api key, only with a bearer token.<br/><br/><b>🔒 Required permissions:</b> <code>tribufu.community.game.server.claim</code> + * @param id (required) + * @param body (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse claimGameServerWithHttpInfo(String id, Object body) throws ApiException { + okhttp3.Call localVarCall = claimGameServerValidateBeforeCall(id, body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Claim a game server. (asynchronously) + * This endpoint is not available with an api key, only with a bearer token.<br/><br/><b>🔒 Required permissions:</b> <code>tribufu.community.game.server.claim</code> + * @param id (required) + * @param body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call claimGameServerAsync(String id, Object body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = claimGameServerValidateBeforeCall(id, body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for convertBase64 + * @param cryptoViewModel (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call convertBase64Call(CryptoViewModel cryptoViewModel, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = cryptoViewModel; + + // create path and map variables + String localVarPath = "/v1/utils/base64"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call convertBase64ValidateBeforeCall(CryptoViewModel cryptoViewModel, final ApiCallback _callback) throws ApiException { + return convertBase64Call(cryptoViewModel, _callback); + + } + + /** + * Convert a string to base64 or vice versa. + * <b>🔒 Required permissions:</b> <code>tribufu.utils.convert.base64</code> + * @param cryptoViewModel (optional) + * @return CryptoViewModel + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public CryptoViewModel convertBase64(CryptoViewModel cryptoViewModel) throws ApiException { + ApiResponse localVarResp = convertBase64WithHttpInfo(cryptoViewModel); + return localVarResp.getData(); + } + + /** + * Convert a string to base64 or vice versa. + * <b>🔒 Required permissions:</b> <code>tribufu.utils.convert.base64</code> + * @param cryptoViewModel (optional) + * @return ApiResponse<CryptoViewModel> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse convertBase64WithHttpInfo(CryptoViewModel cryptoViewModel) throws ApiException { + okhttp3.Call localVarCall = convertBase64ValidateBeforeCall(cryptoViewModel, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Convert a string to base64 or vice versa. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.utils.convert.base64</code> + * @param cryptoViewModel (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call convertBase64Async(CryptoViewModel cryptoViewModel, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = convertBase64ValidateBeforeCall(cryptoViewModel, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for createGameServer + * @param body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call createGameServerCall(Object body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/v1/servers"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createGameServerValidateBeforeCall(Object body, final ApiCallback _callback) throws ApiException { + return createGameServerCall(body, _callback); + + } + + /** + * Create a new game server. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.create</code> + * @param body (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void createGameServer(Object body) throws ApiException { + createGameServerWithHttpInfo(body); + } + + /** + * Create a new game server. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.create</code> + * @param body (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse createGameServerWithHttpInfo(Object body) throws ApiException { + okhttp3.Call localVarCall = createGameServerValidateBeforeCall(body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Create a new game server. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.create</code> + * @param body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call createGameServerAsync(Object body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createGameServerValidateBeforeCall(body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createGameServerCluster + * @param body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call createGameServerClusterCall(Object body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/v1/clusters"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createGameServerClusterValidateBeforeCall(Object body, final ApiCallback _callback) throws ApiException { + return createGameServerClusterCall(body, _callback); + + } + + /** + * Create a new game server cluster. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.create</code> + * @param body (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void createGameServerCluster(Object body) throws ApiException { + createGameServerClusterWithHttpInfo(body); + } + + /** + * Create a new game server cluster. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.create</code> + * @param body (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse createGameServerClusterWithHttpInfo(Object body) throws ApiException { + okhttp3.Call localVarCall = createGameServerClusterValidateBeforeCall(body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Create a new game server cluster. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.create</code> + * @param body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call createGameServerClusterAsync(Object body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createGameServerClusterValidateBeforeCall(body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createGroup + * @param body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call createGroupCall(Object body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/v1/groups"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createGroupValidateBeforeCall(Object body, final ApiCallback _callback) throws ApiException { + return createGroupCall(body, _callback); + + } + + /** + * Create a new group. + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.create</code> + * @param body (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void createGroup(Object body) throws ApiException { + createGroupWithHttpInfo(body); + } + + /** + * Create a new group. + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.create</code> + * @param body (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse createGroupWithHttpInfo(Object body) throws ApiException { + okhttp3.Call localVarCall = createGroupValidateBeforeCall(body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Create a new group. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.create</code> + * @param body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call createGroupAsync(Object body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createGroupValidateBeforeCall(body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createToken + * @param tokenRequest (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call createTokenCall(TokenRequest tokenRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = tokenRequest; + + // create path and map variables + String localVarPath = "/v1/oauth2/token"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createTokenValidateBeforeCall(TokenRequest tokenRequest, final ApiCallback _callback) throws ApiException { + return createTokenCall(tokenRequest, _callback); + + } + + /** + * Create a new token with grant type. + * + * @param tokenRequest (optional) + * @return TokenResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public TokenResponse createToken(TokenRequest tokenRequest) throws ApiException { + ApiResponse localVarResp = createTokenWithHttpInfo(tokenRequest); + return localVarResp.getData(); + } + + /** + * Create a new token with grant type. + * + * @param tokenRequest (optional) + * @return ApiResponse<TokenResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse createTokenWithHttpInfo(TokenRequest tokenRequest) throws ApiException { + okhttp3.Call localVarCall = createTokenValidateBeforeCall(tokenRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a new token with grant type. (asynchronously) + * + * @param tokenRequest (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call createTokenAsync(TokenRequest tokenRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createTokenValidateBeforeCall(tokenRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deleteGameServer + * @param id (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call deleteGameServerCall(String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/servers/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteGameServerValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling deleteGameServer(Async)"); + } + + return deleteGameServerCall(id, _callback); + + } + + /** + * Delete a game server. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.delete</code> + * @param id (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void deleteGameServer(String id) throws ApiException { + deleteGameServerWithHttpInfo(id); + } + + /** + * Delete a game server. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.delete</code> + * @param id (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse deleteGameServerWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = deleteGameServerValidateBeforeCall(id, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a game server. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.delete</code> + * @param id (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call deleteGameServerAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteGameServerValidateBeforeCall(id, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deleteGameServerCluster + * @param id (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call deleteGameServerClusterCall(String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/clusters/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteGameServerClusterValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling deleteGameServerCluster(Async)"); + } + + return deleteGameServerClusterCall(id, _callback); + + } + + /** + * Delete a game server cluster. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.delete</code> + * @param id (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void deleteGameServerCluster(String id) throws ApiException { + deleteGameServerClusterWithHttpInfo(id); + } + + /** + * Delete a game server cluster. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.delete</code> + * @param id (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse deleteGameServerClusterWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = deleteGameServerClusterValidateBeforeCall(id, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a game server cluster. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.delete</code> + * @param id (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call deleteGameServerClusterAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteGameServerClusterValidateBeforeCall(id, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deleteGroup + * @param id (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call deleteGroupCall(String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/groups/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteGroupValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling deleteGroup(Async)"); + } + + return deleteGroupCall(id, _callback); + + } + + /** + * Delete a group. + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.delete</code> + * @param id (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void deleteGroup(String id) throws ApiException { + deleteGroupWithHttpInfo(id); + } + + /** + * Delete a group. + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.delete</code> + * @param id (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse deleteGroupWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = deleteGroupValidateBeforeCall(id, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a group. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.delete</code> + * @param id (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call deleteGroupAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteGroupValidateBeforeCall(id, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for generateFlakeId + * @param amount (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call generateFlakeIdCall(Integer amount, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/utils/flake"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (amount != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("amount", amount)); + } + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call generateFlakeIdValidateBeforeCall(Integer amount, final ApiCallback _callback) throws ApiException { + return generateFlakeIdCall(amount, _callback); + + } + + /** + * Generate one or more flake ids. + * <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.flake</code> + * @param amount (optional) + * @return List<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List generateFlakeId(Integer amount) throws ApiException { + ApiResponse> localVarResp = generateFlakeIdWithHttpInfo(amount); + return localVarResp.getData(); + } + + /** + * Generate one or more flake ids. + * <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.flake</code> + * @param amount (optional) + * @return ApiResponse<List<String>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> generateFlakeIdWithHttpInfo(Integer amount) throws ApiException { + okhttp3.Call localVarCall = generateFlakeIdValidateBeforeCall(amount, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Generate one or more flake ids. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.flake</code> + * @param amount (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call generateFlakeIdAsync(Integer amount, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = generateFlakeIdValidateBeforeCall(amount, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for generateFlakeIdFromTimestamp + * @param timestamp (required) + * @param amount (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call generateFlakeIdFromTimestampCall(String timestamp, Integer amount, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/utils/flake/{timestamp}" + .replace("{" + "timestamp" + "}", localVarApiClient.escapeString(timestamp.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (amount != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("amount", amount)); + } + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call generateFlakeIdFromTimestampValidateBeforeCall(String timestamp, Integer amount, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'timestamp' is set + if (timestamp == null) { + throw new ApiException("Missing the required parameter 'timestamp' when calling generateFlakeIdFromTimestamp(Async)"); + } + + return generateFlakeIdFromTimestampCall(timestamp, amount, _callback); + + } + + /** + * Generate one or more flake ids from a timestamp. + * <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.flake.timestamp</code> + * @param timestamp (required) + * @param amount (optional) + * @return List<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List generateFlakeIdFromTimestamp(String timestamp, Integer amount) throws ApiException { + ApiResponse> localVarResp = generateFlakeIdFromTimestampWithHttpInfo(timestamp, amount); + return localVarResp.getData(); + } + + /** + * Generate one or more flake ids from a timestamp. + * <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.flake.timestamp</code> + * @param timestamp (required) + * @param amount (optional) + * @return ApiResponse<List<String>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> generateFlakeIdFromTimestampWithHttpInfo(String timestamp, Integer amount) throws ApiException { + okhttp3.Call localVarCall = generateFlakeIdFromTimestampValidateBeforeCall(timestamp, amount, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Generate one or more flake ids from a timestamp. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.flake.timestamp</code> + * @param timestamp (required) + * @param amount (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call generateFlakeIdFromTimestampAsync(String timestamp, Integer amount, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = generateFlakeIdFromTimestampValidateBeforeCall(timestamp, amount, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for generatePassword + * @param length (optional) + * @param symbols (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call generatePasswordCall(Integer length, Boolean symbols, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/utils/password"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (length != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("length", length)); + } + + if (symbols != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("symbols", symbols)); + } + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call generatePasswordValidateBeforeCall(Integer length, Boolean symbols, final ApiCallback _callback) throws ApiException { + return generatePasswordCall(length, symbols, _callback); + + } + + /** + * Generate a random password. + * <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.password</code> + * @param length (optional) + * @param symbols (optional) + * @return HashViewModel + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public HashViewModel generatePassword(Integer length, Boolean symbols) throws ApiException { + ApiResponse localVarResp = generatePasswordWithHttpInfo(length, symbols); + return localVarResp.getData(); + } + + /** + * Generate a random password. + * <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.password</code> + * @param length (optional) + * @param symbols (optional) + * @return ApiResponse<HashViewModel> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse generatePasswordWithHttpInfo(Integer length, Boolean symbols) throws ApiException { + okhttp3.Call localVarCall = generatePasswordValidateBeforeCall(length, symbols, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Generate a random password. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.password</code> + * @param length (optional) + * @param symbols (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call generatePasswordAsync(Integer length, Boolean symbols, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = generatePasswordValidateBeforeCall(length, symbols, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for generateUuid + * @param version (optional) + * @param amount (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call generateUuidCall(Integer version, Integer amount, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/utils/uuid"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (version != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("version", version)); + } + + if (amount != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("amount", amount)); + } + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call generateUuidValidateBeforeCall(Integer version, Integer amount, final ApiCallback _callback) throws ApiException { + return generateUuidCall(version, amount, _callback); + + } + + /** + * Generate one or more uuids with a specific version. + * <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.uuid</code> + * @param version (optional) + * @param amount (optional) + * @return List<UUID> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List generateUuid(Integer version, Integer amount) throws ApiException { + ApiResponse> localVarResp = generateUuidWithHttpInfo(version, amount); + return localVarResp.getData(); + } + + /** + * Generate one or more uuids with a specific version. + * <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.uuid</code> + * @param version (optional) + * @param amount (optional) + * @return ApiResponse<List<UUID>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> generateUuidWithHttpInfo(Integer version, Integer amount) throws ApiException { + okhttp3.Call localVarCall = generateUuidValidateBeforeCall(version, amount, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Generate one or more uuids with a specific version. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.uuid</code> + * @param version (optional) + * @param amount (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call generateUuidAsync(Integer version, Integer amount, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = generateUuidValidateBeforeCall(version, amount, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getClientInfo + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getClientInfoCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/oauth2/clientinfo"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getClientInfoValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getClientInfoCall(_callback); + + } + + /** + * Get current client information. + * + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void getClientInfo() throws ApiException { + getClientInfoWithHttpInfo(); + } + + /** + * Get current client information. + * + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getClientInfoWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getClientInfoValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Get current client information. (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getClientInfoAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getClientInfoValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getCurrentIpAddress + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getCurrentIpAddressCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/geoip"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getCurrentIpAddressValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getCurrentIpAddressCall(_callback); + + } + + /** + * Get current ip address location. + * <b>🔒 Required permissions:</b> <code>tribufu.geoip.current</code> + * @return List<IpAddress> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getCurrentIpAddress() throws ApiException { + ApiResponse> localVarResp = getCurrentIpAddressWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get current ip address location. + * <b>🔒 Required permissions:</b> <code>tribufu.geoip.current</code> + * @return ApiResponse<List<IpAddress>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getCurrentIpAddressWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getCurrentIpAddressValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get current ip address location. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.geoip.current</code> + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getCurrentIpAddressAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getCurrentIpAddressValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getGameById + * @param id (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameByIdCall(String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/games/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGameByIdValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getGameById(Async)"); + } + + return getGameByIdCall(id, _callback); + + } + + /** + * Get a game by id. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.get</code> + * @param id (required) + * @return Game + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public Game getGameById(String id) throws ApiException { + ApiResponse localVarResp = getGameByIdWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get a game by id. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.get</code> + * @param id (required) + * @return ApiResponse<Game> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getGameByIdWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = getGameByIdValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a game by id. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.get</code> + * @param id (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameByIdAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getGameByIdValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getGameClustersByGameId + * @param id (required) + * @param page (optional) + * @param limit (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameClustersByGameIdCall(String id, Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/games/{id}/clusters" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page", page)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGameClustersByGameIdValidateBeforeCall(String id, Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getGameClustersByGameId(Async)"); + } + + return getGameClustersByGameIdCall(id, page, limit, _callback); + + } + + /** + * Get a list of game server clusters of a game. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.list</code> + * @param id (required) + * @param page (optional) + * @param limit (optional) + * @return List<GameServerCluster> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getGameClustersByGameId(String id, Integer page, Integer limit) throws ApiException { + ApiResponse> localVarResp = getGameClustersByGameIdWithHttpInfo(id, page, limit); + return localVarResp.getData(); + } + + /** + * Get a list of game server clusters of a game. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.list</code> + * @param id (required) + * @param page (optional) + * @param limit (optional) + * @return ApiResponse<List<GameServerCluster>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getGameClustersByGameIdWithHttpInfo(String id, Integer page, Integer limit) throws ApiException { + okhttp3.Call localVarCall = getGameClustersByGameIdValidateBeforeCall(id, page, limit, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of game server clusters of a game. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.list</code> + * @param id (required) + * @param page (optional) + * @param limit (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameClustersByGameIdAsync(String id, Integer page, Integer limit, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getGameClustersByGameIdValidateBeforeCall(id, page, limit, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getGameItems + * @param id (required) + * @param page (optional) + * @param limit (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameItemsCall(String id, Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/games/{id}/items" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page", page)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGameItemsValidateBeforeCall(String id, Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getGameItems(Async)"); + } + + return getGameItemsCall(id, page, limit, _callback); + + } + + /** + * Get a list of game items. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.item.list</code> + * @param id (required) + * @param page (optional) + * @param limit (optional) + * @return List<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getGameItems(String id, Integer page, Integer limit) throws ApiException { + ApiResponse> localVarResp = getGameItemsWithHttpInfo(id, page, limit); + return localVarResp.getData(); + } + + /** + * Get a list of game items. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.item.list</code> + * @param id (required) + * @param page (optional) + * @param limit (optional) + * @return ApiResponse<List<Object>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getGameItemsWithHttpInfo(String id, Integer page, Integer limit) throws ApiException { + okhttp3.Call localVarCall = getGameItemsValidateBeforeCall(id, page, limit, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of game items. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.item.list</code> + * @param id (required) + * @param page (optional) + * @param limit (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameItemsAsync(String id, Integer page, Integer limit, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getGameItemsValidateBeforeCall(id, page, limit, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getGameServerByAddressAndQueryPort + * @param address (required) + * @param port (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameServerByAddressAndQueryPortCall(String address, Integer port, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/servers/address/{address}:{port}" + .replace("{" + "address" + "}", localVarApiClient.escapeString(address.toString())) + .replace("{" + "port" + "}", localVarApiClient.escapeString(port.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGameServerByAddressAndQueryPortValidateBeforeCall(String address, Integer port, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'address' is set + if (address == null) { + throw new ApiException("Missing the required parameter 'address' when calling getGameServerByAddressAndQueryPort(Async)"); + } + + // verify the required parameter 'port' is set + if (port == null) { + throw new ApiException("Missing the required parameter 'port' when calling getGameServerByAddressAndQueryPort(Async)"); + } + + return getGameServerByAddressAndQueryPortCall(address, port, _callback); + + } + + /** + * Get a game server by address and query port. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.get.address</code> + * @param address (required) + * @param port (required) + * @return GameServer + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public GameServer getGameServerByAddressAndQueryPort(String address, Integer port) throws ApiException { + ApiResponse localVarResp = getGameServerByAddressAndQueryPortWithHttpInfo(address, port); + return localVarResp.getData(); + } + + /** + * Get a game server by address and query port. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.get.address</code> + * @param address (required) + * @param port (required) + * @return ApiResponse<GameServer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getGameServerByAddressAndQueryPortWithHttpInfo(String address, Integer port) throws ApiException { + okhttp3.Call localVarCall = getGameServerByAddressAndQueryPortValidateBeforeCall(address, port, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a game server by address and query port. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.get.address</code> + * @param address (required) + * @param port (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameServerByAddressAndQueryPortAsync(String address, Integer port, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getGameServerByAddressAndQueryPortValidateBeforeCall(address, port, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getGameServerById + * @param id (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameServerByIdCall(String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/servers/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGameServerByIdValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getGameServerById(Async)"); + } + + return getGameServerByIdCall(id, _callback); + + } + + /** + * Get a game server by id. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.get</code> + * @param id (required) + * @return GameServer + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public GameServer getGameServerById(String id) throws ApiException { + ApiResponse localVarResp = getGameServerByIdWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get a game server by id. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.get</code> + * @param id (required) + * @return ApiResponse<GameServer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getGameServerByIdWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = getGameServerByIdValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a game server by id. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.get</code> + * @param id (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameServerByIdAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getGameServerByIdValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getGameServerClusterById + * @param id (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameServerClusterByIdCall(String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/clusters/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGameServerClusterByIdValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getGameServerClusterById(Async)"); + } + + return getGameServerClusterByIdCall(id, _callback); + + } + + /** + * Get a game server cluster by id. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.get</code> + * @param id (required) + * @return GameServerCluster + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public GameServerCluster getGameServerClusterById(String id) throws ApiException { + ApiResponse localVarResp = getGameServerClusterByIdWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get a game server cluster by id. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.get</code> + * @param id (required) + * @return ApiResponse<GameServerCluster> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getGameServerClusterByIdWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = getGameServerClusterByIdValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a game server cluster by id. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.get</code> + * @param id (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameServerClusterByIdAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getGameServerClusterByIdValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getGameServerClusters + * @param page (optional) + * @param limit (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameServerClustersCall(Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/clusters"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page", page)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGameServerClustersValidateBeforeCall(Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + return getGameServerClustersCall(page, limit, _callback); + + } + + /** + * Get a list of game server clusters. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.list</code> + * @param page (optional) + * @param limit (optional) + * @return List<GameServerCluster> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getGameServerClusters(Integer page, Integer limit) throws ApiException { + ApiResponse> localVarResp = getGameServerClustersWithHttpInfo(page, limit); + return localVarResp.getData(); + } + + /** + * Get a list of game server clusters. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.list</code> + * @param page (optional) + * @param limit (optional) + * @return ApiResponse<List<GameServerCluster>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getGameServerClustersWithHttpInfo(Integer page, Integer limit) throws ApiException { + okhttp3.Call localVarCall = getGameServerClustersValidateBeforeCall(page, limit, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of game server clusters. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.list</code> + * @param page (optional) + * @param limit (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameServerClustersAsync(Integer page, Integer limit, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getGameServerClustersValidateBeforeCall(page, limit, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getGameServers + * @param page (optional) + * @param limit (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameServersCall(Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/servers"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page", page)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGameServersValidateBeforeCall(Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + return getGameServersCall(page, limit, _callback); + + } + + /** + * Get a list of game servers. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.list</code> + * @param page (optional) + * @param limit (optional) + * @return List<GameServer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getGameServers(Integer page, Integer limit) throws ApiException { + ApiResponse> localVarResp = getGameServersWithHttpInfo(page, limit); + return localVarResp.getData(); + } + + /** + * Get a list of game servers. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.list</code> + * @param page (optional) + * @param limit (optional) + * @return ApiResponse<List<GameServer>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getGameServersWithHttpInfo(Integer page, Integer limit) throws ApiException { + okhttp3.Call localVarCall = getGameServersValidateBeforeCall(page, limit, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of game servers. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.list</code> + * @param page (optional) + * @param limit (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameServersAsync(Integer page, Integer limit, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getGameServersValidateBeforeCall(page, limit, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getGameServersByCountry + * @param country (required) + * @param page (optional) + * @param limit (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameServersByCountryCall(String country, Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/servers/country/{country}" + .replace("{" + "country" + "}", localVarApiClient.escapeString(country.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page", page)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGameServersByCountryValidateBeforeCall(String country, Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'country' is set + if (country == null) { + throw new ApiException("Missing the required parameter 'country' when calling getGameServersByCountry(Async)"); + } + + return getGameServersByCountryCall(country, page, limit, _callback); + + } + + /** + * Get a list of game servers from a country. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.list.country</code> + * @param country (required) + * @param page (optional) + * @param limit (optional) + * @return List<GameServer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getGameServersByCountry(String country, Integer page, Integer limit) throws ApiException { + ApiResponse> localVarResp = getGameServersByCountryWithHttpInfo(country, page, limit); + return localVarResp.getData(); + } + + /** + * Get a list of game servers from a country. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.list.country</code> + * @param country (required) + * @param page (optional) + * @param limit (optional) + * @return ApiResponse<List<GameServer>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getGameServersByCountryWithHttpInfo(String country, Integer page, Integer limit) throws ApiException { + okhttp3.Call localVarCall = getGameServersByCountryValidateBeforeCall(country, page, limit, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of game servers from a country. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.list.country</code> + * @param country (required) + * @param page (optional) + * @param limit (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameServersByCountryAsync(String country, Integer page, Integer limit, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getGameServersByCountryValidateBeforeCall(country, page, limit, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getGameServersByGameId + * @param id (required) + * @param page (optional) + * @param limit (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameServersByGameIdCall(String id, Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/games/{id}/servers" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page", page)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGameServersByGameIdValidateBeforeCall(String id, Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getGameServersByGameId(Async)"); + } + + return getGameServersByGameIdCall(id, page, limit, _callback); + + } + + /** + * Get a list of game servers of a game. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.list</code> + * @param id (required) + * @param page (optional) + * @param limit (optional) + * @return List<GameServer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getGameServersByGameId(String id, Integer page, Integer limit) throws ApiException { + ApiResponse> localVarResp = getGameServersByGameIdWithHttpInfo(id, page, limit); + return localVarResp.getData(); + } + + /** + * Get a list of game servers of a game. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.list</code> + * @param id (required) + * @param page (optional) + * @param limit (optional) + * @return ApiResponse<List<GameServer>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getGameServersByGameIdWithHttpInfo(String id, Integer page, Integer limit) throws ApiException { + okhttp3.Call localVarCall = getGameServersByGameIdValidateBeforeCall(id, page, limit, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of game servers of a game. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.list</code> + * @param id (required) + * @param page (optional) + * @param limit (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameServersByGameIdAsync(String id, Integer page, Integer limit, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getGameServersByGameIdValidateBeforeCall(id, page, limit, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getGameServersCountries + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameServersCountriesCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/servers/countries"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGameServersCountriesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getGameServersCountriesCall(_callback); + + } + + /** + * Get a list of countries with the number of game servers. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.country.list</code> + * @return Map<String, Integer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public Map getGameServersCountries() throws ApiException { + ApiResponse> localVarResp = getGameServersCountriesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get a list of countries with the number of game servers. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.country.list</code> + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getGameServersCountriesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getGameServersCountriesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of countries with the number of game servers. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.country.list</code> + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameServersCountriesAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getGameServersCountriesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getGameServersMetrics + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameServersMetricsCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/servers/metrics"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGameServersMetricsValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getGameServersMetricsCall(_callback); + + } + + /** + * Get metrics about the tracked game servers. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.metric.get</code> + * @return ServerMetrics + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ServerMetrics getGameServersMetrics() throws ApiException { + ApiResponse localVarResp = getGameServersMetricsWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get metrics about the tracked game servers. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.metric.get</code> + * @return ApiResponse<ServerMetrics> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getGameServersMetricsWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getGameServersMetricsValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get metrics about the tracked game servers. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.metric.get</code> + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGameServersMetricsAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getGameServersMetricsValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getGames + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGamesCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/games"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGamesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getGamesCall(_callback); + + } + + /** + * Get a list of games. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.list</code> + * @return List<Game> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getGames() throws ApiException { + ApiResponse> localVarResp = getGamesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get a list of games. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.list</code> + * @return ApiResponse<List<Game>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getGamesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getGamesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of games. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.list</code> + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGamesAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getGamesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getGroupById + * @param id (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGroupByIdCall(String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/groups/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGroupByIdValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getGroupById(Async)"); + } + + return getGroupByIdCall(id, _callback); + + } + + /** + * Get a group by id. + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.get</code> + * @param id (required) + * @return Group + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public Group getGroupById(String id) throws ApiException { + ApiResponse localVarResp = getGroupByIdWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get a group by id. + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.get</code> + * @param id (required) + * @return ApiResponse<Group> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getGroupByIdWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = getGroupByIdValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a group by id. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.get</code> + * @param id (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGroupByIdAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getGroupByIdValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getGroupByTag + * @param tag (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGroupByTagCall(String tag, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/groups/tag/{tag}" + .replace("{" + "tag" + "}", localVarApiClient.escapeString(tag.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGroupByTagValidateBeforeCall(String tag, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'tag' is set + if (tag == null) { + throw new ApiException("Missing the required parameter 'tag' when calling getGroupByTag(Async)"); + } + + return getGroupByTagCall(tag, _callback); + + } + + /** + * Get a group by tag. + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.get.tag</code> + * @param tag (required) + * @return Group + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public Group getGroupByTag(String tag) throws ApiException { + ApiResponse localVarResp = getGroupByTagWithHttpInfo(tag); + return localVarResp.getData(); + } + + /** + * Get a group by tag. + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.get.tag</code> + * @param tag (required) + * @return ApiResponse<Group> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getGroupByTagWithHttpInfo(String tag) throws ApiException { + okhttp3.Call localVarCall = getGroupByTagValidateBeforeCall(tag, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a group by tag. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.get.tag</code> + * @param tag (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGroupByTagAsync(String tag, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getGroupByTagValidateBeforeCall(tag, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getGroupByUuid + * @param uuid (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGroupByUuidCall(UUID uuid, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/groups/uuid/{uuid}" + .replace("{" + "uuid" + "}", localVarApiClient.escapeString(uuid.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGroupByUuidValidateBeforeCall(UUID uuid, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'uuid' is set + if (uuid == null) { + throw new ApiException("Missing the required parameter 'uuid' when calling getGroupByUuid(Async)"); + } + + return getGroupByUuidCall(uuid, _callback); + + } + + /** + * Get a group by uuid. + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.get.uuid</code> + * @param uuid (required) + * @return Group + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public Group getGroupByUuid(UUID uuid) throws ApiException { + ApiResponse localVarResp = getGroupByUuidWithHttpInfo(uuid); + return localVarResp.getData(); + } + + /** + * Get a group by uuid. + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.get.uuid</code> + * @param uuid (required) + * @return ApiResponse<Group> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getGroupByUuidWithHttpInfo(UUID uuid) throws ApiException { + okhttp3.Call localVarCall = getGroupByUuidValidateBeforeCall(uuid, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a group by uuid. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.get.uuid</code> + * @param uuid (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGroupByUuidAsync(UUID uuid, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getGroupByUuidValidateBeforeCall(uuid, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getGroupGames + * @param id (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGroupGamesCall(String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/groups/{id}/games" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGroupGamesValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getGroupGames(Async)"); + } + + return getGroupGamesCall(id, _callback); + + } + + /** + * Get a list of games of a group. + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.game.list</code> + * @param id (required) + * @return List<GroupGame> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getGroupGames(String id) throws ApiException { + ApiResponse> localVarResp = getGroupGamesWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get a list of games of a group. + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.game.list</code> + * @param id (required) + * @return ApiResponse<List<GroupGame>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getGroupGamesWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = getGroupGamesValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of games of a group. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.game.list</code> + * @param id (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGroupGamesAsync(String id, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getGroupGamesValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getGroupMembers + * @param id (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGroupMembersCall(String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/groups/{id}/members" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGroupMembersValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getGroupMembers(Async)"); + } + + return getGroupMembersCall(id, _callback); + + } + + /** + * Get a list of members in a group. + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.member.list</code> + * @param id (required) + * @return List<GroupMember> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getGroupMembers(String id) throws ApiException { + ApiResponse> localVarResp = getGroupMembersWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get a list of members in a group. + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.member.list</code> + * @param id (required) + * @return ApiResponse<List<GroupMember>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getGroupMembersWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = getGroupMembersValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of members in a group. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.member.list</code> + * @param id (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGroupMembersAsync(String id, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getGroupMembersValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getGroups + * @param page (optional) + * @param limit (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGroupsCall(Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/groups"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page", page)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGroupsValidateBeforeCall(Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + return getGroupsCall(page, limit, _callback); + + } + + /** + * Get a list of groups. + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.list</code> + * @param page (optional) + * @param limit (optional) + * @return List<Group> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getGroups(Integer page, Integer limit) throws ApiException { + ApiResponse> localVarResp = getGroupsWithHttpInfo(page, limit); + return localVarResp.getData(); + } + + /** + * Get a list of groups. + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.list</code> + * @param page (optional) + * @param limit (optional) + * @return ApiResponse<List<Group>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getGroupsWithHttpInfo(Integer page, Integer limit) throws ApiException { + okhttp3.Call localVarCall = getGroupsValidateBeforeCall(page, limit, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of groups. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.list</code> + * @param page (optional) + * @param limit (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getGroupsAsync(Integer page, Integer limit, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getGroupsValidateBeforeCall(page, limit, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getIpAddress + * @param address (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getIpAddressCall(String address, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/geoip/addresses/{address}" + .replace("{" + "address" + "}", localVarApiClient.escapeString(address.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getIpAddressValidateBeforeCall(String address, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'address' is set + if (address == null) { + throw new ApiException("Missing the required parameter 'address' when calling getIpAddress(Async)"); + } + + return getIpAddressCall(address, _callback); + + } + + /** + * Get a ip address location. + * <b>🔒 Required permissions:</b> <code>tribufu.geoip.address.get</code> + * @param address (required) + * @return IpAddress + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public IpAddress getIpAddress(String address) throws ApiException { + ApiResponse localVarResp = getIpAddressWithHttpInfo(address); + return localVarResp.getData(); + } + + /** + * Get a ip address location. + * <b>🔒 Required permissions:</b> <code>tribufu.geoip.address.get</code> + * @param address (required) + * @return ApiResponse<IpAddress> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getIpAddressWithHttpInfo(String address) throws ApiException { + okhttp3.Call localVarCall = getIpAddressValidateBeforeCall(address, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a ip address location. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.geoip.address.get</code> + * @param address (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getIpAddressAsync(String address, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getIpAddressValidateBeforeCall(address, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getIpAddresses + * @param page (optional) + * @param limit (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getIpAddressesCall(Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/geoip/addresses"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page", page)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getIpAddressesValidateBeforeCall(Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + return getIpAddressesCall(page, limit, _callback); + + } + + /** + * Get a list of ip addresses. + * <b>🔒 Required permissions:</b> <code>tribufu.geoip.address.list</code> + * @param page (optional) + * @param limit (optional) + * @return List<IpAddress> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getIpAddresses(Integer page, Integer limit) throws ApiException { + ApiResponse> localVarResp = getIpAddressesWithHttpInfo(page, limit); + return localVarResp.getData(); + } + + /** + * Get a list of ip addresses. + * <b>🔒 Required permissions:</b> <code>tribufu.geoip.address.list</code> + * @param page (optional) + * @param limit (optional) + * @return ApiResponse<List<IpAddress>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getIpAddressesWithHttpInfo(Integer page, Integer limit) throws ApiException { + okhttp3.Call localVarCall = getIpAddressesValidateBeforeCall(page, limit, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of ip addresses. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.geoip.address.list</code> + * @param page (optional) + * @param limit (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getIpAddressesAsync(Integer page, Integer limit, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getIpAddressesValidateBeforeCall(page, limit, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getLeaderboard + * @param order (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getLeaderboardCall(LeaderboardOrder order, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/leaderboard"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (order != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("Order", order)); + } + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getLeaderboardValidateBeforeCall(LeaderboardOrder order, final ApiCallback _callback) throws ApiException { + return getLeaderboardCall(order, _callback); + + } + + /** + * Get the top 20 leaderboard users. + * <b>🔒 Required permissions:</b> <code>tribufu.community.leaderboard.get</code> + * @param order (optional) + * @return List<LeaderboardItem> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getLeaderboard(LeaderboardOrder order) throws ApiException { + ApiResponse> localVarResp = getLeaderboardWithHttpInfo(order); + return localVarResp.getData(); + } + + /** + * Get the top 20 leaderboard users. + * <b>🔒 Required permissions:</b> <code>tribufu.community.leaderboard.get</code> + * @param order (optional) + * @return ApiResponse<List<LeaderboardItem>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getLeaderboardWithHttpInfo(LeaderboardOrder order) throws ApiException { + okhttp3.Call localVarCall = getLeaderboardValidateBeforeCall(order, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the top 20 leaderboard users. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.leaderboard.get</code> + * @param order (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getLeaderboardAsync(LeaderboardOrder order, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getLeaderboardValidateBeforeCall(order, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getMe + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call getMeCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/me"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getMeValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getMeCall(_callback); + + } + + /** + * Get current user information. + * + * @return UserInfo + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ * @deprecated + */ + @Deprecated + public UserInfo getMe() throws ApiException { + ApiResponse localVarResp = getMeWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get current user information. + * + * @return ApiResponse<UserInfo> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ * @deprecated + */ + @Deprecated + public ApiResponse getMeWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getMeValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get current user information. (asynchronously) + * + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call getMeAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getMeValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPackageById + * @param id (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getPackageByIdCall(String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/packages/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPackageByIdValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getPackageById(Async)"); + } + + return getPackageByIdCall(id, _callback); + + } + + /** + * Get a package by id. + * <b>🔒 Required permissions:</b> <code>tribufu.community.package.get</code> + * @param id (required) + * @return ModelPackage + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ModelPackage getPackageById(String id) throws ApiException { + ApiResponse localVarResp = getPackageByIdWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get a package by id. + * <b>🔒 Required permissions:</b> <code>tribufu.community.package.get</code> + * @param id (required) + * @return ApiResponse<ModelPackage> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getPackageByIdWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = getPackageByIdValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a package by id. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.package.get</code> + * @param id (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getPackageByIdAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPackageByIdValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPackages + * @param page (optional) + * @param limit (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getPackagesCall(Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/packages"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page", page)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPackagesValidateBeforeCall(Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + return getPackagesCall(page, limit, _callback); + + } + + /** + * Get a list of packages. + * <b>🔒 Required permissions:</b> <code>tribufu.community.package.list</code> + * @param page (optional) + * @param limit (optional) + * @return List<ModelPackage> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getPackages(Integer page, Integer limit) throws ApiException { + ApiResponse> localVarResp = getPackagesWithHttpInfo(page, limit); + return localVarResp.getData(); + } + + /** + * Get a list of packages. + * <b>🔒 Required permissions:</b> <code>tribufu.community.package.list</code> + * @param page (optional) + * @param limit (optional) + * @return ApiResponse<List<ModelPackage>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getPackagesWithHttpInfo(Integer page, Integer limit) throws ApiException { + okhttp3.Call localVarCall = getPackagesValidateBeforeCall(page, limit, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of packages. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.package.list</code> + * @param page (optional) + * @param limit (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getPackagesAsync(Integer page, Integer limit, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getPackagesValidateBeforeCall(page, limit, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPublicKeys + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getPublicKeysCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/oauth2/jwks"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPublicKeysValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getPublicKeysCall(_callback); + + } + + /** + * Get the public keys for the client. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.client.keys</code> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void getPublicKeys() throws ApiException { + getPublicKeysWithHttpInfo(); + } + + /** + * Get the public keys for the client. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.client.keys</code> + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getPublicKeysWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getPublicKeysValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Get the public keys for the client. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.client.keys</code> + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getPublicKeysAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPublicKeysValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getSubscriptionById + * @param id (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getSubscriptionByIdCall(String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/subscriptions/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSubscriptionByIdValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getSubscriptionById(Async)"); + } + + return getSubscriptionByIdCall(id, _callback); + + } + + /** + * Get a subscription by id. + * <b>🔒 Required permissions:</b> <code>tribufu.store.subscription.get</code> + * @param id (required) + * @return Subscription + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public Subscription getSubscriptionById(String id) throws ApiException { + ApiResponse localVarResp = getSubscriptionByIdWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get a subscription by id. + * <b>🔒 Required permissions:</b> <code>tribufu.store.subscription.get</code> + * @param id (required) + * @return ApiResponse<Subscription> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getSubscriptionByIdWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = getSubscriptionByIdValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a subscription by id. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.store.subscription.get</code> + * @param id (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getSubscriptionByIdAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSubscriptionByIdValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getSubscriptions + * @param page (optional) + * @param limit (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getSubscriptionsCall(Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/subscriptions"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page", page)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSubscriptionsValidateBeforeCall(Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + return getSubscriptionsCall(page, limit, _callback); + + } + + /** + * Get a list of subscriptions. + * <b>🔒 Required permissions:</b> <code>tribufu.store.subscription.list</code> + * @param page (optional) + * @param limit (optional) + * @return List<Subscription> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getSubscriptions(Integer page, Integer limit) throws ApiException { + ApiResponse> localVarResp = getSubscriptionsWithHttpInfo(page, limit); + return localVarResp.getData(); + } + + /** + * Get a list of subscriptions. + * <b>🔒 Required permissions:</b> <code>tribufu.store.subscription.list</code> + * @param page (optional) + * @param limit (optional) + * @return ApiResponse<List<Subscription>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getSubscriptionsWithHttpInfo(Integer page, Integer limit) throws ApiException { + okhttp3.Call localVarCall = getSubscriptionsValidateBeforeCall(page, limit, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of subscriptions. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.store.subscription.list</code> + * @param page (optional) + * @param limit (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getSubscriptionsAsync(Integer page, Integer limit, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getSubscriptionsValidateBeforeCall(page, limit, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getUserAccounts + * @param id (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserAccountsCall(String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/users/{id}/accounts" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserAccountsValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getUserAccounts(Async)"); + } + + return getUserAccountsCall(id, _callback); + + } + + /** + * Get a list of connected accounts of the user. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.user.account.list</code> + * @param id (required) + * @return List<Account> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getUserAccounts(String id) throws ApiException { + ApiResponse> localVarResp = getUserAccountsWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get a list of connected accounts of the user. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.user.account.list</code> + * @param id (required) + * @return ApiResponse<List<Account>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getUserAccountsWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = getUserAccountsValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of connected accounts of the user. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.identity.user.account.list</code> + * @param id (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserAccountsAsync(String id, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserAccountsValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getUserById + * @param id (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserByIdCall(String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/users/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserByIdValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getUserById(Async)"); + } + + return getUserByIdCall(id, _callback); + + } + + /** + * Get a user profile by id. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.get</code> + * @param id (required) + * @return Profile + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public Profile getUserById(String id) throws ApiException { + ApiResponse localVarResp = getUserByIdWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get a user profile by id. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.get</code> + * @param id (required) + * @return ApiResponse<Profile> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getUserByIdWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = getUserByIdValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a user profile by id. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.get</code> + * @param id (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserByIdAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserByIdValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getUserByName + * @param name (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserByNameCall(String name, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/users/name/{name}" + .replace("{" + "name" + "}", localVarApiClient.escapeString(name.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserByNameValidateBeforeCall(String name, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling getUserByName(Async)"); + } + + return getUserByNameCall(name, _callback); + + } + + /** + * Get a user profile by name. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.get.name</code> + * @param name (required) + * @return Profile + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public Profile getUserByName(String name) throws ApiException { + ApiResponse localVarResp = getUserByNameWithHttpInfo(name); + return localVarResp.getData(); + } + + /** + * Get a user profile by name. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.get.name</code> + * @param name (required) + * @return ApiResponse<Profile> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getUserByNameWithHttpInfo(String name) throws ApiException { + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(name, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a user profile by name. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.get.name</code> + * @param name (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserByNameAsync(String name, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(name, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getUserByUuid + * @param uuid (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserByUuidCall(UUID uuid, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/users/uuid/{uuid}" + .replace("{" + "uuid" + "}", localVarApiClient.escapeString(uuid.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserByUuidValidateBeforeCall(UUID uuid, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'uuid' is set + if (uuid == null) { + throw new ApiException("Missing the required parameter 'uuid' when calling getUserByUuid(Async)"); + } + + return getUserByUuidCall(uuid, _callback); + + } + + /** + * Get a user profile by uuid. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.get.uuid</code> + * @param uuid (required) + * @return Profile + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public Profile getUserByUuid(UUID uuid) throws ApiException { + ApiResponse localVarResp = getUserByUuidWithHttpInfo(uuid); + return localVarResp.getData(); + } + + /** + * Get a user profile by uuid. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.get.uuid</code> + * @param uuid (required) + * @return ApiResponse<Profile> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getUserByUuidWithHttpInfo(UUID uuid) throws ApiException { + okhttp3.Call localVarCall = getUserByUuidValidateBeforeCall(uuid, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a user profile by uuid. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.get.uuid</code> + * @param uuid (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserByUuidAsync(UUID uuid, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserByUuidValidateBeforeCall(uuid, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getUserFriends + * @param id (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserFriendsCall(String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/users/{id}/friends" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserFriendsValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getUserFriends(Async)"); + } + + return getUserFriendsCall(id, _callback); + + } + + /** + * Get a list of friends of the user. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.friend.list</code> + * @param id (required) + * @return List<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getUserFriends(String id) throws ApiException { + ApiResponse> localVarResp = getUserFriendsWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get a list of friends of the user. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.friend.list</code> + * @param id (required) + * @return ApiResponse<List<Object>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getUserFriendsWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = getUserFriendsValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of friends of the user. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.friend.list</code> + * @param id (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserFriendsAsync(String id, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserFriendsValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getUserGames + * @param id (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserGamesCall(String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/users/{id}/games" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserGamesValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getUserGames(Async)"); + } + + return getUserGamesCall(id, _callback); + + } + + /** + * Get a list of games the user has played. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.game.list</code> + * @param id (required) + * @return List<ProfileGame> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getUserGames(String id) throws ApiException { + ApiResponse> localVarResp = getUserGamesWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get a list of games the user has played. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.game.list</code> + * @param id (required) + * @return ApiResponse<List<ProfileGame>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getUserGamesWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = getUserGamesValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of games the user has played. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.game.list</code> + * @param id (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserGamesAsync(String id, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserGamesValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getUserGroups + * @param id (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserGroupsCall(String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/users/{id}/groups" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserGroupsValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getUserGroups(Async)"); + } + + return getUserGroupsCall(id, _callback); + + } + + /** + * Get a list of groups the user is a member of. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.group.list</code> + * @param id (required) + * @return List<ProfileGroup> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getUserGroups(String id) throws ApiException { + ApiResponse> localVarResp = getUserGroupsWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get a list of groups the user is a member of. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.group.list</code> + * @param id (required) + * @return ApiResponse<List<ProfileGroup>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getUserGroupsWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = getUserGroupsValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of groups the user is a member of. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.group.list</code> + * @param id (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserGroupsAsync(String id, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserGroupsValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getUserInfo + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserInfoCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/oauth2/userinfo"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserInfoValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getUserInfoCall(_callback); + + } + + /** + * Get current user information. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.user.info</code> + * @return UserInfo + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public UserInfo getUserInfo() throws ApiException { + ApiResponse localVarResp = getUserInfoWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get current user information. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.user.info</code> + * @return ApiResponse<UserInfo> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse getUserInfoWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getUserInfoValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get current user information. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.user.info</code> + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserInfoAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserInfoValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getUserPunishments + * @param id (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserPunishmentsCall(String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/users/{id}/punishments" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserPunishmentsValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getUserPunishments(Async)"); + } + + return getUserPunishmentsCall(id, _callback); + + } + + /** + * Get a list of punishments the user has received. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.punishment.list</code> + * @param id (required) + * @return List<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getUserPunishments(String id) throws ApiException { + ApiResponse> localVarResp = getUserPunishmentsWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get a list of punishments the user has received. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.punishment.list</code> + * @param id (required) + * @return ApiResponse<List<Object>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getUserPunishmentsWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = getUserPunishmentsValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of punishments the user has received. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.punishment.list</code> + * @param id (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserPunishmentsAsync(String id, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserPunishmentsValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getUserServers + * @param id (required) + * @param page (optional) + * @param limit (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserServersCall(String id, Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/users/{id}/servers" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page", page)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserServersValidateBeforeCall(String id, Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getUserServers(Async)"); + } + + return getUserServersCall(id, page, limit, _callback); + + } + + /** + * Get a list of servers the user is owner of. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.game.server.list</code> + * @param id (required) + * @param page (optional) + * @param limit (optional) + * @return List<GameServer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getUserServers(String id, Integer page, Integer limit) throws ApiException { + ApiResponse> localVarResp = getUserServersWithHttpInfo(id, page, limit); + return localVarResp.getData(); + } + + /** + * Get a list of servers the user is owner of. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.game.server.list</code> + * @param id (required) + * @param page (optional) + * @param limit (optional) + * @return ApiResponse<List<GameServer>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getUserServersWithHttpInfo(String id, Integer page, Integer limit) throws ApiException { + okhttp3.Call localVarCall = getUserServersValidateBeforeCall(id, page, limit, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of servers the user is owner of. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.game.server.list</code> + * @param id (required) + * @param page (optional) + * @param limit (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUserServersAsync(String id, Integer page, Integer limit, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserServersValidateBeforeCall(id, page, limit, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getUsers + * @param page (optional) + * @param limit (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUsersCall(Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/users"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page", page)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUsersValidateBeforeCall(Integer page, Integer limit, final ApiCallback _callback) throws ApiException { + return getUsersCall(page, limit, _callback); + + } + + /** + * Get a list of user profiles. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.list</code> + * @param page (optional) + * @param limit (optional) + * @return List<Profile> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List getUsers(Integer page, Integer limit) throws ApiException { + ApiResponse> localVarResp = getUsersWithHttpInfo(page, limit); + return localVarResp.getData(); + } + + /** + * Get a list of user profiles. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.list</code> + * @param page (optional) + * @param limit (optional) + * @return ApiResponse<List<Profile>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> getUsersWithHttpInfo(Integer page, Integer limit) throws ApiException { + okhttp3.Call localVarCall = getUsersValidateBeforeCall(page, limit, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of user profiles. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.list</code> + * @param page (optional) + * @param limit (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call getUsersAsync(Integer page, Integer limit, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getUsersValidateBeforeCall(page, limit, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for hashArgon2 + * @param hashViewModel (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call hashArgon2Call(HashViewModel hashViewModel, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = hashViewModel; + + // create path and map variables + String localVarPath = "/v1/utils/argon2"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call hashArgon2ValidateBeforeCall(HashViewModel hashViewModel, final ApiCallback _callback) throws ApiException { + return hashArgon2Call(hashViewModel, _callback); + + } + + /** + * Hash a string using argon2. + * <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.argon2</code> + * @param hashViewModel (optional) + * @return HashViewModel + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public HashViewModel hashArgon2(HashViewModel hashViewModel) throws ApiException { + ApiResponse localVarResp = hashArgon2WithHttpInfo(hashViewModel); + return localVarResp.getData(); + } + + /** + * Hash a string using argon2. + * <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.argon2</code> + * @param hashViewModel (optional) + * @return ApiResponse<HashViewModel> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse hashArgon2WithHttpInfo(HashViewModel hashViewModel) throws ApiException { + okhttp3.Call localVarCall = hashArgon2ValidateBeforeCall(hashViewModel, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Hash a string using argon2. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.argon2</code> + * @param hashViewModel (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call hashArgon2Async(HashViewModel hashViewModel, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = hashArgon2ValidateBeforeCall(hashViewModel, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for hashBcrypt + * @param hashViewModel (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call hashBcryptCall(HashViewModel hashViewModel, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = hashViewModel; + + // create path and map variables + String localVarPath = "/v1/utils/bcrypt"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call hashBcryptValidateBeforeCall(HashViewModel hashViewModel, final ApiCallback _callback) throws ApiException { + return hashBcryptCall(hashViewModel, _callback); + + } + + /** + * Hash a string using bcrypt. + * <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.bcrypt</code> + * @param hashViewModel (optional) + * @return HashViewModel + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public HashViewModel hashBcrypt(HashViewModel hashViewModel) throws ApiException { + ApiResponse localVarResp = hashBcryptWithHttpInfo(hashViewModel); + return localVarResp.getData(); + } + + /** + * Hash a string using bcrypt. + * <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.bcrypt</code> + * @param hashViewModel (optional) + * @return ApiResponse<HashViewModel> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse hashBcryptWithHttpInfo(HashViewModel hashViewModel) throws ApiException { + okhttp3.Call localVarCall = hashBcryptValidateBeforeCall(hashViewModel, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Hash a string using bcrypt. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.bcrypt</code> + * @param hashViewModel (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call hashBcryptAsync(HashViewModel hashViewModel, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = hashBcryptValidateBeforeCall(hashViewModel, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for hashMd5 + * @param hashViewModel (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call hashMd5Call(HashViewModel hashViewModel, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = hashViewModel; + + // create path and map variables + String localVarPath = "/v1/utils/md5"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call hashMd5ValidateBeforeCall(HashViewModel hashViewModel, final ApiCallback _callback) throws ApiException { + return hashMd5Call(hashViewModel, _callback); + + } + + /** + * Hash a string using md5. + * <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.md5</code> + * @param hashViewModel (optional) + * @return HashViewModel + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public HashViewModel hashMd5(HashViewModel hashViewModel) throws ApiException { + ApiResponse localVarResp = hashMd5WithHttpInfo(hashViewModel); + return localVarResp.getData(); + } + + /** + * Hash a string using md5. + * <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.md5</code> + * @param hashViewModel (optional) + * @return ApiResponse<HashViewModel> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse hashMd5WithHttpInfo(HashViewModel hashViewModel) throws ApiException { + okhttp3.Call localVarCall = hashMd5ValidateBeforeCall(hashViewModel, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Hash a string using md5. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.md5</code> + * @param hashViewModel (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call hashMd5Async(HashViewModel hashViewModel, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = hashMd5ValidateBeforeCall(hashViewModel, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for hashSha256 + * @param hashViewModel (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call hashSha256Call(HashViewModel hashViewModel, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = hashViewModel; + + // create path and map variables + String localVarPath = "/v1/utils/sha256"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call hashSha256ValidateBeforeCall(HashViewModel hashViewModel, final ApiCallback _callback) throws ApiException { + return hashSha256Call(hashViewModel, _callback); + + } + + /** + * Hash a string using sha256. + * <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.sha256</code> + * @param hashViewModel (optional) + * @return HashViewModel + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public HashViewModel hashSha256(HashViewModel hashViewModel) throws ApiException { + ApiResponse localVarResp = hashSha256WithHttpInfo(hashViewModel); + return localVarResp.getData(); + } + + /** + * Hash a string using sha256. + * <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.sha256</code> + * @param hashViewModel (optional) + * @return ApiResponse<HashViewModel> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse hashSha256WithHttpInfo(HashViewModel hashViewModel) throws ApiException { + okhttp3.Call localVarCall = hashSha256ValidateBeforeCall(hashViewModel, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Hash a string using sha256. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.sha256</code> + * @param hashViewModel (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call hashSha256Async(HashViewModel hashViewModel, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = hashSha256ValidateBeforeCall(hashViewModel, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for introspectToken + * @param introspectRequest (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call introspectTokenCall(IntrospectRequest introspectRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = introspectRequest; + + // create path and map variables + String localVarPath = "/v1/oauth2/introspect"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call introspectTokenValidateBeforeCall(IntrospectRequest introspectRequest, final ApiCallback _callback) throws ApiException { + return introspectTokenCall(introspectRequest, _callback); + + } + + /** + * Introspect a token. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.token.introspect</code> + * @param introspectRequest (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void introspectToken(IntrospectRequest introspectRequest) throws ApiException { + introspectTokenWithHttpInfo(introspectRequest); + } + + /** + * Introspect a token. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.token.introspect</code> + * @param introspectRequest (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse introspectTokenWithHttpInfo(IntrospectRequest introspectRequest) throws ApiException { + okhttp3.Call localVarCall = introspectTokenValidateBeforeCall(introspectRequest, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Introspect a token. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.token.introspect</code> + * @param introspectRequest (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call introspectTokenAsync(IntrospectRequest introspectRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = introspectTokenValidateBeforeCall(introspectRequest, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for login + * @param loginRequest (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call loginCall(LoginRequest loginRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = loginRequest; + + // create path and map variables + String localVarPath = "/v1/login"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call loginValidateBeforeCall(LoginRequest loginRequest, final ApiCallback _callback) throws ApiException { + return loginCall(loginRequest, _callback); + + } + + /** + * Login with name or email and password. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.token.create</code> + * @param loginRequest (optional) + * @return LoginResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ * @deprecated + */ + @Deprecated + public LoginResponse login(LoginRequest loginRequest) throws ApiException { + ApiResponse localVarResp = loginWithHttpInfo(loginRequest); + return localVarResp.getData(); + } + + /** + * Login with name or email and password. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.token.create</code> + * @param loginRequest (optional) + * @return ApiResponse<LoginResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ * @deprecated + */ + @Deprecated + public ApiResponse loginWithHttpInfo(LoginRequest loginRequest) throws ApiException { + okhttp3.Call localVarCall = loginValidateBeforeCall(loginRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Login with name or email and password. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.identity.token.create</code> + * @param loginRequest (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call loginAsync(LoginRequest loginRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = loginValidateBeforeCall(loginRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for logout + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call logoutCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v1/logout"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call logoutValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return logoutCall(_callback); + + } + + /** + * Invalidate credentials. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.token.revoke</code> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ * @deprecated + */ + @Deprecated + public void logout() throws ApiException { + logoutWithHttpInfo(); + } + + /** + * Invalidate credentials. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.token.revoke</code> + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ * @deprecated + */ + @Deprecated + public ApiResponse logoutWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = logoutValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Invalidate credentials. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.identity.token.revoke</code> + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call logoutAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = logoutValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for refresh + * @param refreshRequest (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call refreshCall(RefreshRequest refreshRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = refreshRequest; + + // create path and map variables + String localVarPath = "/v1/refresh"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call refreshValidateBeforeCall(RefreshRequest refreshRequest, final ApiCallback _callback) throws ApiException { + return refreshCall(refreshRequest, _callback); + + } + + /** + * Refresh credentials. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.token.refresh</code> + * @param refreshRequest (optional) + * @return LoginResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ * @deprecated + */ + @Deprecated + public LoginResponse refresh(RefreshRequest refreshRequest) throws ApiException { + ApiResponse localVarResp = refreshWithHttpInfo(refreshRequest); + return localVarResp.getData(); + } + + /** + * Refresh credentials. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.token.refresh</code> + * @param refreshRequest (optional) + * @return ApiResponse<LoginResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ * @deprecated + */ + @Deprecated + public ApiResponse refreshWithHttpInfo(RefreshRequest refreshRequest) throws ApiException { + okhttp3.Call localVarCall = refreshValidateBeforeCall(refreshRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Refresh credentials. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.identity.token.refresh</code> + * @param refreshRequest (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call refreshAsync(RefreshRequest refreshRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = refreshValidateBeforeCall(refreshRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for register + * @param registerRequest (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call registerCall(RegisterRequest registerRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = registerRequest; + + // create path and map variables + String localVarPath = "/v1/register"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call registerValidateBeforeCall(RegisterRequest registerRequest, final ApiCallback _callback) throws ApiException { + return registerCall(registerRequest, _callback); + + } + + /** + * Create a new user. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.user.create</code> + * @param registerRequest (optional) + * @return LoginResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public LoginResponse register(RegisterRequest registerRequest) throws ApiException { + ApiResponse localVarResp = registerWithHttpInfo(registerRequest); + return localVarResp.getData(); + } + + /** + * Create a new user. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.user.create</code> + * @param registerRequest (optional) + * @return ApiResponse<LoginResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse registerWithHttpInfo(RegisterRequest registerRequest) throws ApiException { + okhttp3.Call localVarCall = registerValidateBeforeCall(registerRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a new user. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.identity.user.create</code> + * @param registerRequest (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call registerAsync(RegisterRequest registerRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = registerValidateBeforeCall(registerRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for revokeToken + * @param revokeRequest (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call revokeTokenCall(RevokeRequest revokeRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = revokeRequest; + + // create path and map variables + String localVarPath = "/v1/oauth2/revoke"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/x-www-form-urlencoded" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call revokeTokenValidateBeforeCall(RevokeRequest revokeRequest, final ApiCallback _callback) throws ApiException { + return revokeTokenCall(revokeRequest, _callback); + + } + + /** + * Revoke a token. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.token.revoke</code> + * @param revokeRequest (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void revokeToken(RevokeRequest revokeRequest) throws ApiException { + revokeTokenWithHttpInfo(revokeRequest); + } + + /** + * Revoke a token. + * <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.token.revoke</code> + * @param revokeRequest (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse revokeTokenWithHttpInfo(RevokeRequest revokeRequest) throws ApiException { + okhttp3.Call localVarCall = revokeTokenValidateBeforeCall(revokeRequest, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Revoke a token. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.token.revoke</code> + * @param revokeRequest (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call revokeTokenAsync(RevokeRequest revokeRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = revokeTokenValidateBeforeCall(revokeRequest, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for search + * @param searchRequest (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call searchCall(SearchRequest searchRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = searchRequest; + + // create path and map variables + String localVarPath = "/v1/search"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call searchValidateBeforeCall(SearchRequest searchRequest, final ApiCallback _callback) throws ApiException { + return searchCall(searchRequest, _callback); + + } + + /** + * Advanced search for servers or players. + * <b>🔒 Required permissions:</b> <code>tribufu.community.search</code> + * @param searchRequest (optional) + * @return List<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public List search(SearchRequest searchRequest) throws ApiException { + ApiResponse> localVarResp = searchWithHttpInfo(searchRequest); + return localVarResp.getData(); + } + + /** + * Advanced search for servers or players. + * <b>🔒 Required permissions:</b> <code>tribufu.community.search</code> + * @param searchRequest (optional) + * @return ApiResponse<List<Object>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse> searchWithHttpInfo(SearchRequest searchRequest) throws ApiException { + okhttp3.Call localVarCall = searchValidateBeforeCall(searchRequest, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Advanced search for servers or players. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.search</code> + * @param searchRequest (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call searchAsync(SearchRequest searchRequest, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = searchValidateBeforeCall(searchRequest, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateGameServer + * @param id (required) + * @param body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call updateGameServerCall(String id, Object body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/v1/servers/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateGameServerValidateBeforeCall(String id, Object body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling updateGameServer(Async)"); + } + + return updateGameServerCall(id, body, _callback); + + } + + /** + * Update a game server. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.update</code> + * @param id (required) + * @param body (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void updateGameServer(String id, Object body) throws ApiException { + updateGameServerWithHttpInfo(id, body); + } + + /** + * Update a game server. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.update</code> + * @param id (required) + * @param body (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse updateGameServerWithHttpInfo(String id, Object body) throws ApiException { + okhttp3.Call localVarCall = updateGameServerValidateBeforeCall(id, body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update a game server. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.update</code> + * @param id (required) + * @param body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call updateGameServerAsync(String id, Object body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateGameServerValidateBeforeCall(id, body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateGameServerCluster + * @param id (required) + * @param body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call updateGameServerClusterCall(String id, Object body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/v1/clusters/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateGameServerClusterValidateBeforeCall(String id, Object body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling updateGameServerCluster(Async)"); + } + + return updateGameServerClusterCall(id, body, _callback); + + } + + /** + * Update a game server cluster. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.update</code> + * @param id (required) + * @param body (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void updateGameServerCluster(String id, Object body) throws ApiException { + updateGameServerClusterWithHttpInfo(id, body); + } + + /** + * Update a game server cluster. + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.update</code> + * @param id (required) + * @param body (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse updateGameServerClusterWithHttpInfo(String id, Object body) throws ApiException { + okhttp3.Call localVarCall = updateGameServerClusterValidateBeforeCall(id, body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update a game server cluster. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.update</code> + * @param id (required) + * @param body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call updateGameServerClusterAsync(String id, Object body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateGameServerClusterValidateBeforeCall(id, body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateGroup + * @param id (required) + * @param body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call updateGroupCall(String id, Object body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/v1/groups/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateGroupValidateBeforeCall(String id, Object body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling updateGroup(Async)"); + } + + return updateGroupCall(id, body, _callback); + + } + + /** + * Update a group. + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.update</code> + * @param id (required) + * @param body (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public void updateGroup(String id, Object body) throws ApiException { + updateGroupWithHttpInfo(id, body); + } + + /** + * Update a group. + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.update</code> + * @param id (required) + * @param body (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse updateGroupWithHttpInfo(String id, Object body) throws ApiException { + okhttp3.Call localVarCall = updateGroupValidateBeforeCall(id, body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update a group. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.group.update</code> + * @param id (required) + * @param body (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call updateGroupAsync(String id, Object body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateGroupValidateBeforeCall(id, body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateUserProfile + * @param id (required) + * @param updateProfile (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call updateUserProfileCall(String id, UpdateProfile updateProfile, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateProfile; + + // create path and map variables + String localVarPath = "/v1/users/{id}/profile" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "text/plain", + "application/json", + "text/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json-patch+json", + "application/json", + "text/json", + "application/*+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKey" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateUserProfileValidateBeforeCall(String id, UpdateProfile updateProfile, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling updateUserProfile(Async)"); + } + + return updateUserProfileCall(id, updateProfile, _callback); + + } + + /** + * Update a user profile. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.update</code> + * @param id (required) + * @param updateProfile (optional) + * @return Profile + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public Profile updateUserProfile(String id, UpdateProfile updateProfile) throws ApiException { + ApiResponse localVarResp = updateUserProfileWithHttpInfo(id, updateProfile); + return localVarResp.getData(); + } + + /** + * Update a user profile. + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.update</code> + * @param id (required) + * @param updateProfile (optional) + * @return ApiResponse<Profile> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public ApiResponse updateUserProfileWithHttpInfo(String id, UpdateProfile updateProfile) throws ApiException { + okhttp3.Call localVarCall = updateUserProfileValidateBeforeCall(id, updateProfile, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update a user profile. (asynchronously) + * <b>🔒 Required permissions:</b> <code>tribufu.community.profile.update</code> + * @param id (required) + * @param updateProfile (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 OK -
+ */ + public okhttp3.Call updateUserProfileAsync(String id, UpdateProfile updateProfile, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateUserProfileValidateBeforeCall(id, updateProfile, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/tribufu/generated/auth/ApiKeyAuth.java b/src/main/java/com/tribufu/generated/auth/ApiKeyAuth.java new file mode 100644 index 0000000..c18cadf --- /dev/null +++ b/src/main/java/com/tribufu/generated/auth/ApiKeyAuth.java @@ -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 queryParams, Map headerParams, Map 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); + } + } +} diff --git a/src/main/java/com/tribufu/generated/auth/Authentication.java b/src/main/java/com/tribufu/generated/auth/Authentication.java new file mode 100644 index 0000000..8b489d5 --- /dev/null +++ b/src/main/java/com/tribufu/generated/auth/Authentication.java @@ -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 queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/src/main/java/com/tribufu/generated/auth/HttpBasicAuth.java b/src/main/java/com/tribufu/generated/auth/HttpBasicAuth.java new file mode 100644 index 0000000..443de7b --- /dev/null +++ b/src/main/java/com/tribufu/generated/auth/HttpBasicAuth.java @@ -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 queryParams, Map headerParams, Map 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)); + } +} diff --git a/src/main/java/com/tribufu/generated/auth/HttpBearerAuth.java b/src/main/java/com/tribufu/generated/auth/HttpBearerAuth.java new file mode 100644 index 0000000..1574433 --- /dev/null +++ b/src/main/java/com/tribufu/generated/auth/HttpBearerAuth.java @@ -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 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 tokenSupplier) { + this.tokenSupplier = tokenSupplier; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map 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; + } +} diff --git a/src/main/java/com/tribufu/generated/models/AbstractOpenApiSchema.java b/src/main/java/com/tribufu/generated/models/AbstractOpenApiSchema.java new file mode 100644 index 0000000..3b797a8 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/AbstractOpenApiSchema.java @@ -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> 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; + } + } + + + +} diff --git a/src/main/java/com/tribufu/generated/models/Account.java b/src/main/java/com/tribufu/generated/models/Account.java new file mode 100644 index 0000000..80e47f3 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/Account.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, provider, userId, authorized, fields, created, updated); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + 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(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!Account.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Account' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Account.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/Application.java b/src/main/java/com/tribufu/generated/models/Application.java new file mode 100644 index 0000000..e347710 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/Application.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, description, type, organizationId, iconUrl, bannerUrl, capsuleImageUrl, libraryImageUrl, parentId, slug, visibility, password, primary, userCount, achievementCount, badgeCount, downloadCount, created, updated); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + 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(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!Application.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Application' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Application.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/ApplicationType.java b/src/main/java/com/tribufu/generated/models/ApplicationType.java new file mode 100644 index 0000000..4f40ea1 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/ApplicationType.java @@ -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 { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/AuthorizeRequest.java b/src/main/java/com/tribufu/generated/models/AuthorizeRequest.java new file mode 100644 index 0000000..f9dbb0e --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/AuthorizeRequest.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(responseType, clientId, codeChallenge, codeChallengeMethod, redirectUri, scope, state); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + 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(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!AuthorizeRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AuthorizeRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AuthorizeRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/CodeChallengeMethod.java b/src/main/java/com/tribufu/generated/models/CodeChallengeMethod.java new file mode 100644 index 0000000..04fcbd9 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/CodeChallengeMethod.java @@ -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 { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/CryptoViewModel.java b/src/main/java/com/tribufu/generated/models/CryptoViewModel.java new file mode 100644 index 0000000..f0e43c1 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/CryptoViewModel.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(encoded, decoded); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("encoded"); + openapiFields.add("decoded"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!CryptoViewModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CryptoViewModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CryptoViewModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/Game.java b/src/main/java/com/tribufu/generated/models/Game.java new file mode 100644 index 0000000..0fb985b --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/Game.java @@ -0,0 +1,1077 @@ +/* + * 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; + +/** + * Game + */ +@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 Game { + public static final String SERIALIZED_NAME_GAME_PORT = "game_port"; + @SerializedName(SERIALIZED_NAME_GAME_PORT) + @javax.annotation.Nullable + private Integer gamePort; + + public static final String SERIALIZED_NAME_QUERY_PORT = "query_port"; + @SerializedName(SERIALIZED_NAME_QUERY_PORT) + @javax.annotation.Nullable + private Integer queryPort; + + public static final String SERIALIZED_NAME_RCON_PORT = "rcon_port"; + @SerializedName(SERIALIZED_NAME_RCON_PORT) + @javax.annotation.Nullable + private Integer rconPort; + + 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_STEAM_APP_ID = "steam_app_id"; + @SerializedName(SERIALIZED_NAME_STEAM_APP_ID) + @javax.annotation.Nullable + private Integer steamAppId; + + public static final String SERIALIZED_NAME_STEAM_SERVER_APP_ID = "steam_server_app_id"; + @SerializedName(SERIALIZED_NAME_STEAM_SERVER_APP_ID) + @javax.annotation.Nullable + private Integer steamServerAppId; + + public static final String SERIALIZED_NAME_ENABLE_SERVERS = "enable_servers"; + @SerializedName(SERIALIZED_NAME_ENABLE_SERVERS) + @javax.annotation.Nullable + private Boolean enableServers; + + public static final String SERIALIZED_NAME_RUST_GAMEDIG_ID = "rust_gamedig_id"; + @SerializedName(SERIALIZED_NAME_RUST_GAMEDIG_ID) + @javax.annotation.Nullable + private String rustGamedigId; + + public static final String SERIALIZED_NAME_NODE_GAMEDIG_ID = "node_gamedig_id"; + @SerializedName(SERIALIZED_NAME_NODE_GAMEDIG_ID) + @javax.annotation.Nullable + private String nodeGamedigId; + + public static final String SERIALIZED_NAME_SERVER_CONNECT_URL = "server_connect_url"; + @SerializedName(SERIALIZED_NAME_SERVER_CONNECT_URL) + @javax.annotation.Nullable + private String serverConnectUrl; + + public static final String SERIALIZED_NAME_SERVER_TAGS = "server_tags"; + @SerializedName(SERIALIZED_NAME_SERVER_TAGS) + @javax.annotation.Nullable + private String serverTags; + + 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 Game() { + } + + public Game gamePort(@javax.annotation.Nullable Integer gamePort) { + this.gamePort = gamePort; + return this; + } + + /** + * Get gamePort + * @return gamePort + */ + @javax.annotation.Nullable + public Integer getGamePort() { + return gamePort; + } + + public void setGamePort(@javax.annotation.Nullable Integer gamePort) { + this.gamePort = gamePort; + } + + + public Game queryPort(@javax.annotation.Nullable Integer queryPort) { + this.queryPort = queryPort; + return this; + } + + /** + * Get queryPort + * @return queryPort + */ + @javax.annotation.Nullable + public Integer getQueryPort() { + return queryPort; + } + + public void setQueryPort(@javax.annotation.Nullable Integer queryPort) { + this.queryPort = queryPort; + } + + + public Game rconPort(@javax.annotation.Nullable Integer rconPort) { + this.rconPort = rconPort; + return this; + } + + /** + * Get rconPort + * @return rconPort + */ + @javax.annotation.Nullable + public Integer getRconPort() { + return rconPort; + } + + public void setRconPort(@javax.annotation.Nullable Integer rconPort) { + this.rconPort = rconPort; + } + + + public Game 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 Game steamAppId(@javax.annotation.Nullable Integer steamAppId) { + this.steamAppId = steamAppId; + return this; + } + + /** + * Get steamAppId + * @return steamAppId + */ + @javax.annotation.Nullable + public Integer getSteamAppId() { + return steamAppId; + } + + public void setSteamAppId(@javax.annotation.Nullable Integer steamAppId) { + this.steamAppId = steamAppId; + } + + + public Game steamServerAppId(@javax.annotation.Nullable Integer steamServerAppId) { + this.steamServerAppId = steamServerAppId; + return this; + } + + /** + * Get steamServerAppId + * @return steamServerAppId + */ + @javax.annotation.Nullable + public Integer getSteamServerAppId() { + return steamServerAppId; + } + + public void setSteamServerAppId(@javax.annotation.Nullable Integer steamServerAppId) { + this.steamServerAppId = steamServerAppId; + } + + + public Game enableServers(@javax.annotation.Nullable Boolean enableServers) { + this.enableServers = enableServers; + return this; + } + + /** + * Get enableServers + * @return enableServers + */ + @javax.annotation.Nullable + public Boolean getEnableServers() { + return enableServers; + } + + public void setEnableServers(@javax.annotation.Nullable Boolean enableServers) { + this.enableServers = enableServers; + } + + + public Game rustGamedigId(@javax.annotation.Nullable String rustGamedigId) { + this.rustGamedigId = rustGamedigId; + return this; + } + + /** + * Get rustGamedigId + * @return rustGamedigId + */ + @javax.annotation.Nullable + public String getRustGamedigId() { + return rustGamedigId; + } + + public void setRustGamedigId(@javax.annotation.Nullable String rustGamedigId) { + this.rustGamedigId = rustGamedigId; + } + + + public Game nodeGamedigId(@javax.annotation.Nullable String nodeGamedigId) { + this.nodeGamedigId = nodeGamedigId; + return this; + } + + /** + * Get nodeGamedigId + * @return nodeGamedigId + */ + @javax.annotation.Nullable + public String getNodeGamedigId() { + return nodeGamedigId; + } + + public void setNodeGamedigId(@javax.annotation.Nullable String nodeGamedigId) { + this.nodeGamedigId = nodeGamedigId; + } + + + public Game serverConnectUrl(@javax.annotation.Nullable String serverConnectUrl) { + this.serverConnectUrl = serverConnectUrl; + return this; + } + + /** + * Get serverConnectUrl + * @return serverConnectUrl + */ + @javax.annotation.Nullable + public String getServerConnectUrl() { + return serverConnectUrl; + } + + public void setServerConnectUrl(@javax.annotation.Nullable String serverConnectUrl) { + this.serverConnectUrl = serverConnectUrl; + } + + + public Game serverTags(@javax.annotation.Nullable String serverTags) { + this.serverTags = serverTags; + return this; + } + + /** + * Get serverTags + * @return serverTags + */ + @javax.annotation.Nullable + public String getServerTags() { + return serverTags; + } + + public void setServerTags(@javax.annotation.Nullable String serverTags) { + this.serverTags = serverTags; + } + + + public Game 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 Game 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 Game 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 Game 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 Game 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 Game 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 Game 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 Game 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 Game 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 Game 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 Game 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 Game 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 Game 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 Game 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 Game 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 Game 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 Game 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 Game 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 Game 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 Game 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; + } + Game game = (Game) o; + return Objects.equals(this.gamePort, game.gamePort) && + Objects.equals(this.queryPort, game.queryPort) && + Objects.equals(this.rconPort, game.rconPort) && + Objects.equals(this.serverCount, game.serverCount) && + Objects.equals(this.steamAppId, game.steamAppId) && + Objects.equals(this.steamServerAppId, game.steamServerAppId) && + Objects.equals(this.enableServers, game.enableServers) && + Objects.equals(this.rustGamedigId, game.rustGamedigId) && + Objects.equals(this.nodeGamedigId, game.nodeGamedigId) && + Objects.equals(this.serverConnectUrl, game.serverConnectUrl) && + Objects.equals(this.serverTags, game.serverTags) && + Objects.equals(this.id, game.id) && + Objects.equals(this.name, game.name) && + Objects.equals(this.description, game.description) && + Objects.equals(this.type, game.type) && + Objects.equals(this.organizationId, game.organizationId) && + Objects.equals(this.iconUrl, game.iconUrl) && + Objects.equals(this.bannerUrl, game.bannerUrl) && + Objects.equals(this.capsuleImageUrl, game.capsuleImageUrl) && + Objects.equals(this.libraryImageUrl, game.libraryImageUrl) && + Objects.equals(this.parentId, game.parentId) && + Objects.equals(this.slug, game.slug) && + Objects.equals(this.visibility, game.visibility) && + Objects.equals(this.password, game.password) && + Objects.equals(this.primary, game.primary) && + Objects.equals(this.userCount, game.userCount) && + Objects.equals(this.achievementCount, game.achievementCount) && + Objects.equals(this.badgeCount, game.badgeCount) && + Objects.equals(this.downloadCount, game.downloadCount) && + Objects.equals(this.created, game.created) && + Objects.equals(this.updated, game.updated); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(gamePort, queryPort, rconPort, serverCount, steamAppId, steamServerAppId, enableServers, rustGamedigId, nodeGamedigId, serverConnectUrl, serverTags, id, name, description, type, organizationId, iconUrl, bannerUrl, capsuleImageUrl, libraryImageUrl, parentId, slug, visibility, password, primary, userCount, achievementCount, badgeCount, downloadCount, created, updated); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Game {\n"); + sb.append(" gamePort: ").append(toIndentedString(gamePort)).append("\n"); + sb.append(" queryPort: ").append(toIndentedString(queryPort)).append("\n"); + sb.append(" rconPort: ").append(toIndentedString(rconPort)).append("\n"); + sb.append(" serverCount: ").append(toIndentedString(serverCount)).append("\n"); + sb.append(" steamAppId: ").append(toIndentedString(steamAppId)).append("\n"); + sb.append(" steamServerAppId: ").append(toIndentedString(steamServerAppId)).append("\n"); + sb.append(" enableServers: ").append(toIndentedString(enableServers)).append("\n"); + sb.append(" rustGamedigId: ").append(toIndentedString(rustGamedigId)).append("\n"); + sb.append(" nodeGamedigId: ").append(toIndentedString(nodeGamedigId)).append("\n"); + sb.append(" serverConnectUrl: ").append(toIndentedString(serverConnectUrl)).append("\n"); + sb.append(" serverTags: ").append(toIndentedString(serverTags)).append("\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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("game_port"); + openapiFields.add("query_port"); + openapiFields.add("rcon_port"); + openapiFields.add("server_count"); + openapiFields.add("steam_app_id"); + openapiFields.add("steam_server_app_id"); + openapiFields.add("enable_servers"); + openapiFields.add("rust_gamedig_id"); + openapiFields.add("node_gamedig_id"); + openapiFields.add("server_connect_url"); + openapiFields.add("server_tags"); + 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(); + } + + /** + * 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 Game + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Game.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Game is not found in the empty JSON string", Game.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Game.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Game` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("rust_gamedig_id") != null && !jsonObj.get("rust_gamedig_id").isJsonNull()) && !jsonObj.get("rust_gamedig_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `rust_gamedig_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("rust_gamedig_id").toString())); + } + if ((jsonObj.get("node_gamedig_id") != null && !jsonObj.get("node_gamedig_id").isJsonNull()) && !jsonObj.get("node_gamedig_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `node_gamedig_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("node_gamedig_id").toString())); + } + if ((jsonObj.get("server_connect_url") != null && !jsonObj.get("server_connect_url").isJsonNull()) && !jsonObj.get("server_connect_url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `server_connect_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("server_connect_url").toString())); + } + if ((jsonObj.get("server_tags") != null && !jsonObj.get("server_tags").isJsonNull()) && !jsonObj.get("server_tags").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `server_tags` to be a primitive type in the JSON string but got `%s`", jsonObj.get("server_tags").toString())); + } + 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!Game.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Game' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Game.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Game value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Game read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Game given an JSON string + * + * @param jsonString JSON string + * @return An instance of Game + * @throws IOException if the JSON string is invalid with respect to Game + */ + public static Game fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Game.class); + } + + /** + * Convert an instance of Game to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/GameServer.java b/src/main/java/com/tribufu/generated/models/GameServer.java new file mode 100644 index 0000000..58b59ec --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/GameServer.java @@ -0,0 +1,1085 @@ +/* + * 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.ServerStatus; +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; + +/** + * GameServer + */ +@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 GameServer { + 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_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private String address; + + public static final String SERIALIZED_NAME_GAME_PORT = "game_port"; + @SerializedName(SERIALIZED_NAME_GAME_PORT) + @javax.annotation.Nullable + private Integer gamePort; + + public static final String SERIALIZED_NAME_QUERY_PORT = "query_port"; + @SerializedName(SERIALIZED_NAME_QUERY_PORT) + @javax.annotation.Nullable + private Integer queryPort; + + 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_GAME_ICON_URL = "game_icon_url"; + @SerializedName(SERIALIZED_NAME_GAME_ICON_URL) + @javax.annotation.Nullable + private String gameIconUrl; + + public static final String SERIALIZED_NAME_VERSION = "version"; + @SerializedName(SERIALIZED_NAME_VERSION) + @javax.annotation.Nullable + private String version; + + public static final String SERIALIZED_NAME_FEATURED = "featured"; + @SerializedName(SERIALIZED_NAME_FEATURED) + @javax.annotation.Nullable + private Boolean featured; + + public static final String SERIALIZED_NAME_CLUSTER_ID = "cluster_id"; + @SerializedName(SERIALIZED_NAME_CLUSTER_ID) + @javax.annotation.Nullable + private String clusterId; + + 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 String 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_UPTIME = "uptime"; + @SerializedName(SERIALIZED_NAME_UPTIME) + @javax.annotation.Nullable + private Double uptime; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private ServerStatus status; + + public static final String SERIALIZED_NAME_PING = "ping"; + @SerializedName(SERIALIZED_NAME_PING) + @javax.annotation.Nullable + private Integer ping; + + public static final String SERIALIZED_NAME_MAP = "map"; + @SerializedName(SERIALIZED_NAME_MAP) + @javax.annotation.Nullable + private String map; + + public static final String SERIALIZED_NAME_USED_SLOTS = "used_slots"; + @SerializedName(SERIALIZED_NAME_USED_SLOTS) + @javax.annotation.Nullable + private Integer usedSlots; + + public static final String SERIALIZED_NAME_MAX_SLOTS = "max_slots"; + @SerializedName(SERIALIZED_NAME_MAX_SLOTS) + @javax.annotation.Nullable + private Integer maxSlots; + + public static final String SERIALIZED_NAME_MOTD = "motd"; + @SerializedName(SERIALIZED_NAME_MOTD) + @javax.annotation.Nullable + private String motd; + + public static final String SERIALIZED_NAME_PLAYERS = "players"; + @SerializedName(SERIALIZED_NAME_PLAYERS) + @javax.annotation.Nullable + private String players; + + 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_COUNTRY = "country"; + @SerializedName(SERIALIZED_NAME_COUNTRY) + @javax.annotation.Nullable + private String country; + + public static final String SERIALIZED_NAME_STEAM = "steam"; + @SerializedName(SERIALIZED_NAME_STEAM) + @javax.annotation.Nullable + private Boolean steam; + + 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_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 GameServer() { + } + + public GameServer 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 GameServer 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 GameServer 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 GameServer 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 GameServer gamePort(@javax.annotation.Nullable Integer gamePort) { + this.gamePort = gamePort; + return this; + } + + /** + * Get gamePort + * @return gamePort + */ + @javax.annotation.Nullable + public Integer getGamePort() { + return gamePort; + } + + public void setGamePort(@javax.annotation.Nullable Integer gamePort) { + this.gamePort = gamePort; + } + + + public GameServer queryPort(@javax.annotation.Nullable Integer queryPort) { + this.queryPort = queryPort; + return this; + } + + /** + * Get queryPort + * @return queryPort + */ + @javax.annotation.Nullable + public Integer getQueryPort() { + return queryPort; + } + + public void setQueryPort(@javax.annotation.Nullable Integer queryPort) { + this.queryPort = queryPort; + } + + + public GameServer 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 GameServer gameIconUrl(@javax.annotation.Nullable String gameIconUrl) { + this.gameIconUrl = gameIconUrl; + return this; + } + + /** + * Get gameIconUrl + * @return gameIconUrl + */ + @javax.annotation.Nullable + public String getGameIconUrl() { + return gameIconUrl; + } + + public void setGameIconUrl(@javax.annotation.Nullable String gameIconUrl) { + this.gameIconUrl = gameIconUrl; + } + + + public GameServer 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 GameServer featured(@javax.annotation.Nullable Boolean featured) { + this.featured = featured; + return this; + } + + /** + * Get featured + * @return featured + */ + @javax.annotation.Nullable + public Boolean getFeatured() { + return featured; + } + + public void setFeatured(@javax.annotation.Nullable Boolean featured) { + this.featured = featured; + } + + + public GameServer clusterId(@javax.annotation.Nullable String clusterId) { + this.clusterId = clusterId; + return this; + } + + /** + * Get clusterId + * @return clusterId + */ + @javax.annotation.Nullable + public String getClusterId() { + return clusterId; + } + + public void setClusterId(@javax.annotation.Nullable String clusterId) { + this.clusterId = clusterId; + } + + + public GameServer 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 GameServer 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 GameServer 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 GameServer uptime(@javax.annotation.Nullable Double uptime) { + this.uptime = uptime; + return this; + } + + /** + * Get uptime + * @return uptime + */ + @javax.annotation.Nullable + public Double getUptime() { + return uptime; + } + + public void setUptime(@javax.annotation.Nullable Double uptime) { + this.uptime = uptime; + } + + + public GameServer status(@javax.annotation.Nullable ServerStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public ServerStatus getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable ServerStatus status) { + this.status = status; + } + + + public GameServer ping(@javax.annotation.Nullable Integer ping) { + this.ping = ping; + return this; + } + + /** + * Get ping + * @return ping + */ + @javax.annotation.Nullable + public Integer getPing() { + return ping; + } + + public void setPing(@javax.annotation.Nullable Integer ping) { + this.ping = ping; + } + + + public GameServer map(@javax.annotation.Nullable String map) { + this.map = map; + return this; + } + + /** + * Get map + * @return map + */ + @javax.annotation.Nullable + public String getMap() { + return map; + } + + public void setMap(@javax.annotation.Nullable String map) { + this.map = map; + } + + + public GameServer usedSlots(@javax.annotation.Nullable Integer usedSlots) { + this.usedSlots = usedSlots; + return this; + } + + /** + * Get usedSlots + * @return usedSlots + */ + @javax.annotation.Nullable + public Integer getUsedSlots() { + return usedSlots; + } + + public void setUsedSlots(@javax.annotation.Nullable Integer usedSlots) { + this.usedSlots = usedSlots; + } + + + public GameServer maxSlots(@javax.annotation.Nullable Integer maxSlots) { + this.maxSlots = maxSlots; + return this; + } + + /** + * Get maxSlots + * @return maxSlots + */ + @javax.annotation.Nullable + public Integer getMaxSlots() { + return maxSlots; + } + + public void setMaxSlots(@javax.annotation.Nullable Integer maxSlots) { + this.maxSlots = maxSlots; + } + + + public GameServer motd(@javax.annotation.Nullable String motd) { + this.motd = motd; + return this; + } + + /** + * Get motd + * @return motd + */ + @javax.annotation.Nullable + public String getMotd() { + return motd; + } + + public void setMotd(@javax.annotation.Nullable String motd) { + this.motd = motd; + } + + + public GameServer players(@javax.annotation.Nullable String players) { + this.players = players; + return this; + } + + /** + * Get players + * @return players + */ + @javax.annotation.Nullable + public String getPlayers() { + return players; + } + + public void setPlayers(@javax.annotation.Nullable String players) { + this.players = players; + } + + + public GameServer 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 GameServer 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 GameServer steam(@javax.annotation.Nullable Boolean steam) { + this.steam = steam; + return this; + } + + /** + * Get steam + * @return steam + */ + @javax.annotation.Nullable + public Boolean getSteam() { + return steam; + } + + public void setSteam(@javax.annotation.Nullable Boolean steam) { + this.steam = steam; + } + + + public GameServer 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 GameServer 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 GameServer 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 GameServer 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 GameServer 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 GameServer 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; + } + GameServer gameServer = (GameServer) o; + return Objects.equals(this.id, gameServer.id) && + Objects.equals(this.name, gameServer.name) && + Objects.equals(this.description, gameServer.description) && + Objects.equals(this.address, gameServer.address) && + Objects.equals(this.gamePort, gameServer.gamePort) && + Objects.equals(this.queryPort, gameServer.queryPort) && + Objects.equals(this.gameId, gameServer.gameId) && + Objects.equals(this.gameIconUrl, gameServer.gameIconUrl) && + Objects.equals(this.version, gameServer.version) && + Objects.equals(this.featured, gameServer.featured) && + Objects.equals(this.clusterId, gameServer.clusterId) && + Objects.equals(this.websiteUrl, gameServer.websiteUrl) && + Objects.equals(this.bannerUrl, gameServer.bannerUrl) && + Objects.equals(this.ownerId, gameServer.ownerId) && + Objects.equals(this.uptime, gameServer.uptime) && + Objects.equals(this.status, gameServer.status) && + Objects.equals(this.ping, gameServer.ping) && + Objects.equals(this.map, gameServer.map) && + Objects.equals(this.usedSlots, gameServer.usedSlots) && + Objects.equals(this.maxSlots, gameServer.maxSlots) && + Objects.equals(this.motd, gameServer.motd) && + Objects.equals(this.players, gameServer.players) && + Objects.equals(this.lastOnline, gameServer.lastOnline) && + Objects.equals(this.country, gameServer.country) && + Objects.equals(this.steam, gameServer.steam) && + Objects.equals(this.discordServerId, gameServer.discordServerId) && + Objects.equals(this.youtubeVideoUrl, gameServer.youtubeVideoUrl) && + Objects.equals(this.tags, gameServer.tags) && + Objects.equals(this.commentCount, gameServer.commentCount) && + Objects.equals(this.created, gameServer.created) && + Objects.equals(this.updated, gameServer.updated); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, description, address, gamePort, queryPort, gameId, gameIconUrl, version, featured, clusterId, websiteUrl, bannerUrl, ownerId, uptime, status, ping, map, usedSlots, maxSlots, motd, players, lastOnline, country, steam, discordServerId, youtubeVideoUrl, tags, commentCount, created, updated); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GameServer {\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(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" gamePort: ").append(toIndentedString(gamePort)).append("\n"); + sb.append(" queryPort: ").append(toIndentedString(queryPort)).append("\n"); + sb.append(" gameId: ").append(toIndentedString(gameId)).append("\n"); + sb.append(" gameIconUrl: ").append(toIndentedString(gameIconUrl)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" featured: ").append(toIndentedString(featured)).append("\n"); + sb.append(" clusterId: ").append(toIndentedString(clusterId)).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(" uptime: ").append(toIndentedString(uptime)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" ping: ").append(toIndentedString(ping)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).append("\n"); + sb.append(" usedSlots: ").append(toIndentedString(usedSlots)).append("\n"); + sb.append(" maxSlots: ").append(toIndentedString(maxSlots)).append("\n"); + sb.append(" motd: ").append(toIndentedString(motd)).append("\n"); + sb.append(" players: ").append(toIndentedString(players)).append("\n"); + sb.append(" lastOnline: ").append(toIndentedString(lastOnline)).append("\n"); + sb.append(" country: ").append(toIndentedString(country)).append("\n"); + sb.append(" steam: ").append(toIndentedString(steam)).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(" 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("address"); + openapiFields.add("game_port"); + openapiFields.add("query_port"); + openapiFields.add("game_id"); + openapiFields.add("game_icon_url"); + openapiFields.add("version"); + openapiFields.add("featured"); + openapiFields.add("cluster_id"); + openapiFields.add("website_url"); + openapiFields.add("banner_url"); + openapiFields.add("owner_id"); + openapiFields.add("uptime"); + openapiFields.add("status"); + openapiFields.add("ping"); + openapiFields.add("map"); + openapiFields.add("used_slots"); + openapiFields.add("max_slots"); + openapiFields.add("motd"); + openapiFields.add("players"); + openapiFields.add("last_online"); + openapiFields.add("country"); + openapiFields.add("steam"); + openapiFields.add("discord_server_id"); + openapiFields.add("youtube_video_url"); + openapiFields.add("tags"); + openapiFields.add("comment_count"); + openapiFields.add("created"); + openapiFields.add("updated"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * 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 GameServer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GameServer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GameServer is not found in the empty JSON string", GameServer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GameServer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GameServer` 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("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("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("game_icon_url") != null && !jsonObj.get("game_icon_url").isJsonNull()) && !jsonObj.get("game_icon_url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `game_icon_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("game_icon_url").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("cluster_id") != null && !jsonObj.get("cluster_id").isJsonNull()) && !jsonObj.get("cluster_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cluster_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cluster_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())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + ServerStatus.validateJsonElement(jsonObj.get("status")); + } + if ((jsonObj.get("map") != null && !jsonObj.get("map").isJsonNull()) && !jsonObj.get("map").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `map` to be a primitive type in the JSON string but got `%s`", jsonObj.get("map").toString())); + } + if ((jsonObj.get("motd") != null && !jsonObj.get("motd").isJsonNull()) && !jsonObj.get("motd").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `motd` to be a primitive type in the JSON string but got `%s`", jsonObj.get("motd").toString())); + } + if ((jsonObj.get("players") != null && !jsonObj.get("players").isJsonNull()) && !jsonObj.get("players").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `players` to be a primitive type in the JSON string but got `%s`", jsonObj.get("players").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("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 TypeAdapter create(Gson gson, TypeToken type) { + if (!GameServer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GameServer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GameServer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GameServer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GameServer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GameServer given an JSON string + * + * @param jsonString JSON string + * @return An instance of GameServer + * @throws IOException if the JSON string is invalid with respect to GameServer + */ + public static GameServer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GameServer.class); + } + + /** + * Convert an instance of GameServer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/GameServerCluster.java b/src/main/java/com/tribufu/generated/models/GameServerCluster.java new file mode 100644 index 0000000..c42e1ba --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/GameServerCluster.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, description, gameId, websiteUrl, bannerUrl, ownerId, discordServerId, youtubeVideoUrl, tags, commentCount, serverCount, created, updated); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + 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(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!GameServerCluster.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GameServerCluster' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GameServerCluster.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/GrantType.java b/src/main/java/com/tribufu/generated/models/GrantType.java new file mode 100644 index 0000000..d566a4a --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/GrantType.java @@ -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 { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/Group.java b/src/main/java/com/tribufu/generated/models/Group.java new file mode 100644 index 0000000..4fa9d51 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/Group.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, uuid, name, tag, description, type, privacy, ownerId, verified, photoUrl, bannerUrl, memberCount, followerCount, viewCount, created, updated); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + 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(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!Group.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Group' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Group.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/GroupGame.java b/src/main/java/com/tribufu/generated/models/GroupGame.java new file mode 100644 index 0000000..aba4fe4 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/GroupGame.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(groupId, group, applicationId, application, stats, acquired, lastUsed); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + 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(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!GroupGame.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GroupGame' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GroupGame.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/GroupMember.java b/src/main/java/com/tribufu/generated/models/GroupMember.java new file mode 100644 index 0000000..adc376c --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/GroupMember.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, uuid, name, displayName, verified, photoUrl, lastOnline, rank, since); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + 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(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!GroupMember.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GroupMember' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GroupMember.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/GroupRank.java b/src/main/java/com/tribufu/generated/models/GroupRank.java new file mode 100644 index 0000000..2b26ee5 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/GroupRank.java @@ -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 { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/HashViewModel.java b/src/main/java/com/tribufu/generated/models/HashViewModel.java new file mode 100644 index 0000000..ca82197 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/HashViewModel.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!HashViewModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HashViewModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(HashViewModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/IntrospectRequest.java b/src/main/java/com/tribufu/generated/models/IntrospectRequest.java new file mode 100644 index 0000000..5b998d9 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/IntrospectRequest.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(token, tokenTypeHint); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("token"); + openapiFields.add("token_type_hint"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!IntrospectRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IntrospectRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IntrospectRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/IpAddress.java b/src/main/java/com/tribufu/generated/models/IpAddress.java new file mode 100644 index 0000000..5f4a874 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/IpAddress.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(address, version, network, reserved, asn, isp, continent, country, region, city, postalCode, callingCode, tld, language, timezone, currency, latitude, longitude); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + 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(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!IpAddress.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IpAddress' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IpAddress.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/LeaderboardItem.java b/src/main/java/com/tribufu/generated/models/LeaderboardItem.java new file mode 100644 index 0000000..538a9c5 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/LeaderboardItem.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, displayName, photoUrl, level, experience, points); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + 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(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!LeaderboardItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LeaderboardItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LeaderboardItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/LeaderboardOrder.java b/src/main/java/com/tribufu/generated/models/LeaderboardOrder.java new file mode 100644 index 0000000..77ed0ef --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/LeaderboardOrder.java @@ -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 { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/LoginProvider.java b/src/main/java/com/tribufu/generated/models/LoginProvider.java new file mode 100644 index 0000000..ff7dd09 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/LoginProvider.java @@ -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 { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/LoginRequest.java b/src/main/java/com/tribufu/generated/models/LoginRequest.java new file mode 100644 index 0000000..e7b457c --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/LoginRequest.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(login, password); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("login"); + openapiFields.add("password"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!LoginRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LoginRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LoginRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/LoginResponse.java b/src/main/java/com/tribufu/generated/models/LoginResponse.java new file mode 100644 index 0000000..f45bbb9 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/LoginResponse.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(user, accessToken, refreshToken, expiresIn); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + 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(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!LoginResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LoginResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LoginResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/ModelPackage.java b/src/main/java/com/tribufu/generated/models/ModelPackage.java new file mode 100644 index 0000000..085cbc7 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/ModelPackage.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, description, imageUrl, authorId, version, fileUrl, rawSize, downloadCount, lastDownload, created, updated); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + 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(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelPackage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelPackage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelPackage.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/Profile.java b/src/main/java/com/tribufu/generated/models/Profile.java new file mode 100644 index 0000000..9b20740 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/Profile.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, uuid, name, displayName, verified, level, experience, publicBirthday, birthday, points, location, photoUrl, bannerUrl, lastOnline, biography, viewCount, created, updated); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + 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(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!Profile.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Profile' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Profile.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/ProfileGame.java b/src/main/java/com/tribufu/generated/models/ProfileGame.java new file mode 100644 index 0000000..03431d4 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/ProfileGame.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, capsuleImageUrl, libraryImageUrl, slug, timeUsed, unlockedAchievements, totalAchievements, stats, acquired, lastUsed); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + 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(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!ProfileGame.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProfileGame' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProfileGame.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/ProfileGroup.java b/src/main/java/com/tribufu/generated/models/ProfileGroup.java new file mode 100644 index 0000000..8a74840 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/ProfileGroup.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, uuid, name, tag, privacy, verified, photoUrl, memberCount, rank, since); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + 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(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!ProfileGroup.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProfileGroup' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProfileGroup.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/RefreshRequest.java b/src/main/java/com/tribufu/generated/models/RefreshRequest.java new file mode 100644 index 0000000..3435d52 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/RefreshRequest.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(refreshToken); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("refresh_token"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!RefreshRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefreshRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefreshRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/RegisterRequest.java b/src/main/java/com/tribufu/generated/models/RegisterRequest.java new file mode 100644 index 0000000..2fc6791 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/RegisterRequest.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, name, email, password); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("uuid"); + openapiFields.add("name"); + openapiFields.add("email"); + openapiFields.add("password"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!RegisterRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RegisterRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RegisterRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/ResponseType.java b/src/main/java/com/tribufu/generated/models/ResponseType.java new file mode 100644 index 0000000..0950fa2 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/ResponseType.java @@ -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 { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/RevokeRequest.java b/src/main/java/com/tribufu/generated/models/RevokeRequest.java new file mode 100644 index 0000000..4f63d4e --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/RevokeRequest.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(token, tokenTypeHint); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("token"); + openapiFields.add("token_type_hint"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!RevokeRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RevokeRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RevokeRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/SearchRequest.java b/src/main/java/com/tribufu/generated/models/SearchRequest.java new file mode 100644 index 0000000..7522ced --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/SearchRequest.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(type, query, page, gameId); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + 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(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!SearchRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SearchRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SearchRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/SearchType.java b/src/main/java/com/tribufu/generated/models/SearchType.java new file mode 100644 index 0000000..9bb547c --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/SearchType.java @@ -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 { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/ServerMetrics.java b/src/main/java/com/tribufu/generated/models/ServerMetrics.java new file mode 100644 index 0000000..eba917e --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/ServerMetrics.java @@ -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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("server_count"); + openapiFields.add("package_count"); + openapiFields.add("country_count"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!ServerMetrics.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ServerMetrics' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ServerMetrics.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/ServerStatus.java b/src/main/java/com/tribufu/generated/models/ServerStatus.java new file mode 100644 index 0000000..abd31c1 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/ServerStatus.java @@ -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 { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/Subscription.java b/src/main/java/com/tribufu/generated/models/Subscription.java new file mode 100644 index 0000000..b3ba301 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/Subscription.java @@ -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 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 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 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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, description, imageUrl, prices, created, updated); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + 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(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!Subscription.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Subscription' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Subscription.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/TokenHintType.java b/src/main/java/com/tribufu/generated/models/TokenHintType.java new file mode 100644 index 0000000..229e834 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/TokenHintType.java @@ -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 { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/TokenRequest.java b/src/main/java/com/tribufu/generated/models/TokenRequest.java new file mode 100644 index 0000000..57d9a26 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/TokenRequest.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(grantType, code, username, password, refreshToken, clientId, redirectUri, codeVerifier); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + 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(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!TokenRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TokenRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TokenRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/TokenResponse.java b/src/main/java/com/tribufu/generated/models/TokenResponse.java new file mode 100644 index 0000000..c0ad675 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/TokenResponse.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(tokenType, accessToken, refreshToken, scope, state, expiresIn); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + 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(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!TokenResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TokenResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TokenResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/TokenType.java b/src/main/java/com/tribufu/generated/models/TokenType.java new file mode 100644 index 0000000..ddc6bb5 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/TokenType.java @@ -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 { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/UpdateProfile.java b/src/main/java/com/tribufu/generated/models/UpdateProfile.java new file mode 100644 index 0000000..849e4c8 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/UpdateProfile.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(displayName, biography); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("display_name"); + openapiFields.add("biography"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateProfile.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateProfile' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateProfile.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/UserInfo.java b/src/main/java/com/tribufu/generated/models/UserInfo.java new file mode 100644 index 0000000..9c1dbf9 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/UserInfo.java @@ -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 boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(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 int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class 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 openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + 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(); + } + + /** + * 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> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserInfo.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserInfo` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + 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 TypeAdapter create(Gson gson, TypeToken type) { + if (!UserInfo.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserInfo' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserInfo.class)); + + return (TypeAdapter) new TypeAdapter() { + @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); + } +} + diff --git a/src/main/java/com/tribufu/generated/models/UserType.java b/src/main/java/com/tribufu/generated/models/UserType.java new file mode 100644 index 0000000..bac6068 --- /dev/null +++ b/src/main/java/com/tribufu/generated/models/UserType.java @@ -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 { + @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); + } +} + diff --git a/vendor/openapi-generator/LICENSE b/vendor/openapi-generator/LICENSE new file mode 100644 index 0000000..310853b --- /dev/null +++ b/vendor/openapi-generator/LICENSE @@ -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. diff --git a/vendor/openapi-generator/openapi-generator-cli.jar b/vendor/openapi-generator/openapi-generator-cli.jar new file mode 100644 index 0000000..f373b7a Binary files /dev/null and b/vendor/openapi-generator/openapi-generator-cli.jar differ