Skip to content

Commit

Permalink
Fix Playlist.ReplaceItems response (#972) (#982)
Browse files Browse the repository at this point in the history
* Fix Playlist.ReplaceItems response (#972)

* Update SpotifyAPI.Web/Clients/PlaylistsClient.cs

Co-authored-by: Jonas Dellinger <[email protected]>

* Remove await

---------

Co-authored-by: 4or5trees <[email protected]>
Co-authored-by: Jonas Dellinger <[email protected]>
  • Loading branch information
3 people authored Jul 20, 2024
1 parent 5bac8e6 commit d2c91ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion SpotifyAPI.Web/Clients/Interfaces/IPlaylistsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public interface IPlaylistsClient
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-replace-playlists-tracks
/// </remarks>
/// <returns></returns>
Task<bool> ReplaceItems(string playlistId, PlaylistReplaceItemsRequest request, CancellationToken cancel = default);
Task<SnapshotResponse> ReplaceItems(string playlistId, PlaylistReplaceItemsRequest request, CancellationToken cancel = default);

/// <summary>
/// Get a list of the playlists owned or followed by the current Spotify user.
Expand Down
5 changes: 2 additions & 3 deletions SpotifyAPI.Web/Clients/PlaylistsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,12 @@ public Task<FullPlaylist> Get(string playlistId, PlaylistGetRequest request, Can
return API.Get<FullPlaylist>(URLs.Playlist(playlistId), request.BuildQueryParams(), cancel);
}

public async Task<bool> ReplaceItems(string playlistId, PlaylistReplaceItemsRequest request, CancellationToken cancel = default)
public Task<SnapshotResponse> ReplaceItems(string playlistId, PlaylistReplaceItemsRequest request, CancellationToken cancel = default)
{
Ensure.ArgumentNotNullOrEmptyString(playlistId, nameof(playlistId));
Ensure.ArgumentNotNull(request, nameof(request));

var statusCode = await API.Put(URLs.PlaylistTracks(playlistId), null, request.BuildBodyParams(), cancel).ConfigureAwait(false);
return statusCode == HttpStatusCode.Created;
return API.Put<SnapshotResponse>(URLs.PlaylistTracks(playlistId), null, request.BuildBodyParams(), cancel);
}

public Task<Paging<FullPlaylist>> CurrentUsers(CancellationToken cancel = default)
Expand Down

0 comments on commit d2c91ba

Please sign in to comment.