TMDbLib/Client/TMDbClientLists.cs
/// <summary>
/// Clears a list, without confirmation.
/// </summary>
/// <param name="listId">The id of the list to clear</param>
/// <param name="cancellationToken">A cancellation token</param>
/// <returns>True if the method was able to remove the movie from the list, will retrun false in case of an issue or when the movie was not present in the list</returns>
/// <remarks>Requires a valid user session</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception>
Clears a list, without confirmation.
Clears a list without confirmation .
public async Task<bool> ListClearAsync(string listId, CancellationToken cancellationToken = default)
        {
            RequireSessionId(SessionType.UserSession);
            if (string.IsNullOrWhiteSpace(listId))
                throw new ArgumentNullException(nameof(listId));
            RestRequest request = _client.Create("list/{listId}/clear");
            request.AddUrlSegment("listId", listId);
            request.AddParameter("confirm", "true");
            AddSessionId(request, SessionType.UserSession);
            RestResponse<PostReply> response = await request.Post<PostReply>(cancellationToken).ConfigureAwait(false);
            PostReply item = await response.GetDataObject().ConfigureAwait(false);
            return item.StatusCode == 12;
        }
public async Task < bool > ListClearAsync ( string listId , CancellationToken cancellationToken = default ) { RequireSessionId ( SessionType . UserSession ) ; if ( string . IsNullOrWhiteSpace ( listId ) ) throw new ArgumentNullException ( nameof ( listId ) ) ; RestRequest request = _client . Create ( " " ) ; request . AddUrlSegment ( " " , listId ) ; request . AddParameter ( " " , " " ) ; AddSessionId ( request , SessionType . UserSession ) ; RestResponse < PostReply > response = await request . Post < PostReply > ( cancellationToken ) . ConfigureAwait ( false ) ; PostReply item = await response . GetDataObject ( ) . ConfigureAwait ( false ) ; return item . StatusCode == 12 ; }
Clears a list, without confirmation.
Clears a list without confirmation .
// Status code 12 = "The item/record was updated successfully" // TODO: Previous code checked for item=null
True if the method was able to remove the movie from the list, will retrun false in case of an issue or when the movie was not present in the list
True if the method was able to remove the movie from the list will retrun false in case of an issue or when the movie was not present in the list
Thrown when the current client object doens't have a user session assigned.
Thrown when the current client object doens ' t have a user session assigned .
listId
string
The id of the list to clear
The id of the list to clear
cancellationToken
CancellationToken
A cancellation token
A cancellation token
remarks
Requires a valid user session
Requires a valid user session