Skip to content

Commit

Permalink
Add TMDB department type to person
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisKruegerDev committed Mar 9, 2024
1 parent 0cbd2df commit a8f623c
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ data class TmdbPerson(
@SerialName("adult") val adult: Boolean,
@SerialName("gender") val gender: TmdbGender,
@SerialName("id") override val id: Int,
@SerialName("known_for_department") val knownForDepartment: String? = null,
@SerialName("known_for_department") val knownForDepartment: TmdbDepartment? = null,
@SerialName("name") override val name: String,
@SerialName("profile_path") override val profilePath: String? = null,
@SerialName("popularity") override val popularity: Float
Expand All @@ -104,7 +104,7 @@ data class TmdbPersonDetail(
@SerialName("homepage") val homepage: String? = null,
@SerialName("id") override val id: Int,
@SerialName("imdb_id") val imdbId: String? = null,
@SerialName("known_for_department") val knownForDepartment: String? = null,
@SerialName("known_for_department") val knownForDepartment: TmdbDepartment? = null,
@SerialName("name") override val name: String,
@SerialName("place_of_birth") val placeOfBirth: String? = null,
@SerialName("popularity") override val popularity: Float? = null,
Expand All @@ -123,7 +123,7 @@ data class TmdbCrew(
@SerialName("adult") val adult: Boolean = false,
@SerialName("gender") val gender: TmdbGender = TmdbGender.UNKNOWN,
@SerialName("id") override val id: Int,
@SerialName("known_for_department") val knownForDepartment: String? = null,
@SerialName("known_for_department") val knownForDepartment: TmdbDepartment? = null,
@SerialName("name") override val name: String,
@SerialName("original_name") val originalName: String? = null,
@SerialName("popularity") override val popularity: Float? = null,
Expand All @@ -138,7 +138,7 @@ data class TmdbCast(
@SerialName("adult") val adult: Boolean = false,
@SerialName("gender") val gender: TmdbGender,
@SerialName("id") override val id: Int,
@SerialName("known_for_department") val knownForDepartment: String? = null,
@SerialName("known_for_department") val knownForDepartment: TmdbDepartment? = null,
@SerialName("name") override val name: String,
@SerialName("original_name") val originalName: String? = null,
@SerialName("popularity") override val popularity: Float? = null,
Expand All @@ -154,7 +154,7 @@ data class TmdbAggregateCast(
@SerialName("adult") val adult: Boolean = false,
@SerialName("gender") val gender: TmdbGender,
@SerialName("id") val id: Int,
@SerialName("known_for_department") val knownForDepartment: String? = null,
@SerialName("known_for_department") val knownForDepartment: TmdbDepartment? = null,
@SerialName("name") val name: String,
@SerialName("original_name") val originalName: String? = null,
@SerialName("popularity") val popularity: Float? = null,
Expand All @@ -169,7 +169,7 @@ data class TmdbAggregateCrew(
@SerialName("adult") val adult: Boolean = false,
@SerialName("gender") val gender: TmdbGender,
@SerialName("id") override val id: Int,
@SerialName("known_for_department") val knownForDepartment: String? = null,
@SerialName("known_for_department") val knownForDepartment: TmdbDepartment? = null,
@SerialName("name") override val name: String,
@SerialName("original_name") val originalName: String? = null,
@SerialName("popularity") override val popularity: Float? = null,
Expand Down Expand Up @@ -236,7 +236,7 @@ data class TmdbImagePageResult(

@Serializable
data class TmdbTaggedMedia(
@SerialName("backdrop_path") val backdropPath: String?,
@SerialName("backdrop_path") val backdropPath: String? = null,
)

@Serializable
Expand Down Expand Up @@ -324,3 +324,51 @@ sealed interface TmdbPersonCredit : TmdbAnyItem, TmdbBackdropItem, TmdbPosterIte
@SerialName("job") override val job: String? = null,
) : TmdbPersonCredit
}


@Serializable
enum class TmdbDepartment(val value: String) {

@SerialName("Acting")
ACTING("Acting"),

@SerialName("Writing")
WRITING("Writing"),

@SerialName("Sound")
SOUND("Sound"),

@SerialName("Production")
PRODUCTION("Production"),

@SerialName("Art")
ART("Art"),

@SerialName("Directing")
DIRECTING("Directing"),

@SerialName("Creator")
CREATOR("Creator"),

@SerialName("Costume & Make-Up")
COSTUME_AND_MAKEUP("Costume & Make-Up"),

@SerialName("Camera")
CAMERA("Camera"),

@SerialName("Visual Effects")
VISUAL_EFFECTS("Visual Effects"),

@SerialName("Lighting")
LIGHTING("Lighting"),

@SerialName("Editing")
EDITING("Editing"),

@SerialName("Crew")
CREW("Crew");

companion object {
fun of(value: String?) = entries.find { it.value == value }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package app.moviebase.tmdb.api

import app.moviebase.tmdb.core.mockHttpClient
import app.moviebase.tmdb.model.AppendResponse
import app.moviebase.tmdb.model.TmdbDepartment
import app.moviebase.tmdb.model.TmdbGender
import app.moviebase.tmdb.model.TmdbGenre
import com.google.common.truth.Truth.assertThat
import kotlin.test.assertEquals
import kotlin.test.assertTrue
Expand Down Expand Up @@ -79,7 +79,7 @@ class TmdbPeopleApiTest {
assertEquals("https://www.unhcr.org/pages/49c3646c56.html", personDetail.homepage)
assertEquals(11701, personDetail.id)
assertEquals("nm0001401", personDetail.imdbId)
assertEquals("Acting", personDetail.knownForDepartment)
assertEquals(TmdbDepartment.ACTING, personDetail.knownForDepartment)
assertEquals("Angelina Jolie", personDetail.name)
assertEquals("Los Angeles, California, USA ", personDetail.placeOfBirth)
assertEquals(41.859f, personDetail.popularity)
Expand Down

0 comments on commit a8f623c

Please sign in to comment.