/// <summary> /// Posts a comment for the given <see cref="ITraktList" />. /// <para>OAuth authorization required.</para> /// <para> /// See <a href="http://docs.trakt.apiary.io/#reference/comments/comments/post-a-comment">"Trakt API Doc - Comments: Comments"</a> for more information. /// </para> /// </summary> /// <param name="list">The <see cref="ITraktList" />, for which the comment should be posted.</param> /// <param name="comment">The comment's content for the given list. Should be at least five words long.</param> /// <param name="containsSpoiler">Determines, if the <paramref name="comment" /> contains any spoilers.</param> /// <param name="sharing"><see cref="ITraktSharing" /> instance, containing sharing information for the comment.</param> /// <param name="cancellationToken"></param> /// <returns>An <see cref="ITraktCommentPostResponse" /> instance, containing the successfully posted comment's data.</returns> /// <exception cref="TraktException">Thrown, if the request fails.</exception> /// <exception cref="ArgumentException"> /// Thrown, if the given list has no valid ids. See also <seealso cref="ITraktListIds" />. /// Thrown, if the given comment is null or empty. /// </exception> /// <exception cref="ArgumentNullException">Thrown, if the given list is null or its ids are null.</exception> /// <exception cref="ArgumentOutOfRangeException">Thrown, if the given comment's word count is below five.</exception> public Task <TraktResponse <ITraktCommentPostResponse> > PostListCommentAsync(ITraktList list, string comment, bool?containsSpoiler = null, ITraktSharing sharing = null, CancellationToken cancellationToken = default) { ValidateList(list); ValidateComment(comment); var requestHandler = new RequestHandler(Client); return(requestHandler.ExecuteSingleItemRequestAsync(new CommentPostRequest <ITraktListCommentPost> { RequestBody = new TraktListCommentPost { List = new TraktList { Ids = list.Ids }, Comment = comment, Spoiler = containsSpoiler, Sharing = sharing } }, cancellationToken)); }
/// <summary> /// Posts a comment for the given <see cref="ITraktMovie" />. /// <para>OAuth authorization required.</para> /// <para> /// See <a href="http://docs.trakt.apiary.io/#reference/comments/comments/post-a-comment">"Trakt API Doc - Comments: Comments"</a> for more information. /// </para> /// </summary> /// <param name="movie">The <see cref="ITraktMovie" />, for which the comment should be posted.</param> /// <param name="comment">The comment's content for the given movie. Should be at least five words long.</param> /// <param name="containsSpoiler">Determines, if the <paramref name="comment" /> contains any spoilers.</param> /// <param name="sharing"><see cref="ITraktSharing" /> instance, containing sharing information for the comment.</param> /// <param name="cancellationToken"></param> /// <returns>An <see cref="ITraktCommentPostResponse" /> instance, containing the successfully posted comment's data.</returns> /// <exception cref="TraktException">Thrown, if the request fails.</exception> /// <exception cref="ArgumentException"> /// Thrown, if the given movie's title is null, empty or contains spaces. /// Thrown, if the given movie has no valid ids. See also <seealso cref="ITraktMovieIds" />. /// Thrown, if the given comment is null or empty. /// </exception> /// <exception cref="ArgumentNullException">Thrown, if the given movie is null or its ids are null.</exception> /// <exception cref="ArgumentOutOfRangeException"> /// Thrown, if the given movie's year is not valid. /// Thrown, if the given comment's word count is below five. /// </exception> public Task <TraktResponse <ITraktCommentPostResponse> > PostMovieCommentAsync(ITraktMovie movie, string comment, bool?containsSpoiler = null, ITraktSharing sharing = null, CancellationToken cancellationToken = default) { ValidateMovie(movie); ValidateComment(comment); var requestHandler = new RequestHandler(Client); return(requestHandler.ExecuteSingleItemRequestAsync(new CommentPostRequest <ITraktMovieCommentPost> { RequestBody = new TraktMovieCommentPost { Movie = new TraktMovie { Title = movie.Title, Year = movie.Year, Ids = movie.Ids }, Comment = comment, Spoiler = containsSpoiler, Sharing = sharing } }, cancellationToken)); }
/// <summary> /// Posts a comment for the given <see cref="ITraktShow" />. /// <para>OAuth authorization required.</para> /// <para> /// See <a href="http://docs.trakt.apiary.io/#reference/comments/comments/post-a-comment">"Trakt API Doc - Comments: Comments"</a> for more information. /// </para> /// </summary> /// <param name="show">The <see cref="ITraktShow" />, for which the comment should be posted.</param> /// <param name="comment">The comment's content for the given show. Should be at least five words long.</param> /// <param name="containsSpoiler">Determines, if the <paramref name="comment" /> contains any spoilers.</param> /// <param name="sharing"><see cref="ITraktSharing" /> instance, containing sharing information for the comment.</param> /// <param name="cancellationToken"></param> /// <returns>An <see cref="ITraktCommentPostResponse" /> instance, containing the successfully posted comment's data.</returns> /// <exception cref="TraktException">Thrown, if the request fails.</exception> /// <exception cref="ArgumentException"> /// Thrown, if the given show's title is null, empty or contains spaces. /// Thrown, if the given show has no valid ids. See also <seealso cref="ITraktShowIds" />. /// Thrown, if the given comment is null or empty. /// </exception> /// <exception cref="ArgumentNullException">Thrown, if the given show is null or its ids are null.</exception> /// <exception cref="ArgumentOutOfRangeException">Thrown, if the given comment's word count is below five.</exception> public Task <TraktResponse <ITraktCommentPostResponse> > PostShowCommentAsync(ITraktShow show, string comment, bool?containsSpoiler = null, ITraktSharing sharing = null, CancellationToken cancellationToken = default) { ValidateShow(show); ValidateComment(comment); var requestHandler = new RequestHandler(Client); return(requestHandler.ExecuteSingleItemRequestAsync(new CommentPostRequest <ITraktShowCommentPost> { RequestBody = new TraktShowCommentPost { Show = new TraktShow { Title = show.Title, Ids = show.Ids }, Comment = comment, Spoiler = containsSpoiler, Sharing = sharing } }, cancellationToken)); }
/// <summary> /// Checks into the given <see cref="ITraktMovie" />. /// <para>OAuth authorization required.</para> /// <para> /// See <a href="http://docs.trakt.apiary.io/#reference/checkin/check-into-an-item">"Trakt API Doc - Checkin: Checkin"</a> for more information. /// </para> /// </summary> /// <param name="movie">The <see cref="ITraktMovie" />, which will be checked in.</param> /// <param name="appVersion">Optional application version for the checkin.</param> /// <param name="appBuildDate">Optional application build date for the checkin. Will be converted to the Trakt date-format.</param> /// <param name="message">The message, which will be used for sharing. If none is given, the user's default message will be used.</param> /// <param name="sharing">Optional sharing settings, which will override the user's default sharing settings.</param> /// <param name="foursquareVenueID">Optional Foursquare venue id for the checkin.</param> /// <param name="foursquareVenueName">Optional Foursquare venue name for the checkin.</param> /// <param name="cancellationToken"></param> /// <returns>An <see cref="ITraktMovieCheckinPostResponse" /> instance, containing the successfully checked in movie's data.</returns> /// <exception cref="TraktException">Thrown, if the request fails.</exception> /// <exception cref="ArgumentException"> /// Thrown, if the given movie's title is null or empty. /// Thrown, if the given movie has no valid ids set. /// </exception> /// <exception cref="ArgumentNullException">Thrown, if the given movie is null or if its ids are null.</exception> /// <exception cref="ArgumentOutOfRangeException">Thrown, if the given movie's year is not valid.</exception> public Task <TraktResponse <ITraktMovieCheckinPostResponse> > CheckIntoMovieAsync(ITraktMovie movie, string appVersion = null, DateTime?appBuildDate = null, string message = null, ITraktSharing sharing = null, string foursquareVenueID = null, string foursquareVenueName = null, CancellationToken cancellationToken = default) { var requestBody = new TraktMovieCheckinPost { Movie = movie, Message = message, Sharing = sharing, FoursquareVenueId = foursquareVenueID, FoursquareVenueName = foursquareVenueName }; if (!string.IsNullOrEmpty(appVersion)) { requestBody.AppVersion = appVersion; } if (appBuildDate.HasValue) { requestBody.AppDate = appBuildDate.Value.ToTraktDateString(); } var requestHandler = new RequestHandler(Client); return(requestHandler.ExecuteSingleItemRequestAsync(new CheckinRequest <ITraktMovieCheckinPostResponse, ITraktMovieCheckinPost> { RequestBody = requestBody }, cancellationToken)); }