Beispiel #1
0
 public async Task <TraktPaginationListResult <TraktMostCollectedMovie> > GetMostCollectedMoviesAsync(TraktTimePeriod period         = null,
                                                                                                      TraktExtendedInfo extendedInfo = null,
                                                                                                      TraktMovieFilter filter        = null,
                                                                                                      int?page = null, int?limitPerPage = null)
 => await QueryAsync(new TraktMoviesMostCollectedRequest(Client)
 {
     Period            = period,
     ExtendedInfo      = extendedInfo,
     Filter            = filter,
     PaginationOptions = new TraktPaginationOptions(page, limitPerPage)
 });
Beispiel #2
0
 public async Task <TraktPaginationListResult <TraktShow> > GetShowRecommendationsAsync(int?limit = null,
                                                                                        TraktExtendedInfo extendedInfo = null)
 => await QueryAsync(new TraktUserShowRecommendationsRequest(Client)
 {
     PaginationOptions = new TraktPaginationOptions(null, limit),
     ExtendedInfo      = extendedInfo
 });
Beispiel #3
0
        public async Task <TraktCastAndCrew> GetShowPeopleAsync([NotNull] string showIdOrSlug, TraktExtendedInfo extendedInfo = null)
        {
            Validate(showIdOrSlug);

            return(await QueryAsync(new TraktShowPeopleRequest(Client)
            {
                Id = showIdOrSlug,
                ExtendedInfo = extendedInfo
            }));
        }
Beispiel #4
0
        public async Task <IEnumerable <TraktUser> > GetShowWatchingUsersAsync([NotNull] string showIdOrSlug, TraktExtendedInfo extendedInfo = null)
        {
            Validate(showIdOrSlug);

            return(await QueryAsync(new TraktShowWatchingUsersRequest(Client) { Id = showIdOrSlug, ExtendedInfo = extendedInfo }));
        }
Beispiel #5
0
        /// <summary>
        /// Gets the top 10 box office movies.
        /// <para>OAuth authorization not required.</para>
        /// <para>
        /// See <a href="http://docs.trakt.apiary.io/#reference/movies/box-office/get-the-weekend-box-office">"Trakt API Doc - Movies: Box Office"</a> for more information.
        /// </para>
        /// </summary>
        /// <param name="extendedInfo">
        /// The extended info, which determines how much data about the movies should be queried.
        /// See also <seealso cref="TraktExtendedInfo" />.
        /// </param>
        /// <param name="cancellationToken"></param>
        /// <returns>A list of <see cref="ITraktBoxOfficeMovie" /> instances.</returns>
        /// <exception cref="TraktException">Thrown, if the request fails.</exception>
        public Task <TraktListResponse <ITraktBoxOfficeMovie> > GetBoxOfficeMoviesAsync(TraktExtendedInfo extendedInfo      = null,
                                                                                        CancellationToken cancellationToken = default)
        {
            var requestHandler = new RequestHandler(Client);

            return(requestHandler.ExecuteListRequestAsync(new MoviesBoxOfficeRequest
            {
                ExtendedInfo = extendedInfo
            },
                                                          cancellationToken));
        }
Beispiel #6
0
        /// <summary>
        /// Looks up items by their Trakt-, IMDB-, TMDB-, TVDB- or TVRage-Id.
        /// <para>OAuth authorization not required.</para>
        /// <para>
        /// See <a href="http://docs.trakt.apiary.io/#reference/search/text-query/get-id-lookup-results">"Trakt API Doc - Search: Id Lookup"</a> for more information.
        /// </para>
        /// </summary>
        /// <param name="searchIdType">The id type, which should be looked up. See also <seealso cref="TraktSearchIdType" />.</param>
        /// <param name="lookupId">The Trakt-, IMDB-, TMDB-, TVDB- or TVRage-Id, which will be looked up.</param>
        /// <param name="searchResultTypes">The object type(s), which will be looked up. See also <seealso cref="TraktSearchResultType" />.</param>
        /// <param name="extendedInfo">
        /// The extended info, which determines how much data about the lookup object(s) should be queried.
        /// See also <seealso cref="TraktExtendedInfo" />.
        /// </param>
        /// <param name="pagedParameters"></param>
        /// <param name="cancellationToken"></param>
        /// <returns>
        /// An <see cref="TraktPagedResponse{ITraktSearchResult}"/> instance containing the found movies, shows, episodes, people and / or lists and which also
        /// contains the queried page number, the page's item count, maximum page count and maximum item count.
        /// <para>
        /// See also <seealso cref="TraktPagedResponse{ListItem}" /> and <seealso cref="ITraktSearchResult" />.
        /// </para>
        /// </returns>
        /// <exception cref="TraktException">Thrown, if the request fails.</exception>
        /// <exception cref="ArgumentException">
        /// Thrown, if the given lookupId is null, empty or contains spaces.
        /// Thrown, if the given searchIdType is unspecified.
        /// </exception>
        /// <exception cref="ArgumentNullException">Thrown, if the given searchIdType is null.</exception>
        public Task <TraktPagedResponse <ITraktSearchResult> > GetIdLookupResultsAsync(TraktSearchIdType searchIdType, string lookupId,
                                                                                       TraktSearchResultType searchResultTypes = null,
                                                                                       TraktExtendedInfo extendedInfo          = null,
                                                                                       TraktPagedParameters pagedParameters    = null,
                                                                                       CancellationToken cancellationToken     = default)
        {
            var requestHandler = new RequestHandler(Client);

            return(requestHandler.ExecutePagedRequestAsync(new SearchIdLookupRequest
            {
                IdType = searchIdType,
                LookupId = lookupId,
                ResultTypes = searchResultTypes,
                ExtendedInfo = extendedInfo,
                Page = pagedParameters?.Page,
                Limit = pagedParameters?.Limit
            },
                                                           cancellationToken));
        }
Beispiel #7
0
        /// <summary>
        /// Gets all shows where a person with the given Trakt-Id or -Slug is in the cast or crew.
        /// <para>OAuth authorization not required.</para>
        /// <para>
        /// See <a href="http://docs.trakt.apiary.io/#reference/people/shows/get-show-credits">"Trakt API Doc - People: Shows"</a> for more information.
        /// </para>
        /// </summary>
        /// <param name="personIdOrSlug">The Trakt-Id or -Slug of the person, for which the shows should be queried.</param>
        /// <param name="extendedInfo">
        /// The extended info, which determines how much data about the shows should be queried.
        /// See also <seealso cref="TraktExtendedInfo" />.
        /// </param>
        /// <param name="cancellationToken">
        /// Propagates notification that the request should be canceled.<para/>
        /// If provided, the exception <see cref="OperationCanceledException" /> should be catched.
        /// </param>
        /// <returns>An <see cref="ITraktPersonShowCredits" /> instance with the queried person's show credits.</returns>
        /// <exception cref="TraktException">Thrown, if the request fails.</exception>
        /// <exception cref="ArgumentException">Thrown, if the given personIdOrSlug is null, empty or contains spaces.</exception>
        public Task <TraktResponse <ITraktPersonShowCredits> > GetPersonShowCreditsAsync(string personIdOrSlug, TraktExtendedInfo extendedInfo = null,
                                                                                         CancellationToken cancellationToken = default)
        {
            var requestHandler = new RequestHandler(Client);

            return(requestHandler.ExecuteSingleItemRequestAsync(new PersonShowCreditsRequest
            {
                Id = personIdOrSlug,
                ExtendedInfo = extendedInfo
            },
                                                                cancellationToken));
        }
Beispiel #8
0
        /// <summary>
        /// Gets a <see cref="ITraktMovie" /> with the given Trakt-Id or -Slug.
        /// <para>OAuth authorization not required.</para>
        /// <para>
        /// See <a href="http://docs.trakt.apiary.io/#reference/movies/summary/get-a-movie">"Trakt API Doc - Movies: Summary"</a> for more information.
        /// </para>
        /// <para>See also <seealso cref="GetMultipleMoviesAsync(TraktMultipleObjectsQueryParams, CancellationToken)" />.</para>
        /// </summary>
        /// <param name="movieIdOrSlug">The movie's Trakt-Id or -Slug. See also <seealso cref="ITraktMovieIds" />.</param>
        /// <param name="extendedInfo">
        /// The extended info, which determines how much data about the movie should be queried.
        /// See also <seealso cref="TraktExtendedInfo" />.
        /// </param>
        /// <param name="cancellationToken"></param>
        /// <returns>An <see cref="ITraktMovie" /> instance with the queried movie's data.</returns>
        /// <exception cref="TraktException">Thrown, if the request fails.</exception>
        /// <exception cref="ArgumentException">Thrown, if the given movieIdOrSlug is null, empty or contains spaces.</exception>
        public Task <TraktResponse <ITraktMovie> > GetMovieAsync(string movieIdOrSlug, TraktExtendedInfo extendedInfo = null,
                                                                 CancellationToken cancellationToken = default)
        {
            var requestHandler = new RequestHandler(Client);

            return(requestHandler.ExecuteSingleItemRequestAsync(new MovieSummaryRequest
            {
                Id = movieIdOrSlug,
                ExtendedInfo = extendedInfo
            },
                                                                cancellationToken));
        }
        // -------------------------------------------------------------
        // Box Office Movies

        public async Task <ObservableCollection <BoxOfficeMovie> > GetBoxOfficeMoviesAsync(TraktExtendedInfo extendedInfo = null)
        {
            var traktResults = await Client.Movies.GetBoxOfficeMoviesAsync(extendedInfo);

            var results = new ObservableCollection <BoxOfficeMovie>();
            var count   = 1;

            foreach (var traktBoxOfficeMovie in traktResults)
            {
                var boxOfficeMovie = MovieModelConverter.Convert <BoxOfficeMovie>(traktBoxOfficeMovie.Movie);

                if (boxOfficeMovie != null)
                {
                    boxOfficeMovie.Nr      = count++;
                    boxOfficeMovie.Revenue = traktBoxOfficeMovie.Revenue.GetValueOrDefault();
                    results.Add(boxOfficeMovie);
                }
            }

            return(results);
        }
        /// <summary>
        /// Gets an user's personal recommendations for movies and / or shows.
        /// <para>OAuth authorization required.</para>
        /// <para>
        /// See <a href="https://trakt.docs.apiary.io/#reference/sync/get-personal-recommendations/get-personal-recommendations">"Trakt API Doc - Sync: Personal Recommendations"</a> for more information.
        /// </para>
        /// </summary>
        /// <param name="recommendationObjectType">Determines, which type of recommendation items should be queried. See also <seealso cref="TraktRecommendationObjectType" />.</param>
        /// <param name="sortOrder">
        /// The recommendations sort order. See also <seealso cref="TraktWatchlistSortOrder" />.
        /// Will be ignored, if the given array contains a number higher than 10 or below 1 or if it contains more than ten numbers.
        /// Will be ignored, if the given <paramref name="recommendationObjectType" /> is null or unspecified.
        /// </param>
        /// <param name="extendedInfo">
        /// The extended info, which determines how much data about the recommendation items should be queried.
        /// See also <seealso cref="TraktExtendedInfo" />.
        /// </param>
        /// <param name="pagedParameters">Specifies pagination parameters. <see cref="TraktPagedParameters" />.</param>
        /// <param name="cancellationToken">
        /// Propagates notification that the request should be canceled.<para/>
        /// If provided, the exception <see cref="OperationCanceledException" /> should be catched.
        /// </param>
        /// <returns>A list of <see cref="ITraktRecommendation" /> instances.</returns>
        /// <exception cref="TraktException">Thrown, if the request fails.</exception>
        public Task <TraktPagedResponse <ITraktRecommendation> > GetPersonalRecommendationsAsync(TraktRecommendationObjectType recommendationObjectType = null,
                                                                                                 TraktWatchlistSortOrder sortOrder    = null, TraktExtendedInfo extendedInfo      = null,
                                                                                                 TraktPagedParameters pagedParameters = null, CancellationToken cancellationToken = default)
        {
            var requestHandler = new RequestHandler(Client);

            return(requestHandler.ExecutePagedRequestAsync(new SyncPersonalRecommendationsRequest
            {
                Type = recommendationObjectType,
                Sort = sortOrder,
                ExtendedInfo = extendedInfo,
                Page = pagedParameters?.Page,
                Limit = pagedParameters?.Limit
            },
                                                           cancellationToken));
        }
        // -------------------------------------------------------------
        // Most Collected Movies

        public async Task <PaginationList <MostPWCMovie> > GetMostCollectedMoviesAsync(TraktExtendedInfo extendedInfo = null,
                                                                                       TraktMovieFilter movieFilter   = null,
                                                                                       TraktTimePeriod period         = null,
                                                                                       int?whichPage = null, int?limitPerPage = null)
        {
            var traktResults = await Client.Movies.GetMostCollectedMoviesAsync(period, extendedInfo, movieFilter, whichPage, limitPerPage);

            var results = new PaginationList <MostPWCMovie>
            {
                CurrentPage    = traktResults.Page,
                TotalPages     = traktResults.PageCount,
                LimitPerPage   = traktResults.Limit,
                TotalItemCount = traktResults.ItemCount,
                TotalUserCount = traktResults.UserCount
            };

            results.Items = new ObservableCollection <MostPWCMovie>();

            foreach (var traktMostCollectedMovie in traktResults)
            {
                var mostCollectedMovie = MovieModelConverter.Convert <MostPWCMovie>(traktMostCollectedMovie.Movie);

                if (mostCollectedMovie != null)
                {
                    mostCollectedMovie.WatcherCount   = traktMostCollectedMovie.WatcherCount.GetValueOrDefault();
                    mostCollectedMovie.PlayCount      = traktMostCollectedMovie.PlayCount.GetValueOrDefault();
                    mostCollectedMovie.CollectedCount = traktMostCollectedMovie.CollectedCount.GetValueOrDefault();

                    results.Items.Add(mostCollectedMovie);
                }
            }

            return(results);
        }
Beispiel #12
0
 public async Task <TraktPaginationListResult <TraktRecentlyUpdatedMovie> > GetRecentlyUpdatedMoviesAsync(DateTime?startDate             = null,
                                                                                                          TraktExtendedInfo extendedInfo = null,
                                                                                                          int?page = null, int?limitPerPage = null)
 => await QueryAsync(new TraktMoviesRecentlyUpdatedRequest(Client)
 {
     StartDate         = startDate,
     ExtendedInfo      = extendedInfo,
     PaginationOptions = new TraktPaginationOptions(page, limitPerPage)
 });
Beispiel #13
0
 public async Task <IEnumerable <TraktBoxOfficeMovie> > GetBoxOfficeMoviesAsync(TraktExtendedInfo extendedInfo = null)
 => await QueryAsync(new TraktMoviesBoxOfficeRequest(Client) { ExtendedInfo = extendedInfo });
Beispiel #14
0
        /// <summary>
        /// Gets related movies for a <see cref="ITraktMovie" /> with the given Trakt-Id or -Slug.
        /// <para>OAuth authorization not required.</para>
        /// <para>
        /// See <a href="http://docs.trakt.apiary.io/#reference/movies/related/get-related-movies">"Trakt API Doc - Movies: Related"</a> for more information.
        /// </para>
        /// </summary>
        /// <param name="movieIdOrSlug">The movie's Trakt-Id or -Slug. See also <seealso cref="ITraktMovieIds" />.</param>
        /// <param name="extendedInfo">
        /// The extended info, which determines how much data about the movies should be queried.
        /// See also <seealso cref="TraktExtendedInfo" />.
        /// </param>
        /// <param name="pagedParameters"></param>
        /// <param name="cancellationToken"></param>
        /// <returns>
        /// An <see cref="TraktPagedResponse{ITraktMovie}"/> instance containing the queried related movies and which also
        /// contains the queried page number, the page's item count, maximum page count and maximum item count.
        /// <para>
        /// See also <seealso cref="TraktPagedResponse{ListItem}" /> and <seealso cref="ITraktMovie" />.
        /// </para>
        /// </returns>
        /// <exception cref="TraktException">Thrown, if the request fails.</exception>
        /// <exception cref="ArgumentException">Thrown, if the given movieIdOrSlug is null, empty or contains spaces.</exception>
        public Task <TraktPagedResponse <ITraktMovie> > GetMovieRelatedMoviesAsync(string movieIdOrSlug, TraktExtendedInfo extendedInfo = null,
                                                                                   TraktPagedParameters pagedParameters = null,
                                                                                   CancellationToken cancellationToken  = default)
        {
            var requestHandler = new RequestHandler(Client);

            return(requestHandler.ExecutePagedRequestAsync(new MovieRelatedMoviesRequest
            {
                Id = movieIdOrSlug,
                ExtendedInfo = extendedInfo,
                Page = pagedParameters?.Page,
                Limit = pagedParameters?.Limit
            },
                                                           cancellationToken));
        }
        public void Test_SeasonWatchingUsersRequest_Returns_Valid_UriPathParameters()
        {
            // with implicit season number / without extended info
            var request = new SeasonWatchingUsersRequest {
                Id = "123"
            };

            request.GetUriPathParameters().Should().NotBeNull()
            .And.HaveCount(2)
            .And.Contain(new Dictionary <string, object>
            {
                ["id"]     = "123",
                ["season"] = "0"
            });

            // with explicit season number / without extended info
            request = new SeasonWatchingUsersRequest {
                Id = "123", SeasonNumber = 2
            };

            request.GetUriPathParameters().Should().NotBeNull()
            .And.HaveCount(2)
            .And.Contain(new Dictionary <string, object>
            {
                ["id"]     = "123",
                ["season"] = "2"
            });

            // -------------------------------------------
            var extendedInfo = new TraktExtendedInfo {
                Full = true
            };

            // with implicit season number / with extended info
            request = new SeasonWatchingUsersRequest {
                Id = "123", ExtendedInfo = extendedInfo
            };

            request.GetUriPathParameters().Should().NotBeNull()
            .And.HaveCount(3)
            .And.Contain(new Dictionary <string, object>
            {
                ["id"]       = "123",
                ["season"]   = "0",
                ["extended"] = extendedInfo.ToString()
            });

            // with explicit season number / with extended info
            request = new SeasonWatchingUsersRequest {
                Id = "123", SeasonNumber = 2, ExtendedInfo = extendedInfo
            };

            request.GetUriPathParameters().Should().NotBeNull()
            .And.HaveCount(3)
            .And.Contain(new Dictionary <string, object>
            {
                ["id"]       = "123",
                ["season"]   = "2",
                ["extended"] = extendedInfo.ToString()
            });
        }
Beispiel #16
0
        /// <summary>
        /// Gets all watching users of a <see cref="ITraktMovie" /> with the given Trakt-Id or -Slug.
        /// <para>OAuth authorization not required.</para>
        /// <para>
        /// See <a href="http://docs.trakt.apiary.io/#reference/movies/watching/get-users-watching-right-now">"Trakt API Doc - Movies: Watching"</a> for more information.
        /// </para>
        /// </summary>
        /// <param name="movieIdOrSlug">The movie's Trakt-Id or -Slug. See also <seealso cref="ITraktMovieIds" />.</param>
        /// <param name="extendedInfo">
        /// The extended info, which determines how much data about the users should be queried.
        /// See also <seealso cref="TraktExtendedInfo" />.
        /// </param>
        /// <param name="cancellationToken"></param>
        /// <returns>A list of <see cref="ITraktUser" /> instances.</returns>
        /// <exception cref="TraktException">Thrown, if the request fails.</exception>
        /// <exception cref="ArgumentException">Thrown, if the given movieIdOrSlug is null, empty or contains spaces.</exception>
        public Task <TraktListResponse <ITraktUser> > GetMovieWatchingUsersAsync(string movieIdOrSlug, TraktExtendedInfo extendedInfo = null,
                                                                                 CancellationToken cancellationToken = default)
        {
            var requestHandler = new RequestHandler(Client);

            return(requestHandler.ExecuteListRequestAsync(new MovieWatchingUsersRequest
            {
                Id = movieIdOrSlug,
                ExtendedInfo = extendedInfo
            },
                                                          cancellationToken));
        }
Beispiel #17
0
        /// <summary>
        /// Gets all collected shows in the user's collection.
        /// <para>OAuth authorization required.</para>
        /// <para>
        /// See <a href="http://docs.trakt.apiary.io/#reference/sync/get-collection/get-collection">"Trakt API Doc - Sync: Get Collection"</a> for more information.
        /// </para>
        /// </summary>
        /// <param name="extendedInfo">
        /// The extended info, which determines how much data about the collected shows should be queried.
        /// See also <seealso cref="TraktExtendedInfo" />.
        /// </param>
        /// <param name="cancellationToken"></param>
        /// <returns>A list of <see cref="ITraktCollectionShow" /> instances.</returns>
        /// <exception cref="TraktException">Thrown, if the request fails.</exception>
        public Task <TraktListResponse <ITraktCollectionShow> > GetCollectionShowsAsync(TraktExtendedInfo extendedInfo      = null,
                                                                                        CancellationToken cancellationToken = default)
        {
            var requestHandler = new RequestHandler(Client);

            return(requestHandler.ExecuteListRequestAsync(new SyncCollectionShowsRequest
            {
                ExtendedInfo = extendedInfo
            },
                                                          cancellationToken));
        }
Beispiel #18
0
        /// <summary>
        /// Gets the most anticipated movies.
        /// <para>OAuth authorization not required.</para>
        /// <para>
        /// See <a href="http://docs.trakt.apiary.io/#reference/movies/anticipated/get-the-most-anticipated-movies">"Trakt API Doc - Movies: Anticipated"</a> for more information.
        /// </para>
        /// </summary>
        /// <param name="extendedInfo">
        /// The extended info, which determines how much data about the movies should be queried.
        /// See also <seealso cref="TraktExtendedInfo" />.
        /// </param>
        /// <param name="filter">Optional filters for genres, languages, year, runtimes, ratings, etc. See also <seealso cref="TraktMovieFilter" />.</param>
        /// <param name="pagedParameters"></param>
        /// <param name="cancellationToken"></param>
        /// <returns>
        /// An <see cref="TraktPagedResponse{ITraktMostAnticipatedMovie}"/> instance containing the queried most anticipated movies and which also
        /// contains the queried page number, the page's item count, maximum page count and maximum item count.
        /// <para>
        /// See also <seealso cref="TraktPagedResponse{ListItem}" /> and <seealso cref="ITraktMostAnticipatedMovie" />.
        /// </para>
        /// </returns>
        /// <exception cref="TraktException">Thrown, if the request fails.</exception>
        public Task <TraktPagedResponse <ITraktMostAnticipatedMovie> > GetMostAnticipatedMoviesAsync(TraktExtendedInfo extendedInfo       = null,
                                                                                                     TraktMovieFilter filter              = null,
                                                                                                     TraktPagedParameters pagedParameters = null,
                                                                                                     CancellationToken cancellationToken  = default)
        {
            var requestHandler = new RequestHandler(Client);

            return(requestHandler.ExecutePagedRequestAsync(new MoviesMostAnticipatedRequest
            {
                ExtendedInfo = extendedInfo,
                Filter = filter,
                Page = pagedParameters?.Page,
                Limit = pagedParameters?.Limit
            },
                                                           cancellationToken));
        }
        /// <summary>
        /// Gets all season premieres airing during the given time period.
        /// <para>OAuth authorization not required.</para>
        /// <para>
        /// See <a href="http://docs.trakt.apiary.io/#reference/calendars/all-season-premieres/get-season-premieres">"Trakt API Doc - Calendars: All Season Premieres"</a> for more information.
        /// </para>
        /// </summary>
        /// <param name="startDate">The date, on which the time period should start. Defaults to today. Will be converted to the Trakt date-format.</param>
        /// <param name="days">1 - 31 days, specifying the length of the time period. Defaults to 7 days.</param>
        /// <param name="extendedInfo">
        /// The extended info, which determines how much data about the shows should be queried.
        /// See also <seealso cref="TraktExtendedInfo" />.
        /// </param>
        /// <param name="filter">Optional filters for genres, languages, year, runtimes, ratings, etc. See also <seealso cref="TraktCalendarFilter" />.</param>
        /// <param name="cancellationToken">
        /// Propagates notification that the request should be canceled.<para/>
        /// If provided, the exception <see cref="OperationCanceledException" /> should be catched.
        /// </param>
        /// <returns>A list of <see cref="ITraktCalendarShow" /> instances.</returns>
        /// <exception cref="TraktException">Thrown, if the request fails.</exception>
        /// <exception cref="ArgumentOutOfRangeException">Thrown, if the given days value is not between 1 and 31.</exception>
        public Task <TraktListResponse <ITraktCalendarShow> > GetAllSeasonPremieresAsync(DateTime?startDate                  = null, int?days = null,
                                                                                         TraktExtendedInfo extendedInfo      = null,
                                                                                         ITraktCalendarFilter filter         = null,
                                                                                         CancellationToken cancellationToken = default)
        {
            var requestHandler = new RequestHandler(Client);

            return(requestHandler.ExecuteListRequestAsync(new CalendarAllSeasonPremieresRequest
            {
                StartDate = startDate,
                Days = days,
                ExtendedInfo = extendedInfo,
                Filter = filter
            },
                                                          cancellationToken));
        }
Beispiel #20
0
        /// <summary>
        /// Gets updated movies since the given <paramref name="startDate" />.
        /// <para>OAuth authorization not required.</para>
        /// <para>
        /// See <a href="http://docs.trakt.apiary.io/#reference/movies/updates/get-recently-updated-movies">"Trakt API Doc - Movies: Updates"</a> for more information.
        /// </para>
        /// </summary>
        /// <param name="startDate">The start date, after which updated movies should be queried. Will be converted to the Trakt UTC-datetime and -format.</param>
        /// <param name="extendedInfo">
        /// The extended info, which determines how much data about the movies should be queried.
        /// See also <seealso cref="TraktExtendedInfo" />.
        /// </param>
        /// <param name="pagedParameters"></param>
        /// <param name="cancellationToken"></param>
        /// <returns>
        /// An <see cref="TraktPagedResponse{ITraktRecentlyUpdatedMovie}"/> instance containing the queried updated movies and which also
        /// contains the queried page number, the page's item count, maximum page count and maximum item count.
        /// <para>
        /// See also <seealso cref="TraktPagedResponse{ListItem}" /> and <seealso cref="ITraktRecentlyUpdatedMovie" />.
        /// </para>
        /// </returns>
        /// <exception cref="TraktException">Thrown, if the request fails.</exception>
        public Task <TraktPagedResponse <ITraktRecentlyUpdatedMovie> > GetRecentlyUpdatedMoviesAsync(DateTime?startDate                   = null,
                                                                                                     TraktExtendedInfo extendedInfo       = null,
                                                                                                     TraktPagedParameters pagedParameters = null,
                                                                                                     CancellationToken cancellationToken  = default)
        {
            var requestHandler = new RequestHandler(Client);

            return(requestHandler.ExecutePagedRequestAsync(new MoviesRecentlyUpdatedRequest
            {
                StartDate = startDate,
                ExtendedInfo = extendedInfo,
                Page = pagedParameters?.Page,
                Limit = pagedParameters?.Limit
            },
                                                           cancellationToken));
        }
        /// <summary>
        /// Gets all people for a <see cref="ITraktSeason" /> in a show with the given Trakt-Id or -Slug.
        /// <para>OAuth authorization not required.</para>
        /// <para>
        /// See <a href="https://trakt.docs.apiary.io/#reference/seasons/people/get-all-people-for-a-season">"Trakt API Doc - Seasons: People"</a> for more information.
        /// </para>
        /// </summary>
        /// <param name="showIdOrSlug">The show's Trakt-Id or -Slug. See also <seealso cref="ITraktShowIds" />.</param>
        /// <param name="seasonNumber">The number of the season, for which the people should be queried.</param>
        /// <param name="extendedInfo">
        /// The extended info, which determines how much data about the people should be queried.
        /// See also <seealso cref="TraktExtendedInfo" />.
        /// </param>
        /// <param name="cancellationToken">
        /// Propagates notification that the request should be canceled.<para/>
        /// If provided, the exception <see cref="OperationCanceledException" /> should be catched.
        /// </param>
        /// <returns>An <see cref="ITraktShowCastAndCrew" /> instance, containing the cast and crew for a season with the given showIdOrSlug and the given season number.</returns>
        /// <exception cref="TraktException">Thrown, if the request fails.</exception>
        /// <exception cref="ArgumentException">Thrown, if the given showIdOrSlug is null, empty or contains spaces.</exception>
        public Task <TraktResponse <ITraktShowCastAndCrew> > GetSeasonPeopleAsync(string showIdOrSlug, uint seasonNumber, TraktExtendedInfo extendedInfo = null,
                                                                                  CancellationToken cancellationToken = default)
        {
            var requestHandler = new RequestHandler(Client);

            return(requestHandler.ExecuteSingleItemRequestAsync(new SeasonPeopleRequest
            {
                Id = showIdOrSlug,
                SeasonNumber = seasonNumber,
                ExtendedInfo = extendedInfo
            },
                                                                cancellationToken));
        }
Beispiel #22
0
        /// <summary>
        /// Searches for movies, shows, episodes, people and / or lists with the given search query.
        /// <para>OAuth authorization not required.</para>
        /// <para>
        /// See <a href="http://docs.trakt.apiary.io/#reference/search/text-query/get-text-query-results">"Trakt API Doc - Search: Text Query"</a> for more information.
        /// </para>
        /// </summary>
        /// <param name="searchResultTypes">
        /// The object type(s), for which will be searched. See also <seealso cref="TraktSearchResultType" />.
        /// Multiple <see cref="TraktSearchResultType" /> values can be combined with a binary operator, like this: TraktSearchResultType.Movie | TraktSearchResultType.Show.
        /// </param>
        /// <param name="searchQuery">The query, for which will be searched.</param>
        /// <param name="searchFields">Determines the text fields, which will be searched. See also <seealso cref="TraktSearchField" />.</param>
        /// <param name="filter">Optional filter for genres, year, runtimes, ratings, etc. See also <seealso cref="TraktSearchFilter" />.</param>
        /// <param name="extendedInfo">
        /// The extended info, which determines how much data about the movies, shows, episodes, people and / or lists should be queried.
        /// See also <seealso cref="TraktExtendedInfo" />.
        /// </param>
        /// <param name="pagedParameters"></param>
        /// <param name="cancellationToken"></param>
        /// <returns>
        /// An <see cref="TraktPagedResponse{ITraktSearchResult}"/> instance containing the found movies, shows, episodes, people and / or lists and which also
        /// contains the queried page number, the page's item count, maximum page count and maximum item count.
        /// <para>
        /// See also <seealso cref="TraktPagedResponse{ListItem}" /> and <seealso cref="ITraktSearchResult" />.
        /// </para>
        /// </returns>
        /// <exception cref="TraktException">Thrown, if the request fails.</exception>
        /// <exception cref="ArgumentException">
        /// Thrown, if the given searchQuery is null, empty or contains spaces.
        /// Thrown, if the given searchResultType is unspecified.
        /// </exception>
        /// <exception cref="ArgumentNullException">Thrown, if the given searchResultType is null</exception>
        public Task <TraktPagedResponse <ITraktSearchResult> > GetTextQueryResultsAsync(TraktSearchResultType searchResultTypes, string searchQuery,
                                                                                        TraktSearchField searchFields        = null, TraktSearchFilter filter = null,
                                                                                        TraktExtendedInfo extendedInfo       = null,
                                                                                        TraktPagedParameters pagedParameters = null,
                                                                                        CancellationToken cancellationToken  = default)
        {
            var requestHandler = new RequestHandler(Client);

            return(requestHandler.ExecutePagedRequestAsync(new SearchTextQueryRequest
            {
                ResultTypes = searchResultTypes,
                Query = searchQuery,
                SearchFields = searchFields,
                Filter = filter,
                ExtendedInfo = extendedInfo,
                Page = pagedParameters?.Page,
                Limit = pagedParameters?.Limit
            },
                                                           cancellationToken));
        }
Beispiel #23
0
        // -------------------------------------------------------------
        // Most Anticipated Shows

        public async Task <PaginationList <AnticipatedShow> > GetMostAnticipatedShowsAsync(TraktExtendedInfo extendedInfo = null,
                                                                                           TraktShowFilter showFilter     = null,
                                                                                           int?whichPage = null, int?limitPerPage = null)
        {
            var traktResults = await Client.Shows.GetMostAnticipatedShowsAsync(extendedInfo, showFilter, whichPage, limitPerPage);

            var results = new PaginationList <AnticipatedShow>
            {
                CurrentPage    = traktResults.Page,
                TotalPages     = traktResults.PageCount,
                LimitPerPage   = traktResults.Limit,
                TotalItemCount = traktResults.ItemCount,
                TotalUserCount = traktResults.UserCount
            };

            results.Items = new ObservableCollection <AnticipatedShow>();

            foreach (var traktAnticipatedShow in traktResults)
            {
                var anticipatedShow = ShowModelConverter.Convert <AnticipatedShow>(traktAnticipatedShow.Show);

                if (anticipatedShow != null)
                {
                    anticipatedShow.ListCount = traktAnticipatedShow.ListCount.GetValueOrDefault();
                    results.Items.Add(anticipatedShow);
                }
            }

            return(results);
        }
Beispiel #24
0
        public async Task <TraktPaginationListResult <TraktShow> > GetShowRelatedShowsAsync([NotNull] string showIdOrSlug, TraktExtendedInfo extendedInfo = null,
                                                                                            int?page = null, int?limitPerPage = null)
        {
            Validate(showIdOrSlug);

            return(await QueryAsync(new TraktShowRelatedShowsRequest(Client)
            {
                Id = showIdOrSlug,
                ExtendedInfo = extendedInfo,
                PaginationOptions = new TraktPaginationOptions(page, limitPerPage)
            }));
        }
Beispiel #25
0
        // -------------------------------------------------------------
        // Recently Updated Shows

        public async Task <PaginationList <RecentlyUpdatedShow> > GetRecentlyUpdatedShowsAsync(DateTime?startDate             = null,
                                                                                               TraktExtendedInfo extendedInfo = null,
                                                                                               int?whichPage = null, int?limitPerPage = null)
        {
            var traktResults = await Client.Shows.GetRecentlyUpdatedShowsAsync(startDate, extendedInfo, whichPage, limitPerPage);

            var results = new PaginationList <RecentlyUpdatedShow>
            {
                CurrentPage    = traktResults.Page,
                TotalPages     = traktResults.PageCount,
                LimitPerPage   = traktResults.Limit,
                TotalItemCount = traktResults.ItemCount,
                TotalUserCount = traktResults.UserCount
            };

            results.Items = new ObservableCollection <RecentlyUpdatedShow>();

            foreach (var traktRecentlyUpdatedShow in traktResults)
            {
                var recentlyUpdatedShow = ShowModelConverter.Convert <RecentlyUpdatedShow>(traktRecentlyUpdatedShow.Show);

                if (recentlyUpdatedShow != null)
                {
                    var updatedAt = traktRecentlyUpdatedShow.UpdatedAt;
                    recentlyUpdatedShow.ShowUpdatedAt = updatedAt.HasValue ? updatedAt.ToString() : string.Empty;
                    results.Items.Add(recentlyUpdatedShow);
                }
            }

            return(results);
        }
Beispiel #26
0
 public async Task <TraktPaginationListResult <TraktMostAnticipatedShow> > GetMostAnticipatedShowsAsync(TraktExtendedInfo extendedInfo = null,
                                                                                                        TraktShowFilter filter         = null,
                                                                                                        int?page = null, int?limitPerPage = null)
 => await QueryAsync(new TraktShowsMostAnticipatedRequest(Client)
 {
     ExtendedInfo      = extendedInfo,
     Filter            = filter,
     PaginationOptions = new TraktPaginationOptions(page, limitPerPage)
 });
Beispiel #27
0
 public async Task <TraktPaginationListResult <TraktMovie> > GetPopularMoviesAsync(TraktExtendedInfo extendedInfo = null,
                                                                                   TraktMovieFilter filter        = null,
                                                                                   int?page = null, int?limitPerPage = null)
 => await QueryAsync(new TraktMoviesPopularRequest(Client)
 {
     ExtendedInfo      = extendedInfo,
     Filter            = filter,
     PaginationOptions = new TraktPaginationOptions(page, limitPerPage)
 });