mirror of
https://github.com/owenlejeune/TVTime.git
synced 2025-11-08 12:42:44 -05:00
clean up some v3 code
This commit is contained in:
@@ -9,12 +9,6 @@ interface AccountApi {
|
||||
@GET("account")
|
||||
suspend fun getAccountDetails(): Response<AccountDetails>
|
||||
|
||||
@GET("account/{id}/lists")
|
||||
suspend fun getLists(
|
||||
@Path("id") id: Int,
|
||||
@Query("page") page: Int
|
||||
): Response<AccountListResponse>
|
||||
|
||||
@GET("account/{id}/favorite/movies")
|
||||
suspend fun getFavoriteMovies(
|
||||
@Path("id") id: Int,
|
||||
@@ -27,7 +21,6 @@ interface AccountApi {
|
||||
@Query("page") page: Int
|
||||
): Response<FavoriteMediaResponse<FavoriteTvSeries>>
|
||||
|
||||
// @Headers("Content-Type: application/json;charset=utf-8")
|
||||
@POST("account/{id}/favorite")
|
||||
suspend fun markAsFavorite(
|
||||
@Path("id") id: Int,
|
||||
@@ -64,7 +57,6 @@ interface AccountApi {
|
||||
@Query("page") page: Int
|
||||
): Response<WatchlistResponse<WatchlistTvSeries>>
|
||||
|
||||
// @Headers("Content-Type: application/json;charset=utf-8")
|
||||
@POST("account/{id}/watchlist")
|
||||
suspend fun addToWatchlist(
|
||||
@Path("id") id: Int,
|
||||
|
||||
@@ -12,10 +12,6 @@ class AccountService {
|
||||
return accountService.getAccountDetails()
|
||||
}
|
||||
|
||||
suspend fun getLists(accountId: Int, page: Int = 1): Response<AccountListResponse> {
|
||||
return accountService.getLists(accountId, page)
|
||||
}
|
||||
|
||||
suspend fun getFavoriteMovies(accountId: Int, page: Int = 1): Response<FavoriteMediaResponse<FavoriteMovie>> {
|
||||
return accountService.getFavoriteMovies(accountId, page)
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.owenlejeune.tvtime.api.tmdb.api.v3.model
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
class AccountList(
|
||||
@SerializedName("description") val description: String,
|
||||
@SerializedName("favorite_count") val favoriteCount: Int,
|
||||
@SerializedName("id") val id: Int,
|
||||
@SerializedName("item_count") val itemCount: Int,
|
||||
@SerializedName("iso_639_1") val languageCode: String,
|
||||
@SerializedName("list_type") val listType: String, // media type
|
||||
@SerializedName("name") val name: String
|
||||
)
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.owenlejeune.tvtime.api.tmdb.api.v3.model
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
class AccountListResponse(
|
||||
@SerializedName("page") val page: Int,
|
||||
@SerializedName("total_pages") val totalPages: Int,
|
||||
@SerializedName("total_results") val totalResults: Int,
|
||||
@SerializedName("results") val results: List<AccountList>
|
||||
)
|
||||
@@ -4,8 +4,8 @@ import com.owenlejeune.tvtime.api.tmdb.api.v3.model.FavoriteMovie
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v3.model.FavoriteTvSeries
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.RecommendedMovie
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.RecommendedTv
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.V4AccountList
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.V4AccountResponse
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.AccountList
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.AccountResponse
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.V4RatedMovie
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.V4RatedTv
|
||||
import retrofit2.Response
|
||||
@@ -16,35 +16,35 @@ import retrofit2.http.Query
|
||||
interface AccountV4Api {
|
||||
|
||||
@GET("account/{account_id}/lists")
|
||||
suspend fun getLists(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<V4AccountResponse<V4AccountList>>
|
||||
suspend fun getLists(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<AccountResponse<AccountList>>
|
||||
|
||||
@GET("account/{account_id}/movie/favorites")
|
||||
suspend fun getFavoriteMovies(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<V4AccountResponse<FavoriteMovie>>
|
||||
suspend fun getFavoriteMovies(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<AccountResponse<FavoriteMovie>>
|
||||
|
||||
@GET("account/{account_id}/tv/favorites")
|
||||
suspend fun getFavoriteTvShows(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<V4AccountResponse<FavoriteTvSeries>>
|
||||
suspend fun getFavoriteTvShows(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<AccountResponse<FavoriteTvSeries>>
|
||||
|
||||
@GET("account/{account_id}/movie/recommendations")
|
||||
suspend fun getMovieRecommendations(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<V4AccountResponse<FavoriteMovie>>
|
||||
suspend fun getMovieRecommendations(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<AccountResponse<FavoriteMovie>>
|
||||
|
||||
@GET("account/{account_id}/tv/recommendations")
|
||||
suspend fun getTvShowRecommendations(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<V4AccountResponse<FavoriteTvSeries>>
|
||||
suspend fun getTvShowRecommendations(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<AccountResponse<FavoriteTvSeries>>
|
||||
|
||||
@GET("account/{account_id}/movie/watchlist")
|
||||
suspend fun getMovieWatchlist(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<V4AccountResponse<FavoriteMovie>>
|
||||
suspend fun getMovieWatchlist(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<AccountResponse<FavoriteMovie>>
|
||||
|
||||
@GET("account/{account_id}/tv/watchlist")
|
||||
suspend fun getTvShowWatchlist(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<V4AccountResponse<FavoriteTvSeries>>
|
||||
suspend fun getTvShowWatchlist(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<AccountResponse<FavoriteTvSeries>>
|
||||
|
||||
@GET("account/{account_id}/movie/rated")
|
||||
suspend fun getRatedMovies(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<V4AccountResponse<V4RatedMovie>>
|
||||
suspend fun getRatedMovies(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<AccountResponse<V4RatedMovie>>
|
||||
|
||||
@GET("account/{account_id}/tv/rated")
|
||||
suspend fun getRatedTvShows(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<V4AccountResponse<V4RatedTv>>
|
||||
suspend fun getRatedTvShows(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<AccountResponse<V4RatedTv>>
|
||||
|
||||
@GET("account/{account_id}/movie/recommendations")
|
||||
suspend fun getRecommendedMovies(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<V4AccountResponse<RecommendedMovie>>
|
||||
suspend fun getRecommendedMovies(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<AccountResponse<RecommendedMovie>>
|
||||
|
||||
@GET("account/{account_id}/tv/recommendations")
|
||||
suspend fun getRecommendedTvSeries(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<V4AccountResponse<RecommendedTv>>
|
||||
suspend fun getRecommendedTvSeries(@Path("account_id") accountId: String, @Query("page") page: Int = 1): Response<AccountResponse<RecommendedTv>>
|
||||
}
|
||||
@@ -5,8 +5,8 @@ import com.owenlejeune.tvtime.api.tmdb.api.v3.model.FavoriteMovie
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v3.model.FavoriteTvSeries
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.RecommendedMovie
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.RecommendedTv
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.V4AccountList
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.V4AccountResponse
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.AccountList
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.AccountResponse
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.V4RatedMovie
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.V4RatedTv
|
||||
import retrofit2.Response
|
||||
@@ -15,47 +15,47 @@ class AccountV4Service {
|
||||
|
||||
private val service by lazy { TmdbClient().createV4AccountService() }
|
||||
|
||||
suspend fun getLists(accountId: String, page: Int = 1): Response<V4AccountResponse<V4AccountList>> {
|
||||
suspend fun getLists(accountId: String, page: Int = 1): Response<AccountResponse<AccountList>> {
|
||||
return service.getLists(accountId, page)
|
||||
}
|
||||
|
||||
suspend fun getFavoriteMovies(accountId: String, page: Int = 1): Response<V4AccountResponse<FavoriteMovie>> {
|
||||
suspend fun getFavoriteMovies(accountId: String, page: Int = 1): Response<AccountResponse<FavoriteMovie>> {
|
||||
return service.getFavoriteMovies(accountId, page)
|
||||
}
|
||||
|
||||
suspend fun getFavoriteTvShows(accountId: String, page: Int = 1): Response<V4AccountResponse<FavoriteTvSeries>> {
|
||||
suspend fun getFavoriteTvShows(accountId: String, page: Int = 1): Response<AccountResponse<FavoriteTvSeries>> {
|
||||
return service.getFavoriteTvShows(accountId, page)
|
||||
}
|
||||
|
||||
suspend fun getMovieRecommendations(accountId: String, page: Int = 1): Response<V4AccountResponse<FavoriteMovie>> {
|
||||
suspend fun getMovieRecommendations(accountId: String, page: Int = 1): Response<AccountResponse<FavoriteMovie>> {
|
||||
return service.getMovieRecommendations(accountId, page)
|
||||
}
|
||||
|
||||
suspend fun getTvShowRecommendations(accountId: String, page: Int = 1): Response<V4AccountResponse<FavoriteTvSeries>> {
|
||||
suspend fun getTvShowRecommendations(accountId: String, page: Int = 1): Response<AccountResponse<FavoriteTvSeries>> {
|
||||
return service.getTvShowRecommendations(accountId, page)
|
||||
}
|
||||
|
||||
suspend fun getMovieWatchlist(accountId: String, page: Int = 1): Response<V4AccountResponse<FavoriteMovie>> {
|
||||
suspend fun getMovieWatchlist(accountId: String, page: Int = 1): Response<AccountResponse<FavoriteMovie>> {
|
||||
return service.getMovieWatchlist(accountId, page)
|
||||
}
|
||||
|
||||
suspend fun getTvShowWatchlist(accountId: String, page: Int = 1): Response<V4AccountResponse<FavoriteTvSeries>> {
|
||||
suspend fun getTvShowWatchlist(accountId: String, page: Int = 1): Response<AccountResponse<FavoriteTvSeries>> {
|
||||
return service.getTvShowWatchlist(accountId, page)
|
||||
}
|
||||
|
||||
suspend fun getRatedMovies(accountId: String, page: Int = 1): Response<V4AccountResponse<V4RatedMovie>> {
|
||||
suspend fun getRatedMovies(accountId: String, page: Int = 1): Response<AccountResponse<V4RatedMovie>> {
|
||||
return service.getRatedMovies(accountId, page)
|
||||
}
|
||||
|
||||
suspend fun getRatedTvShows(accountId: String, page: Int = 1): Response<V4AccountResponse<V4RatedTv>> {
|
||||
suspend fun getRatedTvShows(accountId: String, page: Int = 1): Response<AccountResponse<V4RatedTv>> {
|
||||
return service.getRatedTvShows(accountId, page)
|
||||
}
|
||||
|
||||
suspend fun getRecommendedMovies(accountId: String, page: Int = 1): Response<V4AccountResponse<RecommendedMovie>> {
|
||||
suspend fun getRecommendedMovies(accountId: String, page: Int = 1): Response<AccountResponse<RecommendedMovie>> {
|
||||
return service.getRecommendedMovies(accountId, page)
|
||||
}
|
||||
|
||||
suspend fun getRecommendedTvSeries(accountId: String, page: Int): Response<V4AccountResponse<RecommendedTv>> {
|
||||
suspend fun getRecommendedTvSeries(accountId: String, page: Int): Response<AccountResponse<RecommendedTv>> {
|
||||
return service.getRecommendedTvSeries(accountId, page)
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.owenlejeune.tvtime.api.tmdb.api.v4.model
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
class V4AccountList(
|
||||
class AccountList(
|
||||
@SerializedName("iso_639_1") val languageCode: String,
|
||||
@SerializedName("id") val id: Int,
|
||||
@SerializedName("featured") val featured: Int,
|
||||
@@ -2,7 +2,7 @@ package com.owenlejeune.tvtime.api.tmdb.api.v4.model
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
class V4AccountResponse<T>(
|
||||
class AccountResponse<T>(
|
||||
@SerializedName("page") val page: Int,
|
||||
@SerializedName("total_results") val totalResults: Int,
|
||||
@SerializedName("total_pages") val totalPages: Int,
|
||||
@@ -10,7 +10,7 @@ import com.owenlejeune.tvtime.api.tmdb.api.v3.model.RatedMovie
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v3.model.RatedTv
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v3.model.WatchlistMovie
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v3.model.WatchlistTvSeries
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.V4AccountList
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.AccountList
|
||||
import com.owenlejeune.tvtime.ui.screens.main.AccountTabContent
|
||||
import com.owenlejeune.tvtime.ui.screens.main.MediaViewType
|
||||
import com.owenlejeune.tvtime.ui.screens.main.RecommendedAccountTabContent
|
||||
@@ -123,7 +123,7 @@ sealed class AccountTabNavItem(
|
||||
MediaViewType.LIST,
|
||||
screenContent,
|
||||
{ SessionManager.currentSession.value?.accountLists ?: emptyList() },
|
||||
V4AccountList::class,
|
||||
AccountList::class,
|
||||
7
|
||||
)
|
||||
|
||||
@@ -134,7 +134,7 @@ sealed class AccountTabNavItem(
|
||||
MediaViewType.MOVIE,
|
||||
recommendedScreenContent,
|
||||
{ emptyList() },
|
||||
V4AccountList::class,
|
||||
AccountList::class,
|
||||
8
|
||||
)
|
||||
|
||||
@@ -145,7 +145,7 @@ sealed class AccountTabNavItem(
|
||||
MediaViewType.TV,
|
||||
recommendedScreenContent,
|
||||
{ emptyList() },
|
||||
V4AccountList::class,
|
||||
AccountList::class,
|
||||
9
|
||||
)
|
||||
}
|
||||
|
||||
@@ -29,13 +29,11 @@ import com.google.accompanist.pager.rememberPagerState
|
||||
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||
import com.owenlejeune.tvtime.R
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v3.model.*
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.V4AccountList
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.AccountList
|
||||
import com.owenlejeune.tvtime.api.tmdb.viewmodel.RecommendedMediaViewModel
|
||||
import com.owenlejeune.tvtime.extensions.unlessEmpty
|
||||
import com.owenlejeune.tvtime.ui.components.AccountIcon
|
||||
import com.owenlejeune.tvtime.ui.components.PagingPosterGrid
|
||||
import com.owenlejeune.tvtime.ui.components.ProfileMenuContainer
|
||||
import com.owenlejeune.tvtime.ui.components.ProfileMenuOverlay
|
||||
import com.owenlejeune.tvtime.ui.navigation.AccountTabNavItem
|
||||
import com.owenlejeune.tvtime.ui.navigation.ListFetchFun
|
||||
import com.owenlejeune.tvtime.ui.navigation.MainNavItem
|
||||
@@ -256,8 +254,8 @@ fun <T: Any> AccountTabContent(
|
||||
description = item.overview
|
||||
)
|
||||
}
|
||||
V4AccountList::class -> {
|
||||
val item = contentItems[i] as V4AccountList
|
||||
AccountList::class -> {
|
||||
val item = contentItems[i] as AccountList
|
||||
MediaItemRow(
|
||||
appNavController = appNavController,
|
||||
mediaViewType = mediaViewType,
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.owenlejeune.tvtime.api.tmdb.api.v4.AuthenticationV4Service
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.AuthAccessBody
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.AuthDeleteBody
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.AuthRequestBody
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.V4AccountList
|
||||
import com.owenlejeune.tvtime.api.tmdb.api.v4.model.AccountList
|
||||
import com.owenlejeune.tvtime.preferences.AppPreferences
|
||||
import com.owenlejeune.tvtime.ui.screens.main.MediaViewType
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
@@ -156,7 +156,7 @@ object SessionManager: KoinComponent {
|
||||
// protected open var _accountLists: List<V4AccountList> = emptyList()
|
||||
// val accountLists: List<V4AccountList>
|
||||
// get() = _accountLists
|
||||
val accountLists = mutableStateListOf<V4AccountList>()
|
||||
val accountLists = mutableStateListOf<AccountList>()
|
||||
|
||||
// protected open var _favoriteMovies: List<FavoriteMovie> = emptyList()
|
||||
// val favoriteMovies: List<FavoriteMovie>
|
||||
|
||||
Reference in New Issue
Block a user