diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..f3a8538 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,94 @@ +pipeline { + agent { + docker { + image "maven:3.8.1-adoptopenjdk-11" + args '-v /root/.m2:/root/.m2' + } + } + + environment { + NEXUS_VERSION = "nexus3" + NEXUS_PROTOCOL = "https" + NEXUS_REPOSITORY = "maven-goudham" + NEXUS_URL = credentials('fe3e0c7e-bcb1-4d55-9591-f55f71f42356') + NEXUS_CREDENTIAL_ID = 'e5582b32-3507-4e88-ab7c-d16d701c46e9' + + CODECOV_TOKEN = credentials('44a3c021-5cbb-4a6f-bea2-ae6c51d43038') + } + + stages { + stage("Building") { + steps { + sh "mvn -B -DskipTests clean install" + } + } + stage("Testing") { + steps { + sh "mvn test" + } + } + stage("Deploying To Nexus") { + when { + branch 'release' + } + steps { + script { + pom = readMavenPom file: "pom.xml"; + filesByGlob = findFiles(glob: "target/*.${pom.packaging}"); + + echo "${filesByGlob[0].name} ${filesByGlob[0].path} ${filesByGlob[0].directory} ${filesByGlob[0].length} ${filesByGlob[0].lastModified}" + + artifactPath = filesByGlob[0].path; + artifactExists = fileExists artifactPath; + + if (artifactExists) { + echo "*** File: ${artifactPath}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; + + nexusArtifactUploader( + nexusVersion: NEXUS_VERSION, + protocol: NEXUS_PROTOCOL, + nexusUrl: NEXUS_URL, + groupId: pom.groupId, + version: pom.version, + repository: NEXUS_REPOSITORY, + credentialsId: NEXUS_CREDENTIAL_ID, + artifacts: [ + [artifactId: pom.artifactId, + classifier: '', + file: artifactPath, + type: pom.packaging], + + [artifactId: pom.artifactId, + classifier: '', + file: "pom.xml", + type: "pom"] + ] + ) + } else { + error "*** File: ${artifactPath}, could not be found"; + } + } + } + } + } + + post { + success { + echo "I'm Feeling Swag!" + + echo "Generating Test Report..." + publishCoverage adapters: [jacocoAdapter('target/site/jacoco/jacoco.xml')] + + echo "Sending Report to CodeCov..." + sh '''#!/bin/bash + bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN || echo "Codecov did not collect coverage reports" + ''' + } + failure { + echo 'Not Very Swag :(' + } + cleanup { + cleanWs() + } + } +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 9354ef3..9349c21 100644 --- a/pom.xml +++ b/pom.xml @@ -1,55 +1,55 @@ - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - org.goudham.me - MyWaifuWrapper - 0.1 - MyWaifuWrapper + org.goudham.me + MyWaifuWrapper + 0.1 + MyWaifuWrapper - - UTF-8 - 11 - 11 - + + UTF-8 + 11 + 11 + - - - org.junit.jupiter - junit-jupiter-api - 5.7.2 - test - - - org.mockito - mockito-core - 3.10.0 - test - - - org.jetbrains - annotations - RELEASE - compile - - - com.fasterxml.jackson.core - jackson-databind - 2.12.3 - - - com.fasterxml.jackson.core - jackson-core - 2.12.3 - - - com.fasterxml.jackson.core - jackson-annotations - 2.12.3 - - + + + org.junit.jupiter + junit-jupiter-api + 5.7.2 + test + + + org.mockito + mockito-core + 3.10.0 + test + + + org.jetbrains + annotations + 21.0.1 + compile + + + com.fasterxml.jackson.core + jackson-databind + 2.12.3 + + + com.fasterxml.jackson.core + jackson-core + 2.12.3 + + + com.fasterxml.jackson.core + jackson-annotations + 2.12.3 + + diff --git a/src/main/java/org/goudham/me/MyWaifuClient.java b/src/main/java/org/goudham/me/MyWaifuClient.java new file mode 100644 index 0000000..2dae6d8 --- /dev/null +++ b/src/main/java/org/goudham/me/MyWaifuClient.java @@ -0,0 +1,124 @@ +package org.goudham.me; + +import org.goudham.me.api.MyWaifuWrapper; +import org.jetbrains.annotations.NotNull; + +import javax.net.ssl.SSLParameters; +import java.net.Authenticator; +import java.net.CookieHandler; +import java.net.ProxySelector; +import java.net.http.HttpClient; +import java.time.Duration; +import java.util.concurrent.Executor; + +/** + * A MyWaifuClient + * + *

Main entry point for retrieving information from MyWaifuList.

+ *

{@link MyWaifuWrapper} is utilised to make the API requests

+ */ +public class MyWaifuClient { + private final MyWaifuWrapper myWaifuWrapper; + private HttpClient httpClient; + + /** + * Creates an instance of MyWaifuClient + * + *

See MyWaifuList for obtaining an API Key

+ * @param apiKey API Key to authorise API request + */ + MyWaifuClient(@NotNull String apiKey) { + myWaifuWrapper = new MyWaifuWrapper(apiKey); + } + + /** + * Creates an instance of {@link MyWaifuClient} with default {@link HttpClient} settings + * + * @param apiKey API Key to authorise API request + * @return {@link MyWaifuClient} + */ + public static MyWaifuClient createDefault(@NotNull String apiKey) { + MyWaifuClient myWaifuClient = new MyWaifuClient(apiKey); + myWaifuClient.setHttpClient(HttpClient.newBuilder() + .version(HttpClient.Version.HTTP_2) + .followRedirects(HttpClient.Redirect.NORMAL) + .connectTimeout(Duration.ofSeconds(20)) + .build()); + + return myWaifuClient; + } + + /** + * Sets an instance of HttpClient + * + * @param httpClient HttpClient for executing API requests + */ + public void setHttpClient(HttpClient httpClient) { + this.httpClient = httpClient; + } + + /** + * Builder for MyWaifuClient + */ + public static class Builder { + private final String apiKey; + private final MyWaifuWrapper myWaifuWrapper; + private HttpClient.Builder httpClientBuilder; + + public Builder(String apiKey) { + this.apiKey = apiKey; + myWaifuWrapper = new MyWaifuWrapper(apiKey); + } + + public Builder withCookieHandler(CookieHandler cookieHandler) { + httpClientBuilder.cookieHandler(cookieHandler); + return this; + } + + public Builder withConnectTimeout(Duration duration) { + httpClientBuilder.connectTimeout(duration); + return this; + } + + public Builder withSslParameters(SSLParameters sslParameters) { + httpClientBuilder.sslParameters(sslParameters); + return this; + } + + public Builder withExecutor(Executor executor) { + httpClientBuilder.executor(executor); + return this; + } + + public Builder withFollowRedirects(HttpClient.Redirect policy) { + httpClientBuilder.followRedirects(policy); + return this; + } + + public Builder withVersion(HttpClient.Version version) { + httpClientBuilder.version(version); + return this; + } + + public Builder withPriority(int priority) { + httpClientBuilder.priority(priority); + return this; + } + + public Builder withProxy(ProxySelector proxySelector) { + httpClientBuilder.proxy(proxySelector); + return this; + } + + public Builder withAuthenticator(Authenticator authenticator) { + httpClientBuilder.authenticator(authenticator); + return this; + } + + public MyWaifuClient build() { + MyWaifuClient myWaifuClient = new MyWaifuClient(apiKey); + myWaifuClient.setHttpClient(httpClientBuilder.build()); + return myWaifuClient; + } + } +} diff --git a/src/main/java/org/goudham/me/api/MyWaifuWrapper.java b/src/main/java/org/goudham/me/api/MyWaifuWrapper.java new file mode 100644 index 0000000..58b8494 --- /dev/null +++ b/src/main/java/org/goudham/me/api/MyWaifuWrapper.java @@ -0,0 +1,20 @@ +package org.goudham.me.api; + +import org.goudham.me.MyWaifuClient; + +/** + * Returns API information to {@link MyWaifuClient} + */ +public class MyWaifuWrapper { + private final String version = "1.0"; + private final String host = "https://mywaifulist.moe/api/v1/"; + private final String apiKey; + + /** + * Instantiates an instance of {@link MyWaifuWrapper} to retrieve API Information + * @param apiKey API Key to authorise API request + */ + public MyWaifuWrapper(String apiKey) { + this.apiKey = apiKey; + } +} diff --git a/src/main/java/org/goudham/me/api/entity/PaginationData.java b/src/main/java/org/goudham/me/api/entity/PaginationData.java new file mode 100644 index 0000000..6c08c9d --- /dev/null +++ b/src/main/java/org/goudham/me/api/entity/PaginationData.java @@ -0,0 +1,105 @@ +package org.goudham.me.api.entity; + +import javax.annotation.processing.Generated; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +/** + * {@link PaginationData} + *

Contains standard Pagination data from the API

+ * + *

Fields included are:

+ *
    + *
  • {@link Integer currentPage}
  • + *
  • {@link Integer lastPage}
  • + *
  • {@link Integer perPage}
  • + *
  • {@link Integer total}
  • + *
+ * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "current_page", + "last_page", + "per_page", + "total" +}) +@Generated("jsonschema2pojo") +public class PaginationData { + /** + * Current requested page + * + */ + @JsonProperty("current_page") + @JsonPropertyDescription("Current requested page") + private Integer currentPage; + + /** + * Last available page + * + */ + @JsonProperty("last_page") + @JsonPropertyDescription("Last available page") + private Integer lastPage; + + /** + * Total number of items per page + * + */ + @JsonProperty("per_page") + @JsonPropertyDescription("Total number of items per page") + private Integer perPage; + + /** + * Total number of items + * + */ + @JsonProperty("total") + @JsonPropertyDescription("Total number of items") + private Integer total; + + @JsonProperty("current_page") + public Integer getCurrentPage() { + return currentPage; + } + + @JsonProperty("current_page") + public void setCurrentPage(Integer currentPage) { + this.currentPage = currentPage; + } + + @JsonProperty("last_page") + public Integer getLastPage() { + return lastPage; + } + + @JsonProperty("last_page") + public void setLastPage(Integer lastPage) { + this.lastPage = lastPage; + } + + @JsonProperty("per_page") + public Integer getPerPage() { + return perPage; + } + + @JsonProperty("per_page") + public void setPerPage(Integer perPage) { + this.perPage = perPage; + } + + @JsonProperty("total") + public Integer getTotal() { + return total; + } + + @JsonProperty("total") + public void setTotal(Integer total) { + this.total = total; + } + +} diff --git a/src/main/java/org/goudham/me/api/entity/Studio.java b/src/main/java/org/goudham/me/api/entity/Studio.java new file mode 100644 index 0000000..dbe47fa --- /dev/null +++ b/src/main/java/org/goudham/me/api/entity/Studio.java @@ -0,0 +1,105 @@ +package org.goudham.me.api.entity; + +import javax.annotation.processing.Generated; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import java.util.Objects; + +/** + * {@link Studio} + *

Contains information on a given animation or game development studio

+ * + *

Fields included are:

+ *
    + *
  • {@link Integer id}
  • + *
  • {@link String name}
  • + *
  • {@link String originalName}
  • + *
+ * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "id", + "name", + "original_name" +}) +@Generated("jsonschema2pojo") +public class Studio { + /** + * {@link Studio} ID + */ + @JsonProperty("id") + @JsonPropertyDescription("Studio ID") + private Integer id; + + /** + * {@link Studio} Name + */ + @JsonProperty("name") + @JsonPropertyDescription("Studio Name") + private String name; + + /** + * {@link Studio}'s Original Name + */ + @JsonProperty("original_name") + @JsonPropertyDescription("Studio's Original Name") + private String originalName; + + @JsonProperty("id") + public Integer getId() { + return id; + } + + @JsonProperty("id") + public void setId(Integer id) { + this.id = id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("original_name") + public String getOriginalName() { + return originalName; + } + + @JsonProperty("original_name") + public void setOriginalName(String originalName) { + this.originalName = originalName; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Studio studio = (Studio) o; + return Objects.equals(id, studio.id) && Objects.equals(name, studio.name) && Objects.equals(originalName, studio.originalName); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, originalName); + } + + @Override + public String toString() { + return "Studio{" + + "id=" + id + + ", name='" + name + '\'' + + ", originalName='" + originalName + '\'' + + '}'; + } +} + diff --git a/src/main/java/org/goudham/me/api/entity/series/FilteredSeries.java b/src/main/java/org/goudham/me/api/entity/series/FilteredSeries.java new file mode 100644 index 0000000..3c30991 --- /dev/null +++ b/src/main/java/org/goudham/me/api/entity/series/FilteredSeries.java @@ -0,0 +1,192 @@ +package org.goudham.me.api.entity.series; + +import javax.annotation.processing.Generated; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import java.util.Objects; + + +/** + * {@link FilteredSeries} + *

Contains basic series information for most endpoints

+ * + *

Fields included are:

+ *
    + *
  • {@link String name}
  • + *
  • {@link String originalName}
  • + *
  • {@link String romajiName}
  • + *
  • {@link String slug}
  • + *
  • {@link String description}
  • + *
  • {@link String url}
  • + *
  • {@link Integer id}
  • + *
+ * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "name", + "original_name", + "romaji_name", + "slug", + "description", + "url", + "id" +}) +@Generated("jsonschema2pojo") +public class FilteredSeries { + /** + * Full name, in English. + * + */ + @JsonProperty("name") + @JsonPropertyDescription("Full name, in English.") + private String name; + + /** + * Name in the original language (日本語) + * + */ + @JsonProperty("original_name") + @JsonPropertyDescription("Name in the original language (\u65e5\u672c\u8a9e)") + private String originalName; + + /** + * If this {@link Series} has a romaji name, we'll put it here. + * + */ + @JsonProperty("romaji_name") + @JsonPropertyDescription("if this character has a romaji name, we'll put it here. ") + private String romajiName; + + /** + * Readable URL's for this {@link Series} + * + */ + @JsonProperty("slug") + @JsonPropertyDescription("Used to generate readable URL's for the Waifu") + private String slug; + + + /** + * Truncated, spoiler-free description of this {@link Series} + * + */ + @JsonProperty("description") + @JsonPropertyDescription("Truncated, spoiler-free description of this Waifu") + private String description; + + /** + * URL to view in browser + * + */ + @JsonProperty("url") + @JsonPropertyDescription("URL to view in browser") + private String url; + + /** + * Interal ID of this {@link Series} + */ + @JsonProperty("id") + @JsonPropertyDescription("Internal ID of the series") + private Integer id; + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("original_name") + public String getOriginalName() { + return originalName; + } + + @JsonProperty("original_name") + public void setOriginalName(String originalName) { + this.originalName = originalName; + } + + @JsonProperty("romaji_name") + public String getRomajiName() { + return romajiName; + } + + @JsonProperty("romaji_name") + public void setRomajiName(String romajiName) { + this.romajiName = romajiName; + } + + @JsonProperty("slug") + public String getSlug() { + return slug; + } + + @JsonProperty("slug") + public void setSlug(String slug) { + this.slug = slug; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("description") + public void setDescription(String description) { + this.description = description; + } + + @JsonProperty("url") + public String getUrl() { + return url; + } + + @JsonProperty("url") + public void setUrl(String url) { + this.url = url; + } + + @JsonProperty("id") + public Integer getId() { + return id; + } + + @JsonProperty("id") + public void setId(Integer id) { + this.id = id; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + FilteredSeries that = (FilteredSeries) o; + return Objects.equals(name, that.name) && Objects.equals(originalName, that.originalName) && Objects.equals(romajiName, that.romajiName) && Objects.equals(slug, that.slug) && Objects.equals(description, that.description) && Objects.equals(url, that.url) && Objects.equals(id, that.id); + } + + @Override + public int hashCode() { + return Objects.hash(name, originalName, romajiName, slug, description, url, id); + } + + @Override + public String toString() { + return "FilteredSeries{" + + "name='" + name + '\'' + + ", originalName='" + originalName + '\'' + + ", romajiName='" + romajiName + '\'' + + ", slug='" + slug + '\'' + + ", description='" + description + '\'' + + ", url='" + url + '\'' + + ", id=" + id + + '}'; + } +} diff --git a/src/main/java/org/goudham/me/api/entity/series/Series.java b/src/main/java/org/goudham/me/api/entity/series/Series.java new file mode 100644 index 0000000..632a182 --- /dev/null +++ b/src/main/java/org/goudham/me/api/entity/series/Series.java @@ -0,0 +1,316 @@ +package org.goudham.me.api.entity.series; + +import javax.annotation.processing.Generated; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.goudham.me.api.entity.Studio; +import org.goudham.me.api.entity.waifu.Waifu; + +import java.util.Objects; + +/** + * {@link Series} + *

Represents a grouping of various {@link Waifu}'s. This can be an anime, mobile game, video game, manga, or LN

+ * + *

Fields included are:

+ *
    + *
  • {@link String name}
  • + *
  • {@link String originalName}
  • + *
  • {@link String romajiName}
  • + *
  • {@link String slug}
  • + *
  • {@link String releaseDate}
  • + *
  • {@link String airingStart}
  • + *
  • {@link String airingEnd}
  • + *
  • {@link Integer episodeCount}
  • + *
  • {@link String image}
  • + *
  • {@link String url}
  • + *
  • {@link Studio}
  • + *
  • {@link Integer id}
  • + *
+ * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "name", + "original_name", + "romaji_name", + "description", + "slug", + "release_date", + "airing_start", + "airing_end", + "episode_count", + "image", + "url", + "studio", + "id" +}) +@Generated("jsonschema2pojo") +public class Series { + /** + * Full Name (in English) + * + */ + @JsonProperty("name") + @JsonPropertyDescription("Full Name (in English)") + private String name; + + /** + * Name in the original language (日本語) + * + */ + @JsonProperty("original_name") + @JsonPropertyDescription("Name in the original language (\u65e5\u672c\u8a9e)") + private String originalName; + + /** + * Romanization of this {@link Series} name + * + */ + @JsonProperty("romaji_name") + @JsonPropertyDescription("Romanization of this Series name") + private String romajiName; + + /** + * Spoiler-free description of the {@link Series}, work, etc + * + */ + @JsonProperty("description") + @JsonPropertyDescription("Spoiler-free description of the series, work, etc") + private String description; + + /** + * Used to generate readable URL's for the {@link Series} + * + */ + @JsonProperty("slug") + @JsonPropertyDescription("Used to generate readable URL's for the Series") + private String slug; + + /** + * Original works release date ( + * + */ + @JsonProperty("release_date") + @JsonPropertyDescription("Original works release date (") + private String releaseDate; + + /** + * The works airing start date + * + */ + @JsonProperty("airing_start") + @JsonPropertyDescription("The works airing start date") + private String airingStart; + + /** + * The works airing end date + * + */ + @JsonProperty("airing_end") + @JsonPropertyDescription("The works airing end date") + private String airingEnd; + + /** + * The number of episodes in this work. 1 if OVA or Movie. + * + */ + @JsonProperty("episode_count") + @JsonPropertyDescription("The number of episodes in this work. 1 if OVA or Movie.") + private Integer episodeCount; + + /** + * URL of the display picture + * + */ + @JsonProperty("image") + @JsonPropertyDescription("URL of the display picture") + private String image; + + /** + * URL of the {@link Series} + */ + @JsonProperty("url") + private String url; + + /** + * {@link Studio} + *

+ * Contains information on a given animation or game development studio + * + */ + @JsonProperty("studio") + @JsonPropertyDescription("Contains information on a given animation or game development studio") + private Studio studio; + + /** + * The internal ID of the {@link Series} + * + */ + @JsonProperty("id") + @JsonPropertyDescription("The internal ID of the Series") + private Integer id; + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("original_name") + public String getOriginalName() { + return originalName; + } + + @JsonProperty("original_name") + public void setOriginalName(String originalName) { + this.originalName = originalName; + } + + @JsonProperty("romaji_name") + public String getRomajiName() { + return romajiName; + } + + @JsonProperty("romaji_name") + public void setRomajiName(String romajiName) { + this.romajiName = romajiName; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("description") + public void setDescription(String description) { + this.description = description; + } + + @JsonProperty("slug") + public String getSlug() { + return slug; + } + + @JsonProperty("slug") + public void setSlug(String slug) { + this.slug = slug; + } + + @JsonProperty("release_date") + public String getReleaseDate() { + return releaseDate; + } + + @JsonProperty("release_date") + public void setReleaseDate(String releaseDate) { + this.releaseDate = releaseDate; + } + + public String getAiringStart() { + return airingStart; + } + + public void setAiringStart(String airingStart) { + this.airingStart = airingStart; + } + + @JsonProperty("airing_end") + public String getAiringEnd() { + return airingEnd; + } + + @JsonProperty("airing_end") + public void setAiringEnd(String airingEnd) { + this.airingEnd = airingEnd; + } + + @JsonProperty("episode_count") + public Integer getEpisodeCount() { + return episodeCount; + } + + @JsonProperty("episode_count") + public void setEpisodeCount(Integer episodeCount) { + this.episodeCount = episodeCount; + } + + @JsonProperty("image") + public String getImage() { + return image; + } + + @JsonProperty("image") + public void setImage(String image) { + this.image = image; + } + + @JsonProperty("url") + public String getUrl() { + return url; + } + + @JsonProperty("url") + public void setUrl(String url) { + this.url = url; + } + + @JsonProperty("studio") + public Studio getStudio() { + return studio; + } + + @JsonProperty("studio") + public void setStudio(Studio studio) { + this.studio = studio; + } + + @JsonProperty("id") + public Integer getId() { + return id; + } + + @JsonProperty("id") + public void setId(Integer id) { + this.id = id; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Series series = (Series) o; + return Objects.equals(name, series.name) && Objects.equals(originalName, series.originalName) && Objects.equals(romajiName, series.romajiName) && Objects.equals(description, series.description) && Objects.equals(slug, series.slug) && Objects.equals(releaseDate, series.releaseDate) && Objects.equals(airingStart, series.airingStart) && Objects.equals(airingEnd, series.airingEnd) && Objects.equals(episodeCount, series.episodeCount) && Objects.equals(image, series.image) && Objects.equals(url, series.url) && Objects.equals(studio, series.studio) && Objects.equals(id, series.id); + } + + @Override + public int hashCode() { + return Objects.hash(name, originalName, romajiName, description, slug, releaseDate, airingStart, airingEnd, episodeCount, image, url, studio, id); + } + + @Override + public String toString() { + return "Series{" + + "name='" + name + '\'' + + ", originalName='" + originalName + '\'' + + ", romajiName='" + romajiName + '\'' + + ", description='" + description + '\'' + + ", slug='" + slug + '\'' + + ", releaseDate='" + releaseDate + '\'' + + ", airingStart='" + airingStart + '\'' + + ", airingEnd='" + airingEnd + '\'' + + ", episodeCount=" + episodeCount + + ", image='" + image + '\'' + + ", url='" + url + '\'' + + ", studio=" + studio + + ", id=" + id + + '}'; + } +} \ No newline at end of file diff --git a/src/main/java/org/goudham/me/api/entity/user/TrueLove.java b/src/main/java/org/goudham/me/api/entity/user/TrueLove.java new file mode 100644 index 0000000..3606c89 --- /dev/null +++ b/src/main/java/org/goudham/me/api/entity/user/TrueLove.java @@ -0,0 +1,105 @@ + +package org.goudham.me.api.entity.user; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.goudham.me.api.entity.series.Series; + +import javax.annotation.processing.Generated; +import java.util.Objects; + +/** + * {@link TrueLove} + *

Represents a {@link User}'s True Love

+ * + *

Fields included are:

+ *
    + *
  • {@link String name}
  • + *
  • {@link String slug}
  • + *
  • {@link String series}
  • + *
+ * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "name", + "slug", + "series" +}) +@Generated("jsonschema2pojo") +public class TrueLove { + /** + * Name of {@link TrueLove} + */ + @JsonProperty("name") + @JsonPropertyDescription("Name of True Love") + private String name; + + /** + * Slug value of {@link TrueLove} + */ + @JsonProperty("slug") + @JsonPropertyDescription("Slug value of True Love") + private String slug; + + /** + * {@link Series} that this {@link TrueLove} is part of + */ + @JsonProperty("series") + @JsonPropertyDescription("Series that this TrueLove is part of") + private String series; + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("slug") + public String getSlug() { + return slug; + } + + @JsonProperty("slug") + public void setSlug(String slug) { + this.slug = slug; + } + + @JsonProperty("series") + public String getSeries() { + return series; + } + + @JsonProperty("series") + public void setSeries(String series) { + this.series = series; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + TrueLove trueLove = (TrueLove) o; + return Objects.equals(name, trueLove.name) && Objects.equals(slug, trueLove.slug) && Objects.equals(series, trueLove.series); + } + + @Override + public int hashCode() { + return Objects.hash(name, slug, series); + } + + @Override + public String toString() { + return "TrueLove{" + + "name='" + name + '\'' + + ", slug='" + slug + '\'' + + ", series='" + series + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/src/main/java/org/goudham/me/api/entity/user/User.java b/src/main/java/org/goudham/me/api/entity/user/User.java new file mode 100644 index 0000000..71fad46 --- /dev/null +++ b/src/main/java/org/goudham/me/api/entity/user/User.java @@ -0,0 +1,211 @@ +package org.goudham.me.api.entity.user; + +import javax.annotation.processing.Generated; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.goudham.me.api.entity.waifu.Waifu; + +import java.util.Objects; + + +/** + * {@link User} + *

Standard user information and counts of waifus created, liked, trashed. Also contains true love

+ * + *

Fields included are:

+ *
    + *
  • {@link Integer id}
  • + *
  • {@link String name}
  • + *
  • {@link String twitter}
  • + *
  • {@link String joined}
  • + *
  • {@link Integer waifusCreated}
  • + *
  • {@link Integer waifusLiked}
  • + *
  • {@link Integer waifusTrashed}
  • + *
  • {@link TrueLove trueLove}
  • + *
+ * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "id", + "name", + "twitter", + "joined", + "waifus_created", + "waifus_liked", + "waifus_trashed", + "true_love" +}) +@Generated("jsonschema2pojo") +public class User { + + /** + * {@link User} ID + */ + @JsonProperty("id") + private Integer id; + + /** + * {@link User}'s display name, or twitter name + * + */ + @JsonProperty("name") + @JsonPropertyDescription("User's display name, or twitter name") + private String name; + + /** + * {@link User}'s Twitter Handle + * + */ + @JsonProperty("twitter") + @JsonPropertyDescription("User's Twitter Handle") + private String twitter; + + /** + * ISO 8601 date when {@link User} joined + * + */ + @JsonProperty("joined") + @JsonPropertyDescription("ISO 8601 date when user joined") + private String joined; + + /** + * Number of {@link Waifu}'s this {@link User} has created + * + */ + @JsonProperty("waifus_created") + @JsonPropertyDescription("Number of Waifu's this user has created") + private Integer waifusCreated; + + /** + * Number of {@link Waifu}'s this {@link User} has liked + * + */ + @JsonProperty("waifus_liked") + @JsonPropertyDescription("Number of Waifu's this user has liked") + private Integer waifusLiked; + + /** + * Number of {@link Waifu}'s this {@link User} has trashed + * + */ + @JsonProperty("waifus_trashed") + @JsonPropertyDescription("Number of Waifu's this user has trashed") + private Integer waifusTrashed; + + /** + *

User's {@link TrueLove}

+ */ + @JsonProperty("true_love") + private TrueLove trueLove; + + @JsonProperty("id") + public Integer getId() { + return id; + } + + @JsonProperty("id") + public void setId(Integer id) { + this.id = id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("twitter") + public String getTwitter() { + return twitter; + } + + @JsonProperty("twitter") + public void setTwitter(String twitter) { + this.twitter = twitter; + } + + @JsonProperty("joined") + public String getJoined() { + return joined; + } + + @JsonProperty("joined") + public void setJoined(String joined) { + this.joined = joined; + } + + @JsonProperty("waifus_created") + public Integer getWaifusCreated() { + return waifusCreated; + } + + @JsonProperty("waifus_created") + public void setWaifusCreated(Integer waifusCreated) { + this.waifusCreated = waifusCreated; + } + + @JsonProperty("waifus_liked") + public Integer getWaifusLiked() { + return waifusLiked; + } + + @JsonProperty("waifus_liked") + public void setWaifusLiked(Integer waifusLiked) { + this.waifusLiked = waifusLiked; + } + + @JsonProperty("waifus_trashed") + public Integer getWaifusTrashed() { + return waifusTrashed; + } + + @JsonProperty("waifus_trashed") + public void setWaifusTrashed(Integer waifusTrashed) { + this.waifusTrashed = waifusTrashed; + } + + @JsonProperty("true_love") + public TrueLove getTrueLove() { + return trueLove; + } + + @JsonProperty("true_love") + public void setTrueLove(TrueLove trueLove) { + this.trueLove = trueLove; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + User user = (User) o; + return Objects.equals(id, user.id) && Objects.equals(name, user.name) && Objects.equals(twitter, user.twitter) && Objects.equals(joined, user.joined) && Objects.equals(waifusCreated, user.waifusCreated) && Objects.equals(waifusLiked, user.waifusLiked) && Objects.equals(waifusTrashed, user.waifusTrashed) && Objects.equals(trueLove, user.trueLove); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, twitter, joined, waifusCreated, waifusLiked, waifusTrashed, trueLove); + } + + @Override + public String toString() { + return "User{" + + "id=" + id + + ", name='" + name + '\'' + + ", twitter='" + twitter + '\'' + + ", joined='" + joined + '\'' + + ", waifusCreated=" + waifusCreated + + ", waifusLiked=" + waifusLiked + + ", waifusTrashed=" + waifusTrashed + + ", trueLove=" + trueLove + + '}'; + } +} diff --git a/src/main/java/org/goudham/me/api/entity/user/UserList.java b/src/main/java/org/goudham/me/api/entity/user/UserList.java new file mode 100644 index 0000000..a962aaf --- /dev/null +++ b/src/main/java/org/goudham/me/api/entity/user/UserList.java @@ -0,0 +1,129 @@ +package org.goudham.me.api.entity.user; + +import java.util.List; +import java.util.Objects; +import javax.annotation.processing.Generated; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.goudham.me.api.entity.waifu.Waifu; + +/** + * {@link UserList} + *

Get an array of all user lists on their profile

+ * + *

Fields included are:

+ *
    + *
  • {@link Integer id}
  • + *
  • {@link String name}
  • + *
  • {@link String order}
  • + *
  • {@link List} of {@link Waifu}'s
  • + *
+ * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "id", + "name", + "order", + "waifus" +}) +@Generated("jsonschema2pojo") +public class UserList { + /** + * {@link UserList} ID + * + */ + @JsonProperty("id") + @JsonPropertyDescription("UserList ID") + private Integer id; + + /** + * {@link UserList} Name + * + */ + @JsonProperty("name") + @JsonPropertyDescription("UserList Name") + private String name; + + /** + * Order this appears in the {@link UserList} + * + */ + @JsonProperty("order") + @JsonPropertyDescription("Order this appears in the UserList") + private Integer order; + + /** + * List of {@link Waifu}'s within the {@link UserList} + * + */ + @JsonProperty("waifus") + @JsonPropertyDescription("List of Waifu's within the UserList") + private List waifus; + + @JsonProperty("id") + public Integer getId() { + return id; + } + + @JsonProperty("id") + public void setId(Integer id) { + this.id = id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("order") + public Integer getOrder() { + return order; + } + + @JsonProperty("order") + public void setOrder(Integer order) { + this.order = order; + } + + @JsonProperty("waifus") + public List getWaifus() { + return waifus; + } + + @JsonProperty("waifus") + public void setWaifus(List waifus) { + this.waifus = waifus; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + UserList userList = (UserList) o; + return Objects.equals(id, userList.id) && Objects.equals(name, userList.name) && Objects.equals(order, userList.order) && Objects.equals(waifus, userList.waifus); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, order, waifus); + } + + @Override + public String toString() { + return "UserList{" + + "id=" + id + + ", name='" + name + '\'' + + ", order=" + order + + ", waifus=" + waifus + + '}'; + } +} \ No newline at end of file diff --git a/src/main/java/org/goudham/me/api/entity/waifu/Appearance.java b/src/main/java/org/goudham/me/api/entity/waifu/Appearance.java new file mode 100644 index 0000000..ca7032a --- /dev/null +++ b/src/main/java/org/goudham/me/api/entity/waifu/Appearance.java @@ -0,0 +1,125 @@ +package org.goudham.me.api.entity.waifu; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.processing.Generated; + + +/** + * {@link Appearance} + *

Contains basic series information for most endpoints

+ * + *

Fields included are:

+ *
    + *
  • {@link String name}
  • + *
  • {@link String originalName}
  • + *
  • {@link String romajiName}
  • + *
  • {@link String slug}
  • + *
  • {@link String description}
  • + *
  • {@link String url}
  • + *
  • {@link Integer id}
  • + *
+ * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "name", + "original_name", + "romaji_name", + "slug", + "description", + "url", + "id" +}) +@Generated("jsonschema2pojo") +public class Appearance { + @JsonProperty("name") + private String name; + @JsonProperty("original_name") + private String originalName; + @JsonProperty("romaji_name") + private String romajiName; + @JsonProperty("slug") + private String slug; + @JsonProperty("description") + private String description; + @JsonProperty("url") + private String url; + @JsonProperty("id") + @JsonPropertyDescription("Internal ID of the series") + private Integer id; + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("original_name") + public String getOriginalName() { + return originalName; + } + + @JsonProperty("original_name") + public void setOriginalName(String originalName) { + this.originalName = originalName; + } + + @JsonProperty("romaji_name") + public String getRomajiName() { + return romajiName; + } + + @JsonProperty("romaji_name") + public void setRomajiName(String romajiName) { + this.romajiName = romajiName; + } + + @JsonProperty("slug") + public String getSlug() { + return slug; + } + + @JsonProperty("slug") + public void setSlug(String slug) { + this.slug = slug; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("description") + public void setDescription(String description) { + this.description = description; + } + + @JsonProperty("url") + public String getUrl() { + return url; + } + + @JsonProperty("url") + public void setUrl(String url) { + this.url = url; + } + + @JsonProperty("id") + public Integer getId() { + return id; + } + + @JsonProperty("id") + public void setId(Integer id) { + this.id = id; + } + +} diff --git a/src/main/java/org/goudham/me/api/entity/waifu/FilteredWaifu.java b/src/main/java/org/goudham/me/api/entity/waifu/FilteredWaifu.java new file mode 100644 index 0000000..ae2a827 --- /dev/null +++ b/src/main/java/org/goudham/me/api/entity/waifu/FilteredWaifu.java @@ -0,0 +1,273 @@ +package org.goudham.me.api.entity.waifu; + +import java.util.List; +import java.util.Objects; +import javax.annotation.processing.Generated; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +/** + * Filtered Waifu + *

Contains Waifu data structure for endpoints other than the primary endpoint (/waifu/{slug})

+ * + *

Fields included are:

+ *
    + *
  • {@link String slug}
  • + *
  • {@link String name}
  • + *
  • {@link String originalName}
  • + *
  • {@link String romajiName}
  • + *
  • {@link String displayPicture}
  • + *
  • {@link Integer likes}
  • + *
  • {@link Integer trash}
  • + *
  • {@link Integer episodeCount}
  • + *
  • {@link String url}
  • + *
  • {@link List} of {@link Appearance}'s
  • + *
  • {@link Double id}
  • + *
+ * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "slug", + "name", + "original_name", + "romaji_name", + "display_picture", + "description", + "likes", + "trash", + "url", + "appearances", + "id" +}) +@Generated("jsonschema2pojo") +public class FilteredWaifu { + /** + * Used to generate readable URL's for the Waifu + * + */ + @JsonProperty("slug") + @JsonPropertyDescription("Used to generate readable URL's for the Waifu") + private String slug; + + /** + * Full name, in English. + * + */ + @JsonProperty("name") + @JsonPropertyDescription("Full name, in English.") + private String name; + + /** + * Name in the original language (日本語) + * + */ + @JsonProperty("original_name") + @JsonPropertyDescription("Name in the original language (\u65e5\u672c\u8a9e)") + private String originalName; + + /** + * If this character has a romaji name, we'll put it here. + * + */ + @JsonProperty("romaji_name") + @JsonPropertyDescription("if this character has a romaji name, we'll put it here. ") + private String romajiName; + + /** + * URL of the display picture + * + */ + @JsonProperty("display_picture") + @JsonPropertyDescription("URL of the display picture") + private String displayPicture; + + /** + * Truncated, spoiler-free description of this Waifu + * + */ + @JsonProperty("description") + @JsonPropertyDescription("Truncated, spoiler-free description of this Waifu") + private String description; + + /** + * Number of likes for this Waifu + * + */ + @JsonProperty("likes") + @JsonPropertyDescription("Number of likes for this Waifu") + private Integer likes; + + /** + * Number of trashes for this Waifu + * + */ + @JsonProperty("trash") + @JsonPropertyDescription("Number of trashes for this Waifu") + private Integer trash; + + /** + * URL to view in browser + * + */ + @JsonProperty("url") + @JsonPropertyDescription("URL to view in browser") + private String url; + + /** + *

{@link List} of Waifu's {@link Appearance}

+ */ + @JsonProperty("appearances") + private List appearances; + + /** + * {@link FilteredWaifu} ID + */ + @JsonProperty("id") + private Double id; + + @JsonProperty("slug") + public String getSlug() { + return slug; + } + + @JsonProperty("slug") + public void setSlug(String slug) { + this.slug = slug; + } + + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("original_name") + public String getOriginalName() { + return originalName; + } + + @JsonProperty("original_name") + public void setOriginalName(String originalName) { + this.originalName = originalName; + } + + @JsonProperty("romaji_name") + public String getRomajiName() { + return romajiName; + } + + @JsonProperty("romaji_name") + public void setRomajiName(String romajiName) { + this.romajiName = romajiName; + } + + @JsonProperty("display_picture") + public String getDisplayPicture() { + return displayPicture; + } + + @JsonProperty("display_picture") + public void setDisplayPicture(String displayPicture) { + this.displayPicture = displayPicture; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("description") + public void setDescription(String description) { + this.description = description; + } + + @JsonProperty("likes") + public Integer getLikes() { + return likes; + } + + @JsonProperty("likes") + public void setLikes(Integer likes) { + this.likes = likes; + } + + @JsonProperty("trash") + public Integer getTrash() { + return trash; + } + + @JsonProperty("trash") + public void setTrash(Integer trash) { + this.trash = trash; + } + + @JsonProperty("url") + public String getUrl() { + return url; + } + + @JsonProperty("url") + public void setUrl(String url) { + this.url = url; + } + + @JsonProperty("appearances") + public List getAppearances() { + return appearances; + } + + @JsonProperty("appearances") + public void setAppearances(List appearances) { + this.appearances = appearances; + } + + @JsonProperty("id") + public Double getId() { + return id; + } + + @JsonProperty("id") + public void setId(Double id) { + this.id = id; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + FilteredWaifu that = (FilteredWaifu) o; + return Objects.equals(slug, that.slug) && Objects.equals(name, that.name) && Objects.equals(originalName, that.originalName) && Objects.equals(romajiName, that.romajiName) && Objects.equals(displayPicture, that.displayPicture) && Objects.equals(description, that.description) && Objects.equals(likes, that.likes) && Objects.equals(trash, that.trash) && Objects.equals(url, that.url) && Objects.equals(appearances, that.appearances) && Objects.equals(id, that.id); + } + + @Override + public int hashCode() { + return Objects.hash(slug, name, originalName, romajiName, displayPicture, description, likes, trash, url, appearances, id); + } + + @Override + public String toString() { + return "FilteredWaifu{" + + "slug='" + slug + '\'' + + ", name='" + name + '\'' + + ", originalName='" + originalName + '\'' + + ", romajiName='" + romajiName + '\'' + + ", displayPicture='" + displayPicture + '\'' + + ", description='" + description + '\'' + + ", likes=" + likes + + ", trash=" + trash + + ", url='" + url + '\'' + + ", appearances=" + appearances + + ", id=" + id + + '}'; + } +} \ No newline at end of file diff --git a/src/main/java/org/goudham/me/api/entity/waifu/Waifu.java b/src/main/java/org/goudham/me/api/entity/waifu/Waifu.java new file mode 100644 index 0000000..716fd07 --- /dev/null +++ b/src/main/java/org/goudham/me/api/entity/waifu/Waifu.java @@ -0,0 +1,686 @@ +package org.goudham.me.api.entity.waifu; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.processing.Generated; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonValue; +import org.goudham.me.api.entity.series.Series; + + +/** + * {@link Waifu} + *

Contains most common attributes for {@link Waifu}'s based on various source material

+ * + *

Fields included are:

+ *
    + *
  • {@link Integer id}
  • + *
  • {@link String slug}
  • + *
  • {@link Integer creatorId}
  • + *
  • {@link String name}
  • + *
  • {@link String originalName}
  • + *
  • {@link String displayPicture}
  • + *
  • {@link String description}
  • + *
  • {@link Double weight}
  • + *
  • {@link Double height}
  • + *
  • {@link Double bust}
  • + *
  • {@link Double hip}
  • + *
  • {@link Double waist}
  • + *
  • {@link Waifu.BloodType bloodType}
  • + *
  • {@link String origin}
  • + *
  • {@link Integer age}
  • + *
  • {@link String birthdayMonth}
  • + *
  • {@link Integer birthdayDay}
  • + *
  • {@link Integer birthdayYear}
  • + *
  • {@link Integer likes}
  • + *
  • {@link Integer trash}
  • + *
  • {@link String url}
  • + *
  • {@link Boolean husbando}
  • + *
  • {@link Boolean nsfw}
  • + *
  • {@link Integer popularityRank}
  • + *
  • {@link Integer likeRank}
  • + *
  • {@link Integer trashRank}
  • + *
  • {@link List} of {@link Appearance}'s
  • + *
  • {@link Series series}
  • + *
+ * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "id", + "slug", + "creator_id", + "name", + "original_name", + "display_picture", + "description", + "weight", + "height", + "bust", + "hip", + "waist", + "blood_type", + "origin", + "age", + "birthday_month", + "birthday_day", + "birthday_year", + "likes", + "trash", + "url", + "husbando", + "nsfw", + "popularity_rank", + "like_rank", + "trash_rank", + "appearances", + "series" +}) +@Generated("jsonschema2pojo") +public class Waifu { + /** + * {@link Waifu} ID + * + */ + @JsonProperty("id") + @JsonPropertyDescription("ID of this Waifu") + private Integer id; + + /** + * Used to generate readable URL's for the {@link Waifu} + * + */ + @JsonProperty("slug") + @JsonPropertyDescription("Used to generate readable URL's for the Waifu") + private String slug; + + /** + * ID of the user who created this {@link Waifu} + * + */ + @JsonProperty("creator_id") + @JsonPropertyDescription("ID of the user who created this Waifu") + private Integer creatorId; + + /** + * Full name, in English. + * + */ + @JsonProperty("name") + @JsonPropertyDescription("Full name, in English.") + private String name; + + /** + * Name in the original language (日本語) + * + */ + @JsonProperty("original_name") + @JsonPropertyDescription("Name in the original language (\u65e5\u672c\u8a9e)") + private String originalName; + + /** + * URL of the display picture + * + */ + @JsonProperty("display_picture") + @JsonPropertyDescription("URL of the display picture") + private String displayPicture; + + /** + * Spoiler-free description of this {@link Waifu} + * + */ + @JsonProperty("description") + @JsonPropertyDescription("Spoiler-free description of this Waifu") + private String description; + + /** + * Weight (kg) + * + */ + @JsonProperty("weight") + @JsonPropertyDescription("Weight (kg)") + private Double weight; + + /** + * Height(cm) + * + */ + @JsonProperty("height") + @JsonPropertyDescription("Height(cm)") + private Double height; + + /** + * Bust size (cm) + * + */ + @JsonProperty("bust") + @JsonPropertyDescription("Bust size (cm)") + private Double bust; + + /** + * Hip size (cm) + * + */ + @JsonProperty("hip") + @JsonPropertyDescription("Hip size (cm)") + private Double hip; + + /** + * Waist size (cm) + * + */ + @JsonProperty("waist") + @JsonPropertyDescription("Waist size (cm)") + private Double waist; + + /** + * Common in Japanese culture as a potential reprenstation of personality types + * + */ + @JsonProperty("blood_type") + @JsonPropertyDescription("Common in Japanese culture as a potential reprenstation of personality types") + private Waifu.BloodType bloodType; + + /** + * Birth location, home, etc. + * + */ + @JsonProperty("origin") + @JsonPropertyDescription("Birth location, home, etc.") + private String origin; + + /** + * Age from the source material (e.g. 500 for 500 years old) + * + */ + @JsonProperty("age") + @JsonPropertyDescription("Age from the source material (e.g. 500 for 500 years old)") + private Integer age; + + /** + * Birth month from source material + * + */ + @JsonProperty("birthday_month") + @JsonPropertyDescription("Birth month from source material") + private String birthdayMonth; + + /** + * Birth day from source material + * + */ + @JsonProperty("birthday_day") + @JsonPropertyDescription("Birth day from source material") + private Integer birthdayDay; + + /** + * Birth year from source material + * + */ + @JsonProperty("birthday_year") + @JsonPropertyDescription("Birth year from source material") + private Integer birthdayYear; + + /** + * Number of likes for this {@link Waifu} + * + */ + @JsonProperty("likes") + @JsonPropertyDescription("Number of likes for this Waifu") + private Integer likes; + + /** + * Number of trashes for this {@link Waifu} + * + */ + @JsonProperty("trash") + @JsonPropertyDescription("Number of trashes for this Waifu") + private Integer trash; + + /** + * URL to view in browser + * + */ + @JsonProperty("url") + @JsonPropertyDescription("URL to view in browser") + private String url; + + /** + * If this character is a husbando + * + */ + @JsonProperty("husbando") + @JsonPropertyDescription("If this character is a husbando") + private Boolean husbando; + + /** + * If this {@link Waifu}\husbando appears in an NSFW work + * + */ + @JsonProperty("nsfw") + @JsonPropertyDescription("If this waifu\\husbando appears in an NSFW work") + private Boolean nsfw; + + /** + * Site-wide popularity ranking + * + */ + @JsonProperty("popularity_rank") + @JsonPropertyDescription("Site-wide popularity ranking") + private Integer popularityRank; + + /** + * Site-wide "like" or "claim" ranking + * + */ + @JsonProperty("like_rank") + @JsonPropertyDescription("Site-wide \"like\" or \"claim\" ranking") + private Integer likeRank; + + /** + * Site-wide trash ranking - lower is worse. + * + */ + @JsonProperty("trash_rank") + @JsonPropertyDescription("Site-wide trash ranking - lower is worse") + private Integer trashRank; + + /** + * An array of series or works that this character appears in. + * + */ + @JsonProperty("appearances") + @JsonPropertyDescription("An array of series or works that this character appears in") + private List appearances = null; + + /** + * {@link Series} + *

Contains basic series information for most endpoints

+ * + */ + @JsonProperty("series") + @JsonPropertyDescription("Contains basic series information for most endpoints") + private Series series; + + @JsonProperty("id") + public Integer getId() { + return id; + } + + @JsonProperty("id") + public void setId(Integer id) { + this.id = id; + } + + @JsonProperty("slug") + public String getSlug() { + return slug; + } + + @JsonProperty("slug") + public void setSlug(String slug) { + this.slug = slug; + } + + @JsonProperty("creator_id") + public Integer getCreatorId() { + return creatorId; + } + + @JsonProperty("creator_id") + public void setCreatorId(Integer creatorId) { + this.creatorId = creatorId; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("original_name") + public String getOriginalName() { + return originalName; + } + + @JsonProperty("original_name") + public void setOriginalName(String originalName) { + this.originalName = originalName; + } + + @JsonProperty("display_picture") + public String getDisplayPicture() { + return displayPicture; + } + + @JsonProperty("display_picture") + public void setDisplayPicture(String displayPicture) { + this.displayPicture = displayPicture; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("description") + public void setDescription(String description) { + this.description = description; + } + + @JsonProperty("weight") + public Double getWeight() { + return weight; + } + + @JsonProperty("weight") + public void setWeight(Double weight) { + this.weight = weight; + } + + @JsonProperty("height") + public Double getHeight() { + return height; + } + + @JsonProperty("height") + public void setHeight(Double height) { + this.height = height; + } + + @JsonProperty("bust") + public Double getBust() { + return bust; + } + + @JsonProperty("bust") + public void setBust(Double bust) { + this.bust = bust; + } + + @JsonProperty("hip") + public Double getHip() { + return hip; + } + + @JsonProperty("hip") + public void setHip(Double hip) { + this.hip = hip; + } + + @JsonProperty("waist") + public Double getWaist() { + return waist; + } + + @JsonProperty("waist") + public void setWaist(Double waist) { + this.waist = waist; + } + + @JsonProperty("blood_type") + public Waifu.BloodType getBloodType() { + return bloodType; + } + + @JsonProperty("blood_type") + public void setBloodType(Waifu.BloodType bloodType) { + this.bloodType = bloodType; + } + + @JsonProperty("origin") + public String getOrigin() { + return origin; + } + + @JsonProperty("origin") + public void setOrigin(String origin) { + this.origin = origin; + } + + @JsonProperty("age") + public Integer getAge() { + return age; + } + + @JsonProperty("age") + public void setAge(Integer age) { + this.age = age; + } + + @JsonProperty("birthday_month") + public String getBirthdayMonth() { + return birthdayMonth; + } + + @JsonProperty("birthday_month") + public void setBirthdayMonth(String birthdayMonth) { + this.birthdayMonth = birthdayMonth; + } + + @JsonProperty("birthday_day") + public Integer getBirthdayDay() { + return birthdayDay; + } + + @JsonProperty("birthday_day") + public void setBirthdayDay(Integer birthdayDay) { + this.birthdayDay = birthdayDay; + } + + @JsonProperty("birthday_year") + public Integer getBirthdayYear() { + return birthdayYear; + } + + @JsonProperty("birthday_year") + public void setBirthdayYear(Integer birthdayYear) { + this.birthdayYear = birthdayYear; + } + + @JsonProperty("likes") + public Integer getLikes() { + return likes; + } + + @JsonProperty("likes") + public void setLikes(Integer likes) { + this.likes = likes; + } + + @JsonProperty("trash") + public Integer getTrash() { + return trash; + } + + @JsonProperty("trash") + public void setTrash(Integer trash) { + this.trash = trash; + } + + @JsonProperty("url") + public String getUrl() { + return url; + } + + @JsonProperty("url") + public void setUrl(String url) { + this.url = url; + } + + @JsonProperty("husbando") + public Boolean getHusbando() { + return husbando; + } + + @JsonProperty("husbando") + public void setHusbando(Boolean husbando) { + this.husbando = husbando; + } + + @JsonProperty("nsfw") + public Boolean getNsfw() { + return nsfw; + } + + @JsonProperty("nsfw") + public void setNsfw(Boolean nsfw) { + this.nsfw = nsfw; + } + + @JsonProperty("popularity_rank") + public Integer getPopularityRank() { + return popularityRank; + } + + @JsonProperty("popularity_rank") + public void setPopularityRank(Integer popularityRank) { + this.popularityRank = popularityRank; + } + + @JsonProperty("like_rank") + public Integer getLikeRank() { + return likeRank; + } + + @JsonProperty("like_rank") + public void setLikeRank(Integer likeRank) { + this.likeRank = likeRank; + } + + @JsonProperty("trash_rank") + public Integer getTrashRank() { + return trashRank; + } + + @JsonProperty("trash_rank") + public void setTrashRank(Integer trashRank) { + this.trashRank = trashRank; + } + + @JsonProperty("appearances") + public List getAppearances() { + return appearances; + } + + @JsonProperty("appearances") + public void setAppearances(List appearances) { + this.appearances = appearances; + } + + @JsonProperty("series") + public Series getSeries() { + return series; + } + + @JsonProperty("series") + public void setSeries(Series series) { + this.series = series; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Waifu waifu = (Waifu) o; + return Objects.equals(id, waifu.id) && Objects.equals(slug, waifu.slug) && Objects.equals(creatorId, waifu.creatorId) && Objects.equals(name, waifu.name) && Objects.equals(originalName, waifu.originalName) && Objects.equals(displayPicture, waifu.displayPicture) && Objects.equals(description, waifu.description) && Objects.equals(weight, waifu.weight) && Objects.equals(height, waifu.height) && Objects.equals(bust, waifu.bust) && Objects.equals(hip, waifu.hip) && Objects.equals(waist, waifu.waist) && bloodType == waifu.bloodType && Objects.equals(origin, waifu.origin) && Objects.equals(age, waifu.age) && Objects.equals(birthdayMonth, waifu.birthdayMonth) && Objects.equals(birthdayDay, waifu.birthdayDay) && Objects.equals(birthdayYear, waifu.birthdayYear) && Objects.equals(likes, waifu.likes) && Objects.equals(trash, waifu.trash) && Objects.equals(url, waifu.url) && Objects.equals(husbando, waifu.husbando) && Objects.equals(nsfw, waifu.nsfw) && Objects.equals(popularityRank, waifu.popularityRank) && Objects.equals(likeRank, waifu.likeRank) && Objects.equals(trashRank, waifu.trashRank) && Objects.equals(appearances, waifu.appearances) && Objects.equals(series, waifu.series); + } + + @Override + public int hashCode() { + return Objects.hash(id, slug, creatorId, name, originalName, displayPicture, description, weight, height, bust, hip, waist, bloodType, origin, age, birthdayMonth, birthdayDay, birthdayYear, likes, trash, url, husbando, nsfw, popularityRank, likeRank, trashRank, appearances, series); + } + + @Override + public String toString() { + return "Waifu{" + + "id=" + id + + ", slug='" + slug + '\'' + + ", creatorId=" + creatorId + + ", name='" + name + '\'' + + ", originalName='" + originalName + '\'' + + ", displayPicture='" + displayPicture + '\'' + + ", description='" + description + '\'' + + ", weight=" + weight + + ", height=" + height + + ", bust=" + bust + + ", hip=" + hip + + ", waist=" + waist + + ", bloodType=" + bloodType + + ", origin='" + origin + '\'' + + ", age=" + age + + ", birthdayMonth='" + birthdayMonth + '\'' + + ", birthdayDay=" + birthdayDay + + ", birthdayYear=" + birthdayYear + + ", likes=" + likes + + ", trash=" + trash + + ", url='" + url + '\'' + + ", husbando=" + husbando + + ", nsfw=" + nsfw + + ", popularityRank=" + popularityRank + + ", likeRank=" + likeRank + + ", trashRank=" + trashRank + + ", appearances=" + appearances + + ", series=" + series + + '}'; + } + + /** + * {@link BloodType} + *

Common in Japanese culture as a potential representation of personality types

+ * + */ + @Generated("jsonschema2pojo") + public enum BloodType { + + A("A"), + B("B"), + O("O"), + AB("AB"); + + private final String value; + private final static Map CONSTANTS = new HashMap(); + + static { + for (Waifu.BloodType bloodType: values()) { + CONSTANTS.put(bloodType.value, bloodType); + } + } + + BloodType(String value) { + this.value = value; + } + + @Override + public String toString() { + return this.value; + } + + @JsonValue + public String value() { + return this.value; + } + + @JsonCreator + public static Waifu.BloodType fromValue(String value) { + Waifu.BloodType constant = CONSTANTS.get(value); + if (constant == null) { + throw new IllegalArgumentException(value); + } else { + return constant; + } + } + } +} \ No newline at end of file diff --git a/src/main/java/org/goudham/me/api/entity/waifu/WaifuImage.java b/src/main/java/org/goudham/me/api/entity/waifu/WaifuImage.java new file mode 100644 index 0000000..06ef5d7 --- /dev/null +++ b/src/main/java/org/goudham/me/api/entity/waifu/WaifuImage.java @@ -0,0 +1,108 @@ +package org.goudham.me.api.entity.waifu; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.annotation.processing.Generated; +import java.util.Objects; + +/** + * {@link WaifuImage} + *

Contains a thumbnail and full res image link for an image in a given Waifu’s gallery

+ * + *

Fields included are:

+ *
    + *
  • {@link Integer id}
  • + *
  • {@link String thumbnail}
  • + *
  • {@link String path}
  • + *
+ * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "id", + "thumbnail", + "path" +}) +@Generated("jsonschema2pojo") +public class WaifuImage { + + /** + * ID in the database + * + */ + @JsonProperty("id") + @JsonPropertyDescription("ID in the database") + private Integer id; + + /** + * URL of the thumbnail to display + * + */ + @JsonProperty("thumbnail") + @JsonPropertyDescription("URL of the thumbnail to display") + private String thumbnail; + + /** + * Final URL of the original resolution image + * + */ + @JsonProperty("path") + @JsonPropertyDescription("Final URL of the original resolution image") + private String path; + + @JsonProperty("id") + public Integer getId() { + return id; + } + + @JsonProperty("id") + public void setId(Integer id) { + this.id = id; + } + + @JsonProperty("thumbnail") + public String getThumbnail() { + return thumbnail; + } + + @JsonProperty("thumbnail") + public void setThumbnail(String thumbnail) { + this.thumbnail = thumbnail; + } + + @JsonProperty("path") + public String getPath() { + return path; + } + + @JsonProperty("path") + public void setPath(String path) { + this.path = path; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + WaifuImage that = (WaifuImage) o; + return Objects.equals(id, that.id) && Objects.equals(thumbnail, that.thumbnail) && Objects.equals(path, that.path); + } + + @Override + public int hashCode() { + return Objects.hash(id, thumbnail, path); + } + + @Override + public String toString() { + return "WaifuImage{" + + "id=" + id + + ", thumbnail='" + thumbnail + '\'' + + ", path='" + path + '\'' + + '}'; + } +} + diff --git a/src/test/java/org/goudham/me/AppTest.java b/src/test/java/org/goudham/me/AppTest.java new file mode 100644 index 0000000..9840d16 --- /dev/null +++ b/src/test/java/org/goudham/me/AppTest.java @@ -0,0 +1,20 @@ +package org.goudham.me; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Unit test for simple App. + */ +public class AppTest +{ + /** + * Rigorous Test :-) + */ + @Test + public void shouldAnswerWithTrue() + { + assertTrue( true ); + } +}