Example #1
0
        /// <summary>
        /// Gets top level comments for a <see cref="ITraktShow" /> with the given Trakt-Id or -Slug.
        /// <para>OAuth authorization not required.</para>
        /// <para>
        /// See <a href="http://docs.trakt.apiary.io/#reference/shows/translations/get-all-show-comments">"Trakt API Doc - Shows: Comments"</a> for more information.
        /// </para>
        /// </summary>
        /// <param name="showIdOrSlug">The show's Trakt-Id or -Slug. See also <seealso cref="ITraktShowIds" />.</param>
        /// <param name="commentSortOrder">The comments sort order. See also <seealso cref="TraktCommentSortOrder" />.</param>
        /// <param name="pagedParameters"></param>
        /// <param name="cancellationToken"></param>
        /// <returns>
        /// An <see cref="TraktPagedResponse{ITraktComment}"/> instance containing the queried show comments 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="ITraktComment" />.
        /// </para>
        /// </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 <TraktPagedResponse <ITraktComment> > GetShowCommentsAsync(string showIdOrSlug,
                                                                               TraktCommentSortOrder commentSortOrder = null,
                                                                               TraktPagedParameters pagedParameters   = null,
                                                                               CancellationToken cancellationToken    = default)
        {
            var requestHandler = new RequestHandler(Client);

            return(requestHandler.ExecutePagedRequestAsync(new ShowCommentsRequest
            {
                Id = showIdOrSlug,
                SortOrder = commentSortOrder,
                Page = pagedParameters?.Page,
                Limit = pagedParameters?.Limit
            },
                                                           cancellationToken));
        }
Example #2
0
 /// <summary>Returns all top level comments for a show. Most recent comments returned first</summary>
 /// <param name="showId">The show ID</param>
 /// <param name="page">The page number</param>
 /// <param name="limit">The number of records to show per page</param>
 /// <returns>See summary</returns>
 public async Task <IEnumerable <TraktComment> > GetCommentsAsync(string showId, TraktCommentSortOrder order = TraktCommentSortOrder.Newest, int?page = null, int?limit = null)
 {
     return(await SendAsync(new TraktShowsCommentsRequest(Client) {
         Id = showId,
         Order = order,
         Pagination = new TraktPaginationOptions(page, limit)
     }));
 }
Example #3
0
 /// <summary>Returns all top level comments for a show. Most recent comments returned first</summary>
 /// <param name="show">The show</param>
 /// <param name="page">The page number</param>
 /// <param name="limit">The number of records to show per page</param>
 /// <returns>See summary</returns>
 public async Task <IEnumerable <TraktComment> > GetCommentsAsync(TraktShow show, TraktCommentSortOrder order = TraktCommentSortOrder.Newest, int?page = null, int?limit = null)
 {
     return(await GetCommentsAsync(show.Ids.GetBestId(), order, page, limit));
 }
Example #4
0
        public void TestTraktCommentSortOrderIsTraktEnumeration()
        {
            var enumeration = new TraktCommentSortOrder();

            enumeration.Should().BeAssignableTo <TraktEnumeration>();
        }
Example #5
0
        public async Task <TraktPaginationListResult <TraktComment> > GetEpisodeCommentsAsync([NotNull] string showIdOrSlug, int seasonNumber, int episodeNumber,
                                                                                              TraktCommentSortOrder commentSortOrder = null,
                                                                                              int?page = null, int?limitPerPage = null)
        {
            Validate(showIdOrSlug, seasonNumber, episodeNumber);

            return(await QueryAsync(new TraktEpisodeCommentsRequest(Client)
            {
                Id = showIdOrSlug,
                Season = seasonNumber,
                Episode = episodeNumber,
                Sorting = commentSortOrder,
                PaginationOptions = new TraktPaginationOptions(page, limitPerPage)
            }));
        }
Example #6
0
        public async Task <TraktPaginationListResult <TraktComment> > GetShowCommentsAsync([NotNull] string showIdOrSlug,
                                                                                           TraktCommentSortOrder commentSortOrder = null,
                                                                                           int?page = null, int?limitPerPage = null)
        {
            Validate(showIdOrSlug);

            return(await QueryAsync(new TraktShowCommentsRequest(Client)
            {
                Id = showIdOrSlug,
                Sorting = commentSortOrder,
                PaginationOptions = new TraktPaginationOptions(page, limitPerPage)
            }));
        }
Example #7
0
 /// <summary>Returns all top level comments for an episode. Most recent comments returned first.</summary>
 /// <param name="show">The show</param>
 /// <param name="episode">The episode</param>
 /// <param name="page">The page number</param>
 /// <param name="limit">The number of records to show per page</param>
 /// <returns>See summary</returns>
 public async Task <IEnumerable <TraktComment> > GetCommentsAsync(TraktShow show, TraktEpisode episode, TraktCommentSortOrder order = TraktCommentSortOrder.Newest, int?page = null, int?limit = null)
 {
     return(await GetCommentsAsync(show.Ids.GetBestId(), episode.SeasonNumber.GetValueOrDefault(), episode.EpisodeNumber.GetValueOrDefault(), order, page, limit));
 }