TMDbLib/Client/TMDbClientTvShows.cs
/// <summary>
/// Change the rating of a specified tv show.
/// </summary>
/// <param name="tvShowId">The id of the tv show to rate</param>
/// <param name="rating">The rating you wish to assign to the specified tv show. Value needs to be between 0.5 and 10 and must use increments of 0.5. Ex. using 7.1 will not work and return false.</param>
/// <param name="cancellationToken">A cancellation token</param>
/// <returns>True if the the tv show's rating was successfully updated, false if not</returns>
/// <remarks>Requires a valid guest or user session</remarks>
/// <exception cref="GuestSessionRequiredException">Thrown when the current client object doens't have a guest or user session assigned.</exception>
Change the rating of a specified tv show.
Change the rating of a specified tv show .
public async Task<bool> TvShowSetRatingAsync(int tvShowId, double rating, CancellationToken cancellationToken = default)
        {
            RequireSessionId(SessionType.GuestSession);
            RestRequest req = _client.Create("tv/{tvShowId}/rating");
            req.AddUrlSegment("tvShowId", tvShowId.ToString(CultureInfo.InvariantCulture));
            AddSessionId(req);
            req.SetBody(new { value = rating });
            RestResponse<PostReply> response = await req.Post<PostReply>(cancellationToken).ConfigureAwait(false);
            PostReply item = await response.GetDataObject().ConfigureAwait(false);
            return item.StatusCode == 1 || item.StatusCode == 12;
        }
public async Task < bool > TvShowSetRatingAsync ( int tvShowId , double rating , CancellationToken cancellationToken = default ) { RequireSessionId ( SessionType . GuestSession ) ; RestRequest req = _client . Create ( " " ) ; req . AddUrlSegment ( " " , tvShowId . ToString ( CultureInfo . InvariantCulture ) ) ; AddSessionId ( req ) ; req . SetBody ( new { value = rating } ) ; RestResponse < PostReply > response = await req . Post < PostReply > ( cancellationToken ) . ConfigureAwait ( false ) ; PostReply item = await response . GetDataObject ( ) . ConfigureAwait ( false ) ; return item . StatusCode == 1 || item . StatusCode == 12 ; }
Change the rating of a specified tv show.
Change the rating of a specified tv show .
// status code 1 = "Success" // status code 12 = "The item/record was updated successfully" - Used when an item was previously rated by the user // TODO: Original code had a check for item=null
True if the the tv show's rating was successfully updated, false if not
True if the the tv show ' s rating was successfully updated false if not
Thrown when the current client object doens't have a guest or user session assigned.
Thrown when the current client object doens ' t have a guest or user session assigned .
tvShowId
int
The id of the tv show to rate
The id of the tv show to rate
rating
double
The rating you wish to assign to the specified tv show. Value needs to be between 0.5 and 10 and must use increments of 0.5. Ex. using 7.1 will not work and return false.
The rating you wish to assign to the specified tv show . Value needs to be between 0 . 5 and 10 and must use increments of 0 . 5 . Ex . using 7 . 1 will not work and return false .
cancellationToken
CancellationToken
A cancellation token
A cancellation token
remarks
Requires a valid guest or user session
Requires a valid guest or user session