Esempio n. 1
0
 public async Task <IEnumerable <TraktRatingsItem> > GetRatingsAsync(TraktRatingsItemType ratingsItemType = null,
                                                                     int[] ratingsFilter            = null,
                                                                     TraktExtendedInfo extendedInfo = null)
 => await QueryAsync(new TraktSyncRatingsRequest(Client)
 {
     Type         = ratingsItemType,
     Rating       = ratingsFilter,
     ExtendedInfo = extendedInfo
 });
Esempio n. 2
0
        /// <summary>
        /// Gets the user's ratings for movies, shows, seasons and / or episodes.
        /// <para>OAuth authorization required.</para>
        /// <para>
        /// See <a href="http://docs.trakt.apiary.io/#reference/sync/get-ratings/get-ratings">"Trakt API Doc - Sync: Get Ratings"</a> for more information.
        /// </para>
        /// </summary>
        /// <param name="ratingsItemType">Determines, which type of rating items should be queried. See also <seealso cref="TraktRatingsItemType" />.</param>
        /// <param name="ratingsFilter">
        /// An array of numbers. Numbers should be between 1 and 10.
        /// 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="ratingsItemType" /> is null or unspecified.
        /// </param>
        /// <param name="extendedInfo">
        /// The extended info, which determines how much data about the rating items should be queried.
        /// See also <seealso cref="TraktExtendedInfo" />.
        /// </param>
        /// <param name="cancellationToken"></param>
        /// <returns>A list of <see cref="ITraktRatingsItem" /> instances.</returns>
        /// <exception cref="TraktException">Thrown, if the request fails.</exception>
        public Task <TraktListResponse <ITraktRatingsItem> > GetRatingsAsync(TraktRatingsItemType ratingsItemType = null,
                                                                             int[] ratingsFilter                 = null,
                                                                             TraktExtendedInfo extendedInfo      = null,
                                                                             CancellationToken cancellationToken = default)
        {
            var requestHandler = new RequestHandler(Client);

            return(requestHandler.ExecuteListRequestAsync(new SyncRatingsRequest
            {
                Type = ratingsItemType,
                RatingFilter = ratingsFilter,
                ExtendedInfo = extendedInfo
            },
                                                          cancellationToken));
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the user's ratings for movies, shows, seasons and / or episodes.
        /// <para>OAuth authorization required.</para>
        /// <para>
        /// See <a href="http://docs.trakt.apiary.io/#reference/sync/get-ratings/get-ratings">"Trakt API Doc - Sync: Get Ratings"</a> for more information.
        /// </para>
        /// </summary>
        /// <param name="ratingsItemType">Determines, which type of rating items should be queried. See also <seealso cref="TraktRatingsItemType" />.</param>
        /// <param name="ratingsFilter">
        /// An array of numbers. Numbers should be between 1 and 10.
        /// 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="ratingsItemType" /> is null or unspecified.
        /// </param>
        /// <param name="extendedInfo">
        /// The extended info, which determines how much data about the rating 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="ITraktRatingsItem" /> instances.</returns>
        /// <exception cref="TraktException">Thrown, if the request fails.</exception>
        public Task <TraktPagedResponse <ITraktRatingsItem> > GetRatingsAsync(TraktRatingsItemType ratingsItemType = null,
                                                                              int[] ratingsFilter                  = null,
                                                                              TraktExtendedInfo extendedInfo       = null,
                                                                              TraktPagedParameters pagedParameters = null,
                                                                              CancellationToken cancellationToken  = default)
        {
            var requestHandler = new RequestHandler(Client);

            return(requestHandler.ExecutePagedRequestAsync(new SyncRatingsRequest
            {
                Type = ratingsItemType,
                RatingFilter = ratingsFilter,
                ExtendedInfo = extendedInfo,
                Page = pagedParameters?.Page,
                Limit = pagedParameters?.Limit
            },
                                                           cancellationToken));
        }
        public void TestTraktRatingsItemTypeIsTraktEnumeration()
        {
            var enumeration = new TraktRatingsItemType();

            enumeration.Should().BeAssignableTo <TraktEnumeration>();
        }