/// <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)); }
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(); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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)); }
/// <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)); }
/// <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)); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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))); }