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

Feature Movie/Show trailers #115

Merged
merged 12 commits into from
Sep 23, 2024
Next Next commit
#107 Add Videos API
  • Loading branch information
hadi-norouzi committed Sep 23, 2024
commit 4d18c5982673cbe15fe7f0779e99a23c8a2e5246
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.filmtime.data.network

import io.filmtime.data.network.adapter.NetworkResponse
import io.filmtime.data.network.model.TmdbVideosResponse
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Query
Expand Down Expand Up @@ -47,4 +48,9 @@ interface TmdbMoviesService {
suspend fun getSimilar(
@Path("movie_id") movieId: Int,
): NetworkResponse<TmdbVideoListResponse, TmdbErrorResponse>

@GET("movie/{movie_id}/videos")
suspend fun getMovieVideos(
@Path("movie_id") movieId: Int,
): NetworkResponse<TmdbVideosResponse, TmdbErrorResponse>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package io.filmtime.data.network.model

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class TmdbVideosResponse(
val id: Long,
val results: List<VideoData>,
)

@Serializable
data class VideoData(
@SerialName("iso_639_1")
val iso639_1: String,
@SerialName("iso_3166_1")
val iso3166_1: String,
val name: String,
val key: String,
val site: Site,
val size: Long,
val type: Type,
val official: Boolean,
@SerialName("published_at")
val publishedAt: String,
val id: String,
)

@Serializable
enum class Site(val value: String) {
@SerialName("YouTube")
YouTube("YouTube"),
}

@Serializable
enum class Type(val value: String) {
@SerialName("Behind the Scenes")
BehindTheScenes("Behind the Scenes"),

@SerialName("Clip")
Clip("Clip"),

@SerialName("Featurette")
Featurette("Featurette"),

@SerialName("Teaser")
Teaser("Teaser"),

@SerialName("Trailer")
Trailer("Trailer"),
}