コード例 #1
0
ファイル: TraktSyncModule.cs プロジェクト: MCs88/Trakt.NET
        /// <summary>
        /// Gets the user's watchlist containing movies, shows, seasons and / or episodes.
        /// <para>OAuth authorization required.</para>
        /// <para>
        /// See <a href="http://docs.trakt.apiary.io/#reference/sync/get-watchlist/get-watchlist">"Trakt API Doc - Sync: Get Watchlist"</a> for more information.
        /// </para>
        /// </summary>
        /// <param name="watchlistItemType">Determines, which type of watchlist items should be queried. See also <seealso cref="TraktSyncItemType" />.</param>
        /// <param name="extendedInfo">
        /// The extended info, which determines how much data about the watchlist items should be queried.
        /// See also <seealso cref="TraktExtendedInfo" />.
        /// </param>
        /// <param name="pagedParameters"></param>
        /// <param name="cancellationToken"></param>
        /// <returns>
        /// An <see cref="TraktPagedResponse{ITraktWatchlistItem}"/> instance containing the queried watchlist items 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="ITraktWatchlistItem" />.
        /// </para>
        /// </returns>
        /// <exception cref="TraktException">Thrown, if the request fails.</exception>
        public Task <TraktPagedResponse <ITraktWatchlistItem> > GetWatchlistAsync(TraktSyncItemType watchlistItemType  = null,
                                                                                  TraktExtendedInfo extendedInfo       = null,
                                                                                  TraktPagedParameters pagedParameters = null,
                                                                                  CancellationToken cancellationToken  = default)
        {
            var requestHandler = new RequestHandler(Client);

            return(requestHandler.ExecutePagedRequestAsync(new SyncWatchlistRequest
            {
                Type = watchlistItemType,
                ExtendedInfo = extendedInfo,
                Page = pagedParameters?.Page,
                Limit = pagedParameters?.Limit
            },
                                                           cancellationToken));
        }
コード例 #2
0
        /// <summary>
        /// Gets all movies, shows, seasons and / or episodes the user has watched, sorted by most recent.
        /// <para>OAuth authorization required.</para>
        /// <para>
        /// See <a href="http://docs.trakt.apiary.io/#reference/sync/get-history/get-watched-history">"Trakt API Doc - Sync: Get History"</a> for more information.
        /// </para>
        /// </summary>
        /// <param name="historyItemType">Determines, which type of history items should be queried. See also <seealso cref="TraktSyncItemType" />.</param>
        /// <param name="itemId">The Trakt Id for the item, which should be specifically queried. Will be ignored, if <paramref name="historyItemType" /> is not set or unspecified.</param>
        /// <param name="startAt">The datetime, after which history items should be queried. Will be converted to the Trakt UTC-datetime and -format.</param>
        /// <param name="endAt">The datetime, until which history items 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 history 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>
        /// An <see cref="TraktPagedResponse{ITraktHistoryItem}"/> instance containing the queried history items 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="ITraktHistoryItem" />.
        /// </para>
        /// </returns>
        /// <exception cref="TraktException">Thrown, if the request fails.</exception>
        public Task <TraktPagedResponse <ITraktHistoryItem> > GetWatchedHistoryAsync(TraktSyncItemType historyItemType = null, uint?itemId = null,
                                                                                     DateTime?startAt = null, DateTime?endAt = null,
                                                                                     TraktExtendedInfo extendedInfo       = null,
                                                                                     TraktPagedParameters pagedParameters = null,
                                                                                     CancellationToken cancellationToken  = default)
        {
            var requestHandler = new RequestHandler(Client);

            return(requestHandler.ExecutePagedRequestAsync(new SyncWatchedHistoryRequest
            {
                Type = historyItemType,
                ItemId = itemId,
                StartAt = startAt,
                EndAt = endAt,
                ExtendedInfo = extendedInfo,
                Page = pagedParameters?.Page,
                Limit = pagedParameters?.Limit
            },
                                                           cancellationToken));
        }
コード例 #3
0
 public async Task <TraktPaginationListResult <TraktWatchlistItem> > GetWatchlistAsync(TraktSyncItemType watchlistItemType = null,
                                                                                       TraktExtendedInfo extendedInfo      = null,
                                                                                       int?page = null, int?limitPerPage = null)
 => await QueryAsync(new TraktSyncWatchlistRequest(Client)
 {
     Type              = watchlistItemType,
     ExtendedInfo      = extendedInfo,
     PaginationOptions = new TraktPaginationOptions(page, limitPerPage)
 });
コード例 #4
0
 public async Task <TraktPaginationListResult <TraktHistoryItem> > GetWatchedHistoryAsync(TraktSyncItemType historyItemType = null, uint?itemId = null,
                                                                                          DateTime?startAt = null, DateTime?endAt = null,
                                                                                          TraktExtendedInfo extendedInfo = null,
                                                                                          int?page = null, int?limitPerPage = null)
 => await QueryAsync(new TraktSyncWatchedHistoryRequest(Client)
 {
     Type              = historyItemType,
     ItemId            = itemId,
     StartAt           = startAt,
     EndAt             = endAt,
     ExtendedInfo      = extendedInfo,
     PaginationOptions = new TraktPaginationOptions(page, limitPerPage)
 });
コード例 #5
0
        public void TestTraktSyncItemTypeIsTraktEnumeration()
        {
            var enumeration = new TraktSyncItemType();

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