tribufu-java/src/main/java/com/tribufu/generated/models/Game.java
Guilherme Werner f0bceab05b
Generate code with openapi-generator (#3)
* Remove examples

* Generate project with openapi-generator

* Add wrapper classes

* Update AndroidManifest.xml
2025-05-27 07:53:37 -03:00

1077 lines
34 KiB
Java

/*
* 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 <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}
@Override
public int hashCode() {
return Objects.hash(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 <T> int hashCodeNullable(JsonNullable<T> a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class 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<String> openapiFields;
public static HashSet<String> openapiRequiredFields;
static {
// a set of all properties/fields (JSON key names)
openapiFields = new HashSet<String>();
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<String>();
}
/**
* Validates the JSON Element and throws an exception if issues found
*
* @param jsonElement JSON Element
* @throws IOException if the JSON Element is invalid with respect to 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<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Map.Entry<String, JsonElement> entry : entries) {
if (!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 <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!Game.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'Game' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<Game> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(Game.class));
return (TypeAdapter<T>) new TypeAdapter<Game>() {
@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);
}
}