|
|
|
@ -1,10 +1,8 @@
|
|
|
|
|
package fr.iut.pm.movieapplication.api
|
|
|
|
|
|
|
|
|
|
import fr.iut.pm.movieapplication.api.dtos.MovieDTO
|
|
|
|
|
import fr.iut.pm.movieapplication.api.dtos.MovieDetailsDTO
|
|
|
|
|
import fr.iut.pm.movieapplication.api.dtos.PopularDTO
|
|
|
|
|
import fr.iut.pm.movieapplication.api.dtos.ResultDTO
|
|
|
|
|
import fr.iut.pm.movieapplication.utils.Constants.Companion.API_KEY
|
|
|
|
|
import retrofit2.Call
|
|
|
|
|
import retrofit2.Response
|
|
|
|
|
import retrofit2.http.GET
|
|
|
|
|
import retrofit2.http.Path
|
|
|
|
@ -14,16 +12,16 @@ interface MovieApplicationAPI {
|
|
|
|
|
|
|
|
|
|
// Movie
|
|
|
|
|
@GET("movie/popular")
|
|
|
|
|
suspend fun getPopularMovies(@Query("api_key") apiKey : String = API_KEY, @Query("language") language : String = "fr", @Query("page") page : Int = 1) : Response<PopularDTO>
|
|
|
|
|
suspend fun getPopularMovies(@Query("api_key") apiKey : String = API_KEY, @Query("language") language : String = "fr", @Query("page") page : Int = 1) : Response<ResultDTO>
|
|
|
|
|
|
|
|
|
|
@GET("movie/now_playing")
|
|
|
|
|
suspend fun getNowPlayingMovies(@Query("api_key") apiKey : String = API_KEY, @Query("language") language : String = "fr", @Query("page") page : Int = 1) : Response<PopularDTO>
|
|
|
|
|
suspend fun getNowPlayingMovies(@Query("api_key") apiKey : String = API_KEY, @Query("language") language : String = "fr", @Query("page") page : Int = 1) : Response<ResultDTO>
|
|
|
|
|
|
|
|
|
|
@GET("movie/upcoming")
|
|
|
|
|
suspend fun getUpcomingMovies(@Query("api_key") apiKey: String = API_KEY, @Query("language") language : String = "fr", @Query("page") page : Int = 1) : Response<PopularDTO>
|
|
|
|
|
suspend fun getUpcomingMovies(@Query("api_key") apiKey: String = API_KEY, @Query("language") language : String = "fr", @Query("page") page : Int = 1) : Response<ResultDTO>
|
|
|
|
|
|
|
|
|
|
@GET("movie/top_rated")
|
|
|
|
|
suspend fun getTopRatedMovies(@Query("api_key") apiKey: String = API_KEY, @Query("language") language : String = "fr", @Query("page") page : Int = 1) : Response<PopularDTO>
|
|
|
|
|
suspend fun getTopRatedMovies(@Query("api_key") apiKey: String = API_KEY, @Query("language") language : String = "fr", @Query("page") page : Int = 1) : Response<ResultDTO>
|
|
|
|
|
|
|
|
|
|
// Movie details
|
|
|
|
|
@GET("movie/{movie_id}")
|
|
|
|
@ -32,18 +30,26 @@ interface MovieApplicationAPI {
|
|
|
|
|
|
|
|
|
|
// TvShow
|
|
|
|
|
@GET("tv/popular")
|
|
|
|
|
suspend fun getPopularTvShows(@Query("api_key") apiKey : String = API_KEY, @Query("language") language : String = "fr", @Query("page") page : Int = 1) : Response<PopularDTO>
|
|
|
|
|
suspend fun getPopularTvShows(@Query("api_key") apiKey : String = API_KEY, @Query("language") language : String = "fr", @Query("page") page : Int = 1) : Response<ResultDTO>
|
|
|
|
|
@GET("tv/airing_today")
|
|
|
|
|
suspend fun getAiringTodayTvShows(@Query("api_key") apiKey: String = API_KEY, @Query("language") language : String = "fr", @Query("page") page : Int = 1) : Response<PopularDTO>
|
|
|
|
|
suspend fun getAiringTodayTvShows(@Query("api_key") apiKey: String = API_KEY, @Query("language") language : String = "fr", @Query("page") page : Int = 1) : Response<ResultDTO>
|
|
|
|
|
@GET("tv/on_the_air")
|
|
|
|
|
suspend fun getTvOnTheAirTvShows(@Query("api_key") apiKey: String = API_KEY, @Query("language") language : String = "fr", @Query("page") page : Int = 1) : Response<PopularDTO>
|
|
|
|
|
suspend fun getTvOnTheAirTvShows(@Query("api_key") apiKey: String = API_KEY, @Query("language") language : String = "fr", @Query("page") page : Int = 1) : Response<ResultDTO>
|
|
|
|
|
@GET("tv/top_rated")
|
|
|
|
|
suspend fun getTopRatedTvShows(@Query("api_key") apiKey: String = API_KEY, @Query("language") language : String = "fr", @Query("page") page : Int = 1) : Response<PopularDTO>
|
|
|
|
|
suspend fun getTopRatedTvShows(@Query("api_key") apiKey: String = API_KEY, @Query("language") language : String = "fr", @Query("page") page : Int = 1) : Response<ResultDTO>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GET("trending/{media_type}/{time_window}")
|
|
|
|
|
suspend fun getTrending(@Path("media_type") mediaType : String = "all", @Path("time_window") timeWindow : String = "day", @Query("api_key") apiKey: String = API_KEY ) : Response<PopularDTO>
|
|
|
|
|
|
|
|
|
|
suspend fun getTrending(@Path("media_type") mediaType : String = "all", @Path("time_window") timeWindow : String = "day", @Query("api_key") apiKey: String = API_KEY ) : Response<ResultDTO>
|
|
|
|
|
|
|
|
|
|
@GET("search/multi")
|
|
|
|
|
suspend fun searchMedia(
|
|
|
|
|
@Query("query") query: String,
|
|
|
|
|
@Query("page") page: Int = 1,
|
|
|
|
|
@Query("api_key") apiKey: String = API_KEY,
|
|
|
|
|
@Query("language") language: String = "fr",
|
|
|
|
|
@Query("include_adult") includeAdult: Boolean = true
|
|
|
|
|
): Response<ResultDTO>
|
|
|
|
|
|
|
|
|
|
@GET("tv/{tv_id}")
|
|
|
|
|
fun getShowDetails(@Path("tv_id") tvId : Int, @Query("api_key") apiKey: String = API_KEY)
|
|
|
|
|