-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include Ranking Endpoints (Anime, Manga, People and Characters)
- Loading branch information
Showing
28 changed files
with
617 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/com/jeluchu/core/enums/MangaFilterTypes.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.jeluchu.core.enums | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
enum class MangaFilterTypes { | ||
PUBLISHING, | ||
UPCOMING, | ||
BYPOPULARITY, | ||
FAVORITE, | ||
} | ||
|
||
val mangaFilterTypesErrorList = MangaFilterTypes.entries.joinToString(", ") { it.name.lowercase() } | ||
fun parseMangaFilterType(type: String) = MangaFilterTypes.entries.firstOrNull { it.name.equals(type, ignoreCase = true) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.jeluchu.core.enums | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
enum class MangaTypes { | ||
MANGA, | ||
NOVEL, | ||
LIGHTNOVEL, | ||
ONESHOT, | ||
DOUJIN, | ||
MANHWA, | ||
MANHUA | ||
} | ||
|
||
val mangaTypesErrorList = MangaTypes.entries.joinToString(", ") { it.name.lowercase() } | ||
fun parseMangaType(type: String) = MangaTypes.entries.firstOrNull { it.name.equals(type, ignoreCase = true) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
package com.jeluchu.core.messages | ||
|
||
import com.jeluchu.core.enums.Day | ||
import com.jeluchu.core.enums.* | ||
|
||
sealed class ErrorMessages(val message: String) { | ||
data object NotFound : ErrorMessages("Nyaaaaaaaan! This request has not been found by our alpaca-neko") | ||
data object AnimeNotFound : ErrorMessages("This malId is not in our database") | ||
data object InvalidMalId : ErrorMessages("The provided id of malId is invalid") | ||
data object InvalidDay : ErrorMessages("Invalid 'day' parameter. Valid values are: ${Day.entries.joinToString(", ") { it.name.lowercase() }}") | ||
data object InvalidTopAnimeType : ErrorMessages("Invalid 'type' parameter. Valid values are: $animeTypesErrorList") | ||
data object InvalidTopAnimeFilterType : ErrorMessages("Invalid 'type' parameter. Valid values are: $animeFilterTypesErrorList") | ||
data object InvalidTopMangaType : ErrorMessages("Invalid 'type' parameter. Valid values are: $mangaTypesErrorList") | ||
data object InvalidTopMangaFilterType : ErrorMessages("Invalid 'type' parameter. Valid values are: $mangaFilterTypesErrorList") | ||
data object InvalidInput : ErrorMessages("Invalid input provided") | ||
data object UnauthorizedMongo : ErrorMessages("Check the MongoDb Connection String to be able to correctly access this request.") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/main/kotlin/com/jeluchu/core/models/jikan/character/CharacterData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package fordelete | ||
|
||
import com.jeluchu.core.models.jikan.anime.Images | ||
import com.jeluchu.core.models.jikan.people.PeopleData | ||
import com.jeluchu.features.rankings.models.CharacterTopEntity | ||
import com.jeluchu.features.rankings.models.PeopleTopEntity | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class CharacterData( | ||
@SerialName("mal_id") | ||
val malId: Int? = 0, | ||
|
||
@SerialName("about") | ||
val about: String? = "", | ||
|
||
@SerialName("favorites") | ||
val favorites: Int? = 0, | ||
|
||
@SerialName("images") | ||
val images: Images? = Images(), | ||
|
||
@SerialName("name") | ||
val name: String? = "", | ||
|
||
@SerialName("name_kanji") | ||
val nameKanji: String? = "", | ||
|
||
@SerialName("nicknames") | ||
val nicknames: List<String>? = emptyList(), | ||
|
||
@SerialName("url") | ||
val url: String? = "" | ||
) { | ||
companion object { | ||
fun CharacterData.toCharacterTopEntity( | ||
page: Int, | ||
top: String | ||
) = CharacterTopEntity( | ||
malId = malId, | ||
image = images?.webp?.large.orEmpty(), | ||
name = name, | ||
nameKanji = nameKanji, | ||
top = top, | ||
page = page | ||
) | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/kotlin/com/jeluchu/core/models/jikan/character/CharacterSearch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.jeluchu.core.models.jikan.character | ||
|
||
import com.jeluchu.core.models.jikan.search.Pagination | ||
import fordelete.CharacterData | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class CharacterSearch( | ||
@SerialName("data") | ||
val data: List<CharacterData>? = emptyList(), | ||
|
||
@SerialName("pagination") | ||
val pagination: Pagination? = Pagination() | ||
) |
126 changes: 126 additions & 0 deletions
126
src/main/kotlin/com/jeluchu/core/models/jikan/manga/MangaData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
package com.jeluchu.core.models.jikan.manga | ||
|
||
import com.jeluchu.core.models.jikan.anime.* | ||
import com.jeluchu.features.rankings.models.MangaTopEntity | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class MangaData( | ||
@SerialName("approved") | ||
val approved: Boolean? = false, | ||
|
||
@SerialName("authors") | ||
val authors: List<Demographic>? = emptyList(), | ||
|
||
@SerialName("background") | ||
val background: String? = "", | ||
|
||
@SerialName("chapters") | ||
val chapters: Int? = 0, | ||
|
||
@SerialName("demographics") | ||
val demographics: List<Demographic>? = emptyList(), | ||
|
||
@SerialName("explicit_genres") | ||
val explicitGenres: List<Genre>? = emptyList(), | ||
|
||
@SerialName("favorites") | ||
val favorites: Int? = 0, | ||
|
||
@SerialName("genres") | ||
val genres: List<Genre>? = emptyList(), | ||
|
||
@SerialName("images") | ||
val images: Images? = Images(), | ||
|
||
@SerialName("mal_id") | ||
val malId: Int? = 0, | ||
|
||
@SerialName("members") | ||
val members: Int? = 0, | ||
|
||
@SerialName("popularity") | ||
val popularity: Int? = 0, | ||
|
||
@SerialName("published") | ||
val published: Published? = Published(), | ||
|
||
@SerialName("publishing") | ||
val publishing: Boolean? = false, | ||
|
||
@SerialName("rank") | ||
val rank: Int? = 0, | ||
|
||
@SerialName("score") | ||
val score: Double? = 0.0, | ||
|
||
@SerialName("scored") | ||
val scored: Double? = 0.0, | ||
|
||
@SerialName("scored_by") | ||
val scoredBy: Int? = 0, | ||
|
||
@SerialName("serializations") | ||
val serializations: List<Demographic>? = emptyList(), | ||
|
||
@SerialName("status") | ||
val status: String? = "", | ||
|
||
@SerialName("synopsis") | ||
val synopsis: String? = "", | ||
|
||
@SerialName("themes") | ||
val themes: List<Themes>? = emptyList(), | ||
|
||
@Deprecated("Use 'titles: List<Title>' to get the title") | ||
@SerialName("title") | ||
val title: String? = "", | ||
|
||
@Deprecated("Use 'titles: List<Title>' to get the title") | ||
@SerialName("title_english") | ||
val titleEnglish: String? = "", | ||
|
||
@Deprecated("Use 'titles: List<Title>' to get the title") | ||
@SerialName("title_japanese") | ||
val titleJapanese: String? = "", | ||
|
||
@Deprecated("Use 'titles: List<Title>' to get the title") | ||
@SerialName("title_synonyms") | ||
val titleSynonyms: List<String>? = emptyList(), | ||
|
||
@SerialName("titles") | ||
val titles: List<Title>? = emptyList(), | ||
|
||
@SerialName("type") | ||
val type: String? = "", | ||
|
||
@SerialName("url") | ||
val url: String? = "", | ||
|
||
@SerialName("volumes") | ||
val volumes: Int? = 0 | ||
) { | ||
companion object { | ||
fun MangaData.toMangaTopEntity( | ||
page: Int, | ||
top: String, | ||
type: String, | ||
subType: String, | ||
) = MangaTopEntity( | ||
malId = malId, | ||
rank = rank, | ||
score = score, | ||
image = images?.webp?.large.orEmpty(), | ||
title = titles?.first()?.title.orEmpty(), | ||
url = url, | ||
status = status, | ||
volumes = volumes, | ||
chapters = chapters, | ||
top = top, | ||
type = type, | ||
subtype = subType, | ||
page = page | ||
) | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/kotlin/com/jeluchu/core/models/jikan/manga/Published.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.jeluchu.core.models.jikan.manga | ||
|
||
import com.jeluchu.core.models.jikan.anime.Prop | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class Published( | ||
@SerialName("from") | ||
val from: String? = "", | ||
|
||
@SerialName("prop") | ||
val prop: Prop? = Prop(), | ||
|
||
@SerialName("string") | ||
val string: String? = "", | ||
|
||
@SerialName("to") | ||
val to: String? = "" | ||
) |
Oops, something went wrong.