private async Task <SearchContainer <T> > GetAccountList <T>(int page, AccountSortBy sortBy, SortOrder sortOrder, string language, AccountListsMethods method) { RequireSessionId(SessionType.UserSession); RestRequest request = _client.Create("account/{accountId}/" + method.GetDescription()); request.AddUrlSegment("accountId", ActiveAccount.Id.ToString(CultureInfo.InvariantCulture)); AddSessionId(request, SessionType.UserSession); if (page > 1) { request.AddParameter("page", page.ToString()); } if (sortBy != AccountSortBy.Undefined) { request.AddParameter("sort_by", sortBy.GetDescription()); } if (sortOrder != SortOrder.Undefined) { request.AddParameter("sort_order", sortOrder.GetDescription()); } language = language ?? DefaultLanguage; if (!string.IsNullOrWhiteSpace(language)) { request.AddParameter("language", language); } SearchContainer <T> response = await request.ExecuteGet <SearchContainer <T> >().ConfigureAwait(false); return(response); }
private SearchContainer <T> GetAccountList <T>(int page, AccountSortBy sortBy, SortOrder sortOrder, string language, AccountListsMethods method) { RequireSessionId(SessionType.UserSession); RestRequest request = new RestRequest("account/{accountId}/{method}"); request.AddUrlSegment("accountId", ActiveAccount.Id.ToString(CultureInfo.InvariantCulture)); request.AddUrlSegment("method", method.GetDescription()); request.AddParameter("session_id", SessionId); if (page > 1) { request.AddParameter("page", page); } if (sortBy != AccountSortBy.Undefined) { request.AddParameter("sort_by", sortBy.GetDescription()); } if (sortOrder != SortOrder.Undefined) { request.AddParameter("sort_order", sortOrder.GetDescription()); } language = language ?? DefaultLanguage; if (!String.IsNullOrWhiteSpace(language)) { request.AddParameter("language", language); } IRestResponse <SearchContainer <T> > response = _client.Get <SearchContainer <T> >(request); return(response.Data); }
/// <summary> /// Get a list of all the tv show episodes rated by the current user /// </summary> /// <remarks>Requires a valid user session</remarks> /// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception> public SearchContainer <SearchTvEpisode> AccountGetRatedTvShowEpisodes( int page = 1, AccountSortBy sortBy = AccountSortBy.Undefined, SortOrder sortOrder = SortOrder.Undefined, string language = null) { return(GetAccountList <SearchTvEpisode>(page, sortBy, sortOrder, language, AccountListsMethods.RatedTvEpisodes)); }
/// <summary> /// Get a list of all the tv shows on the current users match list /// </summary> /// <remarks>Requires a valid user session</remarks> /// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception> public SearchContainer <SearchTv> AccountGetTvWatchlist( int page = 1, AccountSortBy sortBy = AccountSortBy.Undefined, SortOrder sortOrder = SortOrder.Undefined, string language = null) { return(GetAccountList <SearchTv>(page, sortBy, sortOrder, language, AccountListsMethods.TvWatchlist)); }
/// <summary> /// Get a list of all the movies marked as favorite by the current user /// </summary> /// <remarks>Requires a valid user session</remarks> /// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception> public SearchContainer <SearchMovie> AccountGetFavoriteMovies( int page = 1, AccountSortBy sortBy = AccountSortBy.Undefined, SortOrder sortOrder = SortOrder.Undefined, string language = null) { return(GetAccountList <SearchMovie>(page, sortBy, sortOrder, language, AccountListsMethods.FavoriteMovies)); }
/// <summary> /// Get a list of all the tv show episodes rated by the current user /// </summary> /// <remarks>Requires a valid user session</remarks> /// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception> public async Task <SearchContainer <SearchTvEpisode> > AccountGetRatedTvShowEpisodesAsync( int page = 1, AccountSortBy sortBy = AccountSortBy.Undefined, SortOrder sortOrder = SortOrder.Undefined, string language = null) { return(await GetAccountList <SearchTvEpisode>(page, sortBy, sortOrder, language, AccountListsMethods.RatedTvEpisodes).ConfigureAwait(false)); }
/// <summary> /// Get a list of all the movies marked as favorite by the current user /// </summary> /// <remarks>Requires a valid user session</remarks> /// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception> public async Task <SearchContainer <SearchMovie> > AccountGetFavoriteMoviesAsync( int page = 1, AccountSortBy sortBy = AccountSortBy.Undefined, SortOrder sortOrder = SortOrder.Undefined, string language = null) { return(await GetAccountList <SearchMovie>(page, sortBy, sortOrder, language, AccountListsMethods.FavoriteMovies).ConfigureAwait(false)); }
/// <summary> /// Get a list of all the tv shows on the current users match list /// </summary> /// <remarks>Requires a valid user session</remarks> /// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception> public async Task <SearchContainer <SearchTv> > AccountGetTvWatchlistAsync( int page = 1, AccountSortBy sortBy = AccountSortBy.Undefined, SortOrder sortOrder = SortOrder.Undefined, string language = null) { return(await GetAccountList <SearchTv>(page, sortBy, sortOrder, language, AccountListsMethods.TvWatchlist).ConfigureAwait(false)); }
/// <summary> /// Get a list of all the tv shows on the current users match list /// </summary> /// <remarks>Requires a valid user session</remarks> /// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception> public async Task <SearchContainer <SearchTv> > AccountGetTvWatchlistAsync( int page = 1, AccountSortBy sortBy = AccountSortBy.Undefined, SortOrder sortOrder = SortOrder.Undefined, string language = null, CancellationToken cancellationToken = default) { return(await GetAccountListInternal <SearchTv>(page, sortBy, sortOrder, language, AccountListsMethods.TvWatchlist, cancellationToken).ConfigureAwait(false)); }
/// <summary> /// Get a list of all the tv show episodes rated by the current user /// </summary> /// <remarks>Requires a valid user session</remarks> /// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception> public async Task <SearchContainer <AccountSearchTvEpisode> > AccountGetRatedTvShowEpisodesAsync( int page = 1, AccountSortBy sortBy = AccountSortBy.Undefined, SortOrder sortOrder = SortOrder.Undefined, string language = null, CancellationToken cancellationToken = default) { return(await GetAccountListInternal <AccountSearchTvEpisode>(page, sortBy, sortOrder, language, AccountListsMethods.RatedTvEpisodes, cancellationToken).ConfigureAwait(false)); }
/// <summary> /// Get a list of all the movies rated by the current user /// </summary> /// <remarks>Requires a valid user session</remarks> /// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception> public async Task <SearchContainer <SearchMovieWithRating> > AccountGetRatedMoviesAsync( int page = 1, AccountSortBy sortBy = AccountSortBy.Undefined, SortOrder sortOrder = SortOrder.Undefined, string language = null, CancellationToken cancellationToken = default(CancellationToken)) { return(await GetAccountList <SearchMovieWithRating>(page, sortBy, sortOrder, language, AccountListsMethods.RatedMovies, cancellationToken).ConfigureAwait(false)); }
/// <summary> /// Get a list of all the tv shows rated by the current user /// </summary> /// <remarks>Requires a valid user session</remarks> /// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception> public async Task <SearchContainer <SearchTv> > AccountGetRatedTvShows( int page = 1, AccountSortBy sortBy = AccountSortBy.Undefined, SortOrder sortOrder = SortOrder.Undefined, string language = null) { return(await GetAccountList <SearchTv>(page, sortBy, sortOrder, language, AccountListsMethods.RatedTv)); }
/// <summary> /// Get a list of all the movies on the current users match list /// </summary> /// <remarks>Requires a valid user session</remarks> /// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception> public async Task <SearchContainer <SearchMovie> > AccountGetMovieWatchlist( int page = 1, AccountSortBy sortBy = AccountSortBy.Undefined, SortOrder sortOrder = SortOrder.Undefined, string language = null) { return(await GetAccountList <SearchMovie>(page, sortBy, sortOrder, language, AccountListsMethods.MovieWatchlist)); }
public async Task <SearchContainer <AccountSearchTv> > AccountGetRatedTvShowsAsync(int page, AccountSortBy sortBy = AccountSortBy.Undefined, SortOrder sortOrder = SortOrder.Undefined, string language = null, CancellationToken cancellationToken = default) { return(await TMDbServiceClient.Instance.AccountGetRatedTvShowsAsync(page, sortBy, sortOrder, language, cancellationToken)); }
public async Task <SearchContainer <SearchMovie> > AccountGetMovieWatchlistAsync(int page, AccountSortBy sortBy = AccountSortBy.Undefined, SortOrder sortOrder = SortOrder.Undefined, string language = null, CancellationToken cancellationToken = default) { var results = await TMDbServiceClient.Instance.AccountGetMovieWatchlistAsync(page, sortBy, sortOrder, language, cancellationToken); return(results); }