/// <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))); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <summary>Rate an episode by ID</summary> /// <param name="episodeId">The episode ID</param> /// <param name="episodeIdType">The episode 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> AddRatingByEpisodeIdAsync(string episodeId, TraktTextEpisodeIdType episodeIdType, TraktRating rating, DateTime?ratedAt = null) { var obj = TraktEpisodeFactory.FromId <TraktEpisodeWithRatingsMetadata>(episodeId, episodeIdType); obj.Rating = rating; obj.RatedAt = ratedAt; return(await AddRatingsAsync(obj)); }
/// <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))); }
/// <summary>Add a new comment to an episode. 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="episodeId">The episode ID</param> /// <param name="episodeIdType">The episode 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> PostEpisodeCommentAsync(int episodeId, TraktNumericEpisodeIdType episodeIdType, string comment, bool?spoiler = null, bool?review = null) { return(await PostEpisodeCommentAsync(TraktEpisodeFactory.FromId(episodeId, episodeIdType), comment, spoiler, review)); }
/// <summary>Remove an episode from the user's watched history by ID including all watches, scrobbles, and checkins</summary> /// <param name="episodeId">The episode ID</param> /// <param name="episodeIdType">The episode ID type</param> /// <returns>See summary</returns> public async Task <TraktRemoveResponse> MarkUnwatchedByEpisodeIdAsync(int episodeId, TraktNumericEpisodeIdType episodeIdType) { return(await MarkUnwatchedAsync(TraktEpisodeFactory.FromId(episodeId, episodeIdType))); }
/// <summary>Remove an episode from the user's collection by ID</summary> /// <param name="episodeId">The episode ID</param> /// <param name="episodeIdType">The episode ID type</param> /// <returns>See summary</returns> public async Task <TraktRemoveResponse> RemoveFromCollectionByEpisodeIdAsync(string episodeId, TraktTextEpisodeIdType episodeIdType = TraktTextEpisodeIdType.Auto) { return(await RemoveFromCollectionAsync(TraktEpisodeFactory.FromId(episodeId, episodeIdType))); }
/// <summary>Add an episode to the user's watched history by ID</summary> /// <param name="episodeId">The episode ID</param> /// <param name="episodeIdType">The episode ID type</param> /// <returns>See summary</returns> public async Task <TraktAddResponse> MarkWatchedByEpisodeIdAsync(string episodeId, TraktTextEpisodeIdType episodeIdType = TraktTextEpisodeIdType.Auto) { return(await MarkWatchedAsync(TraktEpisodeFactory.FromId <TraktEpisodeWithWatchedMetadata>(episodeId, episodeIdType))); }
/// <summary>Remove an episode from the user's watched history by ID including all watches, scrobbles, and checkins</summary> /// <param name="episodeId">The episode ID</param> /// <param name="episodeIdType">The episode ID type</param> /// <returns>See summary</returns> public async Task <TraktRemoveResponse> MarkUnwatchedByEpisodeIdAsync(string episodeId, TraktTextEpisodeIdType episodeIdType = TraktTextEpisodeIdType.Auto) { return(await MarkUnwatchedAsync(TraktEpisodeFactory.FromId(episodeId, episodeIdType))); }
/// <summary>Remove one or more items from a custom list</summary> /// <param name="listId">The list ID</param> /// <param name="episodeId">The episode ID</param> /// <param name="episodeIdType">The episode ID type</param> /// <returns>See summary</returns> public async Task <TraktRemoveResponse> RemoveFromListByEpisodeIdAsync(string listId, int episodeId, TraktNumericEpisodeIdType episodeIdType) { return(await RemoveFromListAsync(listId, TraktEpisodeFactory.FromId(episodeId, episodeIdType))); }
/// <summary>Remove a rating for an episode by ID</summary> /// <param name="episodeId">The episode ID</param> /// <param name="episodeIdType">The episode ID type</param> /// <returns>See summary</returns> public async Task <TraktRemoveResponse> RemoveRatingByEpisodeIdAsync(int episodeId, TraktNumericEpisodeIdType episodeIdType) { return(await RemoveRatingAsync(TraktEpisodeFactory.FromId(episodeId, episodeIdType))); }
/// <summary>Add an episode to the user's watchlist by ID</summary> /// <param name="episodeId">The episode ID</param> /// <param name="episodeIdType">The episode ID type</param> /// <returns>See summary</returns> public async Task <TraktAddResponse> AddToWatchlistByEpisodeIdAsync(int episodeId, TraktNumericEpisodeIdType episodeIdType) { return(await AddToWatchlistAsync(TraktEpisodeFactory.FromId(episodeId, episodeIdType))); }
/// <summary>Add an episode to the user's collection by ID</summary> /// <param name="episodeId">The episode ID</param> /// <param name="showIdType">The show ID type</param> /// <returns>See summary</returns> public async Task <TraktAddResponse> AddToCollectionByEpisodeIdAsync(int episodeId, TraktNumericEpisodeIdType showIdType) { return(await AddToCollectionAsync(TraktEpisodeFactory.FromId <TraktEpisodeWithCollectionMetadata>(episodeId, showIdType))); }
/// <summary>Add an episode to the user's watched history by ID</summary> /// <param name="episodeId">The episode ID</param> /// <param name="episodeIdType">The episode ID type</param> /// <returns>See summary</returns> public async Task <TraktAddResponse> MarkWatchedByEpisodeIdAsync(int episodeId, TraktNumericEpisodeIdType episodeIdType) { return(await MarkWatchedAsync(TraktEpisodeFactory.FromId <TraktEpisodeWithWatchedMetadata>(episodeId, episodeIdType))); }
/// <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="episodeId">The episode ID</param> /// <param name="episodeIdType">The episode 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 <TraktScrobbleEpisodeResponse> StartEpisodeAsync(int episodeId, TraktNumericEpisodeIdType episodeIdType, float progress, string appVersion = "", DateTime?appDate = null, TraktExtendedOption extended = TraktExtendedOption.Unspecified) { return(await StartEpisodeAsync(TraktEpisodeFactory.FromId(episodeId, episodeIdType), null, progress, appVersion, appDate, extended)); }
/// <summary> /// Use this method when the video is stopped or finishes playing on its own. If the progress is above 80%, the video will be scrobbled and the action will be set to scrobble. /// If the progress is less than 80%, it will be treated as a pause and the action will be set to pause. The playback progress will be saved and /// <see cref="TraktSyncModule.GetPlaybackStateAsync"/> can be used to resume the video from this exact position. /// </summary> /// <param name="showTitle">The show title</param> /// <param name="showYear">The show release year (first season)</param> /// <param name="seasonNumber">The season number</param> /// <param name="episodeNumber">The episode number within the specified season</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 <TraktScrobbleEpisodeResponse> StopEpisodeAsync(string showTitle, int?showYear, int seasonNumber, int episodeNumber, float progress, string appVersion = "", DateTime?appDate = null, TraktExtendedOption extended = TraktExtendedOption.Unspecified) { return(await StopEpisodeAsync(TraktEpisodeFactory.FromSeasonAndEpisodeNumber(seasonNumber, episodeNumber), TraktShowFactory.FromTitleAndYear(showTitle, showYear), progress, appVersion, appDate, extended)); }
/// <summary>Check into an episode. 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="showTitle">The show title</param> /// <param name="showYear">The show release year (first season)</param> /// <param name="seasonNumber">The season number</param> /// <param name="episodeNumber">The episode number within the specified season</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 <TraktCheckinEpisodeResponse> CheckinEpisodeAsync(string showTitle, int?showYear, int seasonNumber, int episodeNumber, TraktSharing sharing = null, string message = "", string venueId = "", string venueName = "", string appVersion = "", DateTime?appDate = null, TraktExtendedOption extended = TraktExtendedOption.Unspecified) { return(await CheckinEpisodeAsync(TraktEpisodeFactory.FromSeasonAndEpisodeNumber(seasonNumber, episodeNumber), TraktShowFactory.FromTitleAndYear(showTitle, showYear), sharing, message, venueId, venueName, appVersion, appDate, extended)); }
/// <summary>Check into an episode. 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="episodeId">The episode ID</param> /// <param name="episodeIdType">The episode 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 <TraktCheckinEpisodeResponse> CheckinEpisodeAsync(int episodeId, TraktNumericEpisodeIdType episodeIdType, TraktSharing sharing = null, string message = "", string venueId = "", string venueName = "", string appVersion = "", DateTime?appDate = null, TraktExtendedOption extended = TraktExtendedOption.Unspecified) { return(await CheckinEpisodeAsync(TraktEpisodeFactory.FromId(episodeId, episodeIdType), null, sharing, message, venueId, venueName, appVersion, appDate, extended)); }
/// <summary>Add an episode to the user's watchlist by ID</summary> /// <param name="episodeId">The episode ID</param> /// <param name="episodeIdType">The episode ID type</param> /// <returns>See summary</returns> public async Task <TraktAddResponse> AddToWatchlistByEpisodeIdAsync(string episodeId, TraktTextEpisodeIdType episodeIdType = TraktTextEpisodeIdType.Auto) { return(await AddToWatchlistAsync(TraktEpisodeFactory.FromId(episodeId, episodeIdType))); }
/// <summary>Remove one or more items from a custom list</summary> /// <param name="listId">The list ID</param> /// <param name="episodeId">The episode ID</param> /// <param name="episodeIdType">The episode ID type</param> /// <returns>See summary</returns> public async Task <TraktRemoveResponse> RemoveFromListByEpisodeIdAsync(string listId, string episodeId, TraktTextEpisodeIdType episodeIdType = TraktTextEpisodeIdType.Auto) { return(await RemoveFromListAsync(listId, TraktEpisodeFactory.FromId(episodeId, episodeIdType))); }
public async Task TestCheckinCheckinEpisodeAsync() { FakeResponsePath = @"Checkin\Episode.json"; ((Action)(() => Client.Checkin.CheckinEpisodeAsync(string.Empty, TraktTextEpisodeIdType.Auto).Wait())).Should().Throw <ArgumentException>(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync(string.Empty, TraktTextEpisodeIdType.Imdb).Wait())).Should().Throw <ArgumentException>(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync("foobar", TraktTextEpisodeIdType.Auto).Wait())).Should().Throw <ArgumentException>(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync(0, TraktNumericEpisodeIdType.Trakt).Wait())).Should().Throw <ArgumentException>(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync(0, TraktNumericEpisodeIdType.Tmdb).Wait())).Should().Throw <ArgumentException>(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync(0, TraktNumericEpisodeIdType.Tvdb).Wait())).Should().Throw <ArgumentException>(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync(0, TraktNumericEpisodeIdType.TvRage).Wait())).Should().Throw <ArgumentException>(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync(string.Empty, 1, 1, 1).Wait())).Should().Throw <ArgumentException>(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync("ttfoobar", 1, 0, 1).Wait())).Should().Throw <ArgumentException>(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync("ttfoobar", 1, 1, 0).Wait())).Should().Throw <ArgumentException>(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync(null).Wait())).Should().Throw <ArgumentException>(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync(new TraktEpisode()).Wait())).Should().Throw <ArgumentException>(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync("ttfoobar", TraktTextEpisodeIdType.Auto).Wait())).Should().NotThrow(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync("ttfoobar", TraktTextEpisodeIdType.Imdb).Wait())).Should().NotThrow(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync(1, TraktNumericEpisodeIdType.Trakt).Wait())).Should().NotThrow(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync(1, TraktNumericEpisodeIdType.Tmdb).Wait())).Should().NotThrow(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync(1, TraktNumericEpisodeIdType.Tvdb).Wait())).Should().NotThrow(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync(1, TraktNumericEpisodeIdType.TvRage).Wait())).Should().NotThrow(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync("ttfoobar", 1, 1, 1).Wait())).Should().NotThrow(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync("ttfoobar", 0, 1, 1).Wait())).Should().NotThrow(); ((Action)(() => Client.Checkin.CheckinEpisodeAsync(TraktEpisodeFactory.FromId("ttfoobar")).Wait())).Should().NotThrow(); var result = await Client.Checkin.CheckinEpisodeAsync( TraktEpisodeFactory.FromId("ttfoobar"), TraktShowFactory.FromId("ttfoobar"), new TraktSharing { Facebook = true, Tumblr = true, Twitter = true }, "foobar", "foobar", "foobar", "foobar", DateTime.Now, TraktExtendedOption.Full); result.Should().BeOfType(typeof(TraktCheckinEpisodeResponse)); result.WatchedAt.Should().Be(DateTime.Parse("2014-08-06T06:54:36.859Z", null, DateTimeStyles.RoundtripKind)); result.Sharing.Facebook.Should().BeTrue(); result.Sharing.Twitter.Should().BeTrue(); result.Sharing.Tumblr.Should().BeFalse(); result.Episode.SeasonNumber.Should().Be(1); result.Episode.EpisodeNumber.Should().Be(1); result.Episode.Title.Should().Be("Pilot"); result.Episode.Ids.Trakt.Should().Be(16); result.Episode.Ids.Tvdb.Should().Be(349232); result.Episode.Ids.Imdb.Should().Be("tt0959621"); result.Episode.Ids.Tmdb.Should().Be(62085); result.Episode.Ids.TvRage.Should().Be(637041); result.Episode.Rating.Should().NotHaveValue(); result.Show.Title.Should().Be("Breaking Bad"); result.Show.Year.Should().Be(2008); result.Show.Ids.Trakt.Should().Be(1); result.Show.Ids.Slug.Should().Be("breaking-bad"); result.Show.Ids.Tvdb.Should().Be(81189); result.Show.Ids.Imdb.Should().Be("tt0903747"); result.Show.Ids.Tmdb.Should().Be(1396); result.Show.Ids.TvRage.Should().Be(18164); result.Show.Rating.Should().NotHaveValue(); FakeResponsePath = @"Checkin\Error.409.json"; FakeResponseCode = HttpStatusCode.Conflict; var ex = ((Action)(() => Client.Checkin.CheckinEpisodeAsync("ttfoobar", TraktTextEpisodeIdType.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(); }
/// <summary>Add an episode to the user's collection by ID</summary> /// <param name="episodeId">The episode ID</param> /// <param name="showIdType">The show ID type</param> /// <returns>See summary</returns> public async Task <TraktAddResponse> AddToCollectionByEpisodeIdAsync(string episodeId, TraktTextEpisodeIdType showIdType = TraktTextEpisodeIdType.Auto) { return(await AddToCollectionAsync(TraktEpisodeFactory.FromId <TraktEpisodeWithCollectionMetadata>(episodeId, showIdType))); }