Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support full person details #133

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SONATYPE_AUTOMATIC_RELEASE=true
RELEASE_SIGNING_ENABLED=true

GROUP=app.moviebase
VERSION_NAME=1.3.0-SNAPSHOT
VERSION_NAME=1.3.2-SNAPSHOT

POM_NAME=TMDB API for KMM
POM_DESCRIPTION=Kotlin Multiplatform library to access the TMDB API.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package app.moviebase.tmdb.api

import app.moviebase.tmdb.core.endPointV3
import app.moviebase.tmdb.core.parameterAppendResponses
import app.moviebase.tmdb.core.parameterLanguage
import app.moviebase.tmdb.model.AppendResponse
import app.moviebase.tmdb.model.TmdbPersonDetail
import app.moviebase.tmdb.model.TmdbPersonMovieCredits
import app.moviebase.tmdb.model.TmdbPersonShowCredits
import app.moviebase.tmdb.core.endPointV3
import app.moviebase.tmdb.core.parameterAppendResponses
import app.moviebase.tmdb.core.parameterLanguage
import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.request.*
import io.ktor.client.HttpClient
import io.ktor.client.call.body
import io.ktor.client.request.HttpRequestBuilder
import io.ktor.client.request.get

class TmdbPeopleApi internal constructor(private val client: HttpClient) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package app.moviebase.tmdb.core
import app.moviebase.tmdb.model.TmdbMediaListItem
import app.moviebase.tmdb.model.TmdbMovie
import app.moviebase.tmdb.model.TmdbPerson
import app.moviebase.tmdb.model.TmdbPersonCredit
import app.moviebase.tmdb.model.TmdbSearchableListItem
import app.moviebase.tmdb.model.TmdbShow
import kotlinx.serialization.json.Json
Expand All @@ -24,6 +25,9 @@ object JsonFactory {
polymorphic(TmdbSearchableListItem::class, TmdbShow::class, TmdbShow.serializer())
polymorphic(TmdbSearchableListItem::class, TmdbMovie::class, TmdbMovie.serializer())
polymorphic(TmdbSearchableListItem::class, TmdbPerson::class, TmdbPerson.serializer())

polymorphic(TmdbPersonCredit::class, TmdbPersonCredit.Show::class, TmdbPersonCredit.Show.serializer())
polymorphic(TmdbPersonCredit::class, TmdbPersonCredit.Movie::class, TmdbPersonCredit.Movie.serializer())
}
serializersModule = module
classDiscriminator = "media_type"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ enum class AppendResponse(val value: String) {
REVIEWS("reviews"),
CREDITS("credits"),
AGGREGATE_CREDITS("aggregate_credits"),
COMBINED_CREDITS("combined_credits"),
TRANSLATIONS("translations"),
IMAGES("images"),
TAGGED_IMAGES("tagged_images"),
EXTERNAL_IDS("external_ids"),
Expand Down Expand Up @@ -119,8 +121,10 @@ data class TmdbExternalIds(
@SerialName("id") val id: Int? = null, // it is is used in append responses
@SerialName("facebook_id") val facebook: String? = null,
@SerialName("instagram_id") val instagram: String? = null,
@SerialName("tiktok_id") val tiktok: String? = null,
@SerialName("twitter_id") val twitter: String? = null,
@SerialName("wikidata_id") val wikidata: String? = null,
@SerialName("youtube_id") val youtube: String? = null,
)

@Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ enum class TmdbReleaseType(val value: Int) {
TV(6);

companion object {
fun find(value: Int?) = values().find { it.value == value }
fun find(value: Int?) = entries.find { it.value == value }
}
}

Expand All @@ -56,7 +56,7 @@ enum class TmdbMovieStatus(val value: String) {
CANCELED("Canceled");

companion object {
fun find(value: String?) = values().find { it.value == value }
fun find(value: String?) = entries.find { it.value == value }
}
}

Expand Down
Loading
Loading