コード例 #1
0
 /// <summary>Remove one or more items from a user's watched history by ID including all watches, scrobbles, and checkins</summary>
 /// <param name="movieIds">A collection of movie IDs</param>
 /// <param name="showIds">A collection of show IDs</param>
 /// <param name="episodeIds">A collection of episode IDs</param>
 /// <returns>See summary</returns>
 public async Task <TraktRemoveResponse> MarkUnwatchedAsync(IEnumerable <string> movieIds, IEnumerable <string> showIds, IEnumerable <string> episodeIds)
 {
     return(await MarkUnwatchedAsync(
                TraktMovieFactory.FromIds(movieIds),
                TraktShowFactory.FromIds(showIds),
                TraktEpisodeFactory.FromIds(episodeIds)));
 }
コード例 #2
0
 /// <summary>Rate one or more items</summary>
 /// <param name="movieIds">A collection of movie IDs</param>
 /// <param name="showIds">A collection of show IDs</param>
 /// <param name="episodeIds">A collection of episode IDs</param>
 /// <returns>See summary</returns>
 public async Task <TraktAddResponse> AddRatingsAsync(IEnumerable <string> movieIds, IEnumerable <string> showIds, IEnumerable <string> episodeIds)
 {
     return(await AddRatingsAsync(
                TraktMovieFactory.FromIds <TraktMovieWithRatingsMetadata>(movieIds),
                TraktShowFactory.FromIds <TraktShowWithRatingsMetadata>(showIds),
                TraktEpisodeFactory.FromIds <TraktEpisodeWithRatingsMetadata>(episodeIds)));
 }
コード例 #3
0
 /// <summary>Remove one or more items from the user's collection by IDs</summary>
 /// <param name="movieIds">A collection of movie IDs</param>
 /// <param name="showIds">A collection of show IDs</param>
 /// <param name="episodeIds">A collection of episode IDs</param>
 /// <returns>See summary</returns>
 public async Task <TraktRemoveResponse> RemoveFromCollectionAsync(IEnumerable <string> movieIds, IEnumerable <string> showIds, IEnumerable <string> episodeIds)
 {
     return(await RemoveFromCollectionAsync(
                TraktMovieFactory.FromIds(movieIds),
                TraktShowFactory.FromIds(showIds),
                TraktEpisodeFactory.FromIds(episodeIds)));
 }
コード例 #4
0
 /// <summary>Add one or more items to the user's watchlist by IDs</summary>
 /// <param name="movieIds">A collection of movie IDs</param>
 /// <param name="showIds">A collection of show IDs</param>
 /// <param name="episodeIds">A collection of episode IDs</param>
 /// <returns>See summary</returns>
 public async Task <TraktAddResponse> AddToWatchlistAsync(IEnumerable <string> movieIds, IEnumerable <string> showIds, IEnumerable <string> episodeIds)
 {
     return(await AddToWatchlistAsync(
                TraktMovieFactory.FromIds <TraktMovie>(movieIds),
                TraktShowFactory.FromIds <TraktShow>(showIds),
                TraktEpisodeFactory.FromIds <TraktEpisode>(episodeIds)));
 }
コード例 #5
0
        /// <summary>Rate a movie by ID</summary>
        /// <param name="movieId">The movie ID</param>
        /// <param name="movieIdType">The movie ID type</param>
        /// <param name="rating">The rating</param>
        /// <param name="ratedAt">The UTC date when the rating was made</param>
        /// <returns>See summary</returns>
        public async Task <TraktAddResponse> AddRatingByMovieIdAsync(int movieId, TraktNumericMovieIdType movieIdType, TraktRating rating, DateTime?ratedAt = null)
        {
            var obj = TraktMovieFactory.FromId <TraktMovieWithRatingsMetadata>(movieId, movieIdType);

            obj.Rating  = rating;
            obj.RatedAt = ratedAt;
            return(await AddRatingsAsync(obj));
        }
コード例 #6
0
 /// <summary>Remove one or more items from a custom list</summary>
 /// <param name="listId">The list ID</param>
 /// <param name="movieIds">A collection of movie IDs</param>
 /// <param name="showIds">A collection of show IDs</param>
 /// <param name="episodeIds">A collection of episode IDs</param>
 /// <param name="personIds">A collection of person IDs</param>
 /// <returns>See summary</returns>
 public async Task <TraktRemoveResponse> RemoveFromListAsync(string listId, IEnumerable <string> movieIds, IEnumerable <string> showIds, IEnumerable <string> episodeIds, IEnumerable <string> personIds)
 {
     return(await RemoveFromListAsync(
                listId,
                TraktMovieFactory.FromIds <TraktMovie>(movieIds),
                TraktShowFactory.FromIds <TraktShow>(showIds),
                null,          //Seasons only have numeric IDs. For simplicity, exclude them from this overload
                TraktEpisodeFactory.FromIds <TraktEpisode>(episodeIds),
                TraktPersonFactory.FromIds <TraktPerson>(personIds)));
 }
コード例 #7
0
        public async Task TestCheckinCheckinMovieAsync()
        {
            FakeResponsePath = @"Checkin\Movie.json";

            ((Action)(() => Client.Checkin.CheckinMovieAsync(string.Empty, TraktTextMovieIdType.Auto).Wait())).Should().Throw <ArgumentException>();
            ((Action)(() => Client.Checkin.CheckinMovieAsync(string.Empty, TraktTextMovieIdType.Imdb).Wait())).Should().Throw <ArgumentException>();
            ((Action)(() => Client.Checkin.CheckinMovieAsync(string.Empty, TraktTextMovieIdType.Slug).Wait())).Should().Throw <ArgumentException>();
            ((Action)(() => Client.Checkin.CheckinMovieAsync(0, TraktNumericMovieIdType.Trakt).Wait())).Should().Throw <ArgumentException>();
            ((Action)(() => Client.Checkin.CheckinMovieAsync(0, TraktNumericMovieIdType.Tmdb).Wait())).Should().Throw <ArgumentException>();
            ((Action)(() => Client.Checkin.CheckinMovieAsync(string.Empty, 1).Wait())).Should().Throw <ArgumentException>();
            ((Action)(() => Client.Checkin.CheckinMovieAsync("foobar", null).Wait())).Should().Throw <ArgumentException>();
            ((Action)(() => Client.Checkin.CheckinMovieAsync(null).Wait())).Should().Throw <ArgumentException>();
            ((Action)(() => Client.Checkin.CheckinMovieAsync(new TraktMovie()).Wait())).Should().Throw <ArgumentException>();

            ((Action)(() => Client.Checkin.CheckinMovieAsync("foobar", TraktTextMovieIdType.Auto).Wait())).Should().NotThrow();
            ((Action)(() => Client.Checkin.CheckinMovieAsync("foobar", TraktTextMovieIdType.Imdb).Wait())).Should().NotThrow();
            ((Action)(() => Client.Checkin.CheckinMovieAsync("foobar", TraktTextMovieIdType.Slug).Wait())).Should().NotThrow();
            ((Action)(() => Client.Checkin.CheckinMovieAsync(1, TraktNumericMovieIdType.Trakt).Wait())).Should().NotThrow();
            ((Action)(() => Client.Checkin.CheckinMovieAsync(1, TraktNumericMovieIdType.Tmdb).Wait())).Should().NotThrow();
            ((Action)(() => Client.Checkin.CheckinMovieAsync("foobar", 1).Wait())).Should().NotThrow();
            ((Action)(() => Client.Checkin.CheckinMovieAsync(TraktMovieFactory.FromId("foobar")).Wait())).Should().NotThrow();

            var result = await Client.Checkin.CheckinMovieAsync(
                TraktMovieFactory.FromId("foobar"),
                new TraktSharing { Facebook = true, Tumblr = true, Twitter = true },
                "foobar",
                "foobar",
                "foobar",
                "foobar",
                DateTime.Now,
                TraktExtendedOption.Full);

            result.Should().BeOfType(typeof(TraktCheckinMovieResponse));
            result.WatchedAt.Should().Be(DateTime.Parse("2014-08-06T01:11:37.953Z", null, DateTimeStyles.RoundtripKind));
            result.Sharing.Facebook.Should().BeTrue();
            result.Sharing.Twitter.Should().BeTrue();
            result.Sharing.Tumblr.Should().BeFalse();
            result.Movie.Title.Should().Be("Guardians of the Galaxy");
            result.Movie.Year.Should().Be(2014);
            result.Movie.Ids.Trakt.Should().Be(28);
            result.Movie.Ids.Slug.Should().Be("guardians-of-the-galaxy-2014");
            result.Movie.Ids.Imdb.Should().Be("tt2015381");
            result.Movie.Ids.Tmdb.Should().Be(118340);
            result.Movie.Rating.Should().NotHaveValue();

            FakeResponsePath = @"Checkin\Error.409.json";
            FakeResponseCode = HttpStatusCode.Conflict;
            var ex = ((Action)(() => Client.Checkin.CheckinMovieAsync("foobar", TraktTextMovieIdType.Auto).Wait())).Should().Throw <TraktConflictException>().Which;

            ex.ExpiresAt.Should().Be(DateTime.Parse("2014-10-15T22:21:29.000Z", null, DateTimeStyles.RoundtripKind));
            ex.StatusCode.Should().Be(FakeResponseCode);
            ex.TraktErrorType.Should().BeNull();
        }
コード例 #8
0
 /// <summary>Add a new comment to a movie. If you add a review, it needs to be at least 200 words. Also make sure to allow and encourage spoilers to be indicated in your app.</summary>
 /// <param name="movieId">The movie ID</param>
 /// <param name="movieIdType">The movie ID type</param>
 /// <param name="comment">The comment</param>
 /// <param name="spoiler">Set to <c>true</c> if the comment contains spoilers</param>
 /// <param name="review">Set to <c>true</c> if the comment is a review</param>
 /// <returns>See summary</returns>
 public async Task <TraktComment> PostMovieCommentAsync(int movieId, TraktNumericMovieIdType movieIdType, string comment, bool?spoiler = null, bool?review = null)
 {
     return(await PostMovieCommentAsync(TraktMovieFactory.FromId(movieId, movieIdType), comment, spoiler, review));
 }
コード例 #9
0
 /// <summary>Remove a movie from the user's watched history by ID including all watches, scrobbles, and checkins</summary>
 /// <param name="movieId">The movie ID</param>
 /// <param name="movieIdType">The movie ID type</param>
 /// <returns>See summary</returns>
 public async Task <TraktRemoveResponse> MarkUnwatchedByMovieIdAsync(int movieId, TraktNumericMovieIdType movieIdType)
 {
     return(await MarkUnwatchedAsync(TraktMovieFactory.FromId(movieId, movieIdType)));
 }
コード例 #10
0
 /// <summary>Remove a movie from the user's collection by ID</summary>
 /// <param name="movieId">The movie ID</param>
 /// <param name="movieIdType">The movie ID type</param>
 /// <returns>See summary</returns>
 public async Task <TraktRemoveResponse> RemoveFromCollectionByMovieIdAsync(string movieId, TraktTextMovieIdType movieIdType = TraktTextMovieIdType.Auto)
 {
     return(await RemoveFromCollectionAsync(TraktMovieFactory.FromId(movieId, movieIdType)));
 }
コード例 #11
0
 /// <summary>Add a movie to the user's watched history by ID</summary>
 /// <param name="movieId">The movie ID</param>
 /// <param name="movieIdType">The movie ID type</param>
 /// <returns>See summary</returns>
 public async Task <TraktAddResponse> MarkWatchedByMovieIdAsync(string movieId, TraktTextMovieIdType movieIdType = TraktTextMovieIdType.Auto)
 {
     return(await MarkWatchedAsync(TraktMovieFactory.FromId <TraktMovieWithWatchedMetadata>(movieId, movieIdType)));
 }
コード例 #12
0
 /// <summary>Remove a movie from the user's watched history by ID including all watches, scrobbles, and checkins</summary>
 /// <param name="movieId">The movie ID</param>
 /// <param name="movieIdType">The movie ID type</param>
 /// <returns>See summary</returns>
 public async Task <TraktRemoveResponse> MarkUnwatchedByMovieIdAsync(string movieId, TraktTextMovieIdType movieIdType = TraktTextMovieIdType.Auto)
 {
     return(await MarkUnwatchedAsync(TraktMovieFactory.FromId(movieId, movieIdType)));
 }
コード例 #13
0
 /// <summary>Remove one or more items from a custom list</summary>
 /// <param name="listId">The list ID</param>
 /// <param name="movieId">The movie ID</param>
 /// <param name="movieIdType">The movie ID type</param>
 /// <returns>See summary</returns>
 public async Task <TraktRemoveResponse> RemoveFromListByMovieIdAsync(string listId, int movieId, TraktNumericMovieIdType movieIdType)
 {
     return(await RemoveFromListAsync(listId, TraktMovieFactory.FromId(movieId, movieIdType)));
 }
コード例 #14
0
 /// <summary>Remove a rating for a movie by ID</summary>
 /// <param name="movieId">The movie ID</param>
 /// <param name="movieIdType">The movie ID type</param>
 /// <returns>See summary</returns>
 public async Task <TraktRemoveResponse> RemoveRatingByMovieIdAsync(int movieId, TraktNumericMovieIdType movieIdType)
 {
     return(await RemoveRatingAsync(TraktMovieFactory.FromId(movieId, movieIdType)));
 }
コード例 #15
0
 /// <summary>Add a movie to the user's collection by ID</summary>
 /// <param name="movieId">The movie ID</param>
 /// <param name="movieIdType">The movie ID type</param>
 /// <returns>See summary</returns>
 public async Task <TraktAddResponse> AddToCollectionByMovieIdAsync(int movieId, TraktNumericMovieIdType movieIdType)
 {
     return(await AddToCollectionAsync(TraktMovieFactory.FromId <TraktMovieWithCollectionMetadata>(movieId, movieIdType)));
 }
コード例 #16
0
 /// <summary>Add a movie to the user's watched history by ID</summary>
 /// <param name="movieId">The movie ID</param>
 /// <param name="movieIdType">The movie ID type</param>
 /// <returns>See summary</returns>
 public async Task <TraktAddResponse> MarkWatchedByMovieIdAsync(int movieId, TraktNumericMovieIdType movieIdType)
 {
     return(await MarkWatchedAsync(TraktMovieFactory.FromId <TraktMovieWithWatchedMetadata>(movieId, movieIdType)));
 }
コード例 #17
0
 /// <summary>Add a movie to the user's watchlist by ID</summary>
 /// <param name="movieId">The movie ID</param>
 /// <param name="movieIdType">The movie ID type</param>
 /// <returns>See summary</returns>
 public async Task <TraktAddResponse> AddToWatchlistByMovieIdAsync(int movieId, TraktNumericMovieIdType movieIdType)
 {
     return(await AddToWatchlistAsync(TraktMovieFactory.FromId(movieId, movieIdType)));
 }
コード例 #18
0
 /// <summary>Check into a movie. This should be tied to a user action to manually indicate they are watching something.
 /// The item will display as watching on the site, then automatically switch to watched status once the duration has elapsed.</summary>
 /// <param name="movieId">The movie ID</param>
 /// <param name="movieIdType">The movie ID type</param>
 /// <param name="sharing">Control sharing to any connected social networks</param>
 /// <param name="message">Message used for sharing. If not sent, it will use the watching string in the user settings.</param>
 /// <param name="venueId">Foursquare venue ID</param>
 /// <param name="venueName">Foursquare venue name</param>
 /// <param name="appVersion">Version number of the app</param>
 /// <param name="appDate">Build date of the app</param>
 /// <param name="extended">Changes which properties are populated for standard media objects. By default, minimal data is returned. Change this if additional fields are required in the returned data.</param>
 /// <returns>See summary</returns>
 public async Task <TraktCheckinMovieResponse> CheckinMovieAsync(int movieId, TraktNumericMovieIdType movieIdType, TraktSharing sharing = null, string message = "", string venueId = "", string venueName = "", string appVersion = "", DateTime?appDate = null, TraktExtendedOption extended = TraktExtendedOption.Unspecified)
 {
     return(await CheckinMovieAsync(TraktMovieFactory.FromId(movieId, movieIdType), sharing, message, venueId, venueName, appVersion, appDate, extended));
 }
コード例 #19
0
 /// <summary>Use this method when the video intially starts playing or is unpaused. This will remove any playback progress if it exists.</summary>
 /// <param name="movieTitle">The movie title</param>
 /// <param name="movieYear">The movie release year</param>
 /// <param name="progress">The user's current playback progress through this item as a percentage between 0 and 100</param>
 /// <param name="appVersion">Version number of the app</param>
 /// <param name="appDate">Build date of the app</param>
 /// <param name="extended">Changes which properties are populated for standard media objects. By default, minimal data is returned. Change this if additional fields are required in the returned data.</param>
 /// <returns>See summary</returns>
 public async Task <TraktScrobbleMovieResponse> StartMovieAsync(string movieTitle, int?movieYear, float progress, string appVersion = "", DateTime?appDate = null, TraktExtendedOption extended = TraktExtendedOption.Unspecified)
 {
     return(await StartMovieAsync(TraktMovieFactory.FromTitleAndYear(movieTitle, movieYear), progress, appVersion, appDate, extended));
 }
コード例 #20
0
 /// <summary>Use this method when the video intially starts playing or is unpaused. This will remove any playback progress if it exists.</summary>
 /// <param name="movieId">The movie ID</param>
 /// <param name="movieIdType">The movie ID type</param>
 /// <param name="progress">The user's current playback progress through this item as a percentage between 0 and 100</param>
 /// <param name="appVersion">Version number of the app</param>
 /// <param name="appDate">Build date of the app</param>
 /// <param name="extended">Changes which properties are populated for standard media objects. By default, minimal data is returned. Change this if additional fields are required in the returned data.</param>
 /// <returns>See summary</returns>
 public async Task <TraktScrobbleMovieResponse> StartMovieAsync(int movieId, TraktNumericMovieIdType movieIdType, float progress, string appVersion = "", DateTime?appDate = null, TraktExtendedOption extended = TraktExtendedOption.Unspecified)
 {
     return(await StartMovieAsync(TraktMovieFactory.FromId(movieId, movieIdType), progress, appVersion, appDate, extended));
 }
コード例 #21
0
 /// <summary>Check into a movie. This should be tied to a user action to manually indicate they are watching something.
 /// The item will display as watching on the site, then automatically switch to watched status once the duration has elapsed.</summary>
 /// <param name="movieTitle">The movie title</param>
 /// <param name="movieYear">The movie release year</param>
 /// <param name="sharing">Control sharing to any connected social networks</param>
 /// <param name="message">Message used for sharing. If not sent, it will use the watching string in the user settings.</param>
 /// <param name="venueId">Foursquare venue ID</param>
 /// <param name="venueName">Foursquare venue name</param>
 /// <param name="appVersion">Version number of the app</param>
 /// <param name="appDate">Build date of the app</param>
 /// <param name="extended">Changes which properties are populated for standard media objects. By default, minimal data is returned. Change this if additional fields are required in the returned data.</param>
 /// <returns>See summary</returns>
 /// <remarks>This should be tied to a user action to manually indicate they are watching something.
 /// The item will display as watching on the site, then automatically switch to watched status once the duration has elapsed.</remarks>
 public async Task <TraktCheckinMovieResponse> CheckinMovieAsync(string movieTitle, int?movieYear, TraktSharing sharing = null, string message = "", string venueId = "", string venueName = "", string appVersion = "", DateTime?appDate = null, TraktExtendedOption extended = TraktExtendedOption.Unspecified)
 {
     return(await CheckinMovieAsync(TraktMovieFactory.FromTitleAndYear(movieTitle, movieYear), sharing, message, venueId, venueName, appVersion, appDate, extended));
 }
コード例 #22
0
 /// <summary>Add a movie to the user's watchlist by ID</summary>
 /// <param name="movieId">The movie ID</param>
 /// <param name="movieIdType">The movie ID type</param>
 /// <returns>See summary</returns>
 public async Task <TraktAddResponse> AddToWatchlistByMovieIdAsync(string movieId, TraktTextMovieIdType movieIdType = TraktTextMovieIdType.Auto)
 {
     return(await AddToWatchlistAsync(TraktMovieFactory.FromId(movieId, movieIdType)));
 }
コード例 #23
0
 /// <summary>Add a new comment to a movie. If you add a review, it needs to be at least 200 words. Also make sure to allow and encourage spoilers to be indicated in your app.</summary>
 /// <param name="movieTitle">The movie title</param>
 /// <param name="movieYear">The movie release year</param>
 /// <param name="comment">The comment</param>
 /// <param name="spoiler">Set to <c>true</c> if the comment contains spoilers</param>
 /// <param name="review">Set to <c>true</c> if the comment is a review</param>
 /// <returns>See summary</returns>
 public async Task <TraktComment> PostMovieCommentAsync(string movieTitle, int?movieYear, string comment, bool?spoiler = null, bool?review = null)
 {
     return(await PostMovieCommentAsync(TraktMovieFactory.FromTitleAndYear(movieTitle, movieYear), comment, spoiler, review));
 }
コード例 #24
0
 /// <summary>Remove one or more items from a custom list</summary>
 /// <param name="listId">The list ID</param>
 /// <param name="movieId">The movie ID</param>
 /// <param name="movieIdType">The movie ID type</param>
 /// <returns>See summary</returns>
 public async Task <TraktRemoveResponse> RemoveFromListByMovieIdAsync(string listId, string movieId, TraktTextMovieIdType movieIdType = TraktTextMovieIdType.Auto)
 {
     return(await RemoveFromListAsync(listId, TraktMovieFactory.FromId(movieId, movieIdType)));
 }
コード例 #25
0
 /// <summary>Add a movie to the user's collection by ID</summary>
 /// <param name="movieId">The movie ID</param>
 /// <param name="movieIdType">The movie ID type</param>
 /// <returns>See summary</returns>
 public async Task <TraktAddResponse> AddToCollectionByMovieIdAsync(string movieId, TraktTextMovieIdType movieIdType = TraktTextMovieIdType.Auto)
 {
     return(await AddToCollectionAsync(TraktMovieFactory.FromId <TraktMovieWithCollectionMetadata>(movieId, movieIdType)));
 }