Adds collaborative bool and description to UpdatePlaylist

This commit is contained in:
Gruhlum 2018-08-24 13:07:01 +02:00 committed by Jonas Dellinger
parent 5c2a901f75
commit acc59d11bf

View File

@ -1438,15 +1438,21 @@ namespace SpotifyAPI.Web
/// <param name="playlistId">The Spotify ID for the playlist.</param> /// <param name="playlistId">The Spotify ID for the playlist.</param>
/// <param name="newName">The new name for the playlist, for example "My New Playlist Title".</param> /// <param name="newName">The new name for the playlist, for example "My New Playlist Title".</param>
/// <param name="newPublic">If true the playlist will be public, if false it will be private.</param> /// <param name="newPublic">If true the playlist will be public, if false it will be private.</param>
/// <param name="newCollaborative">If true the playlist will become collaborative and other users will be able to modify the playlist in their Spotify client. Note: You can only set collaborative to true on non-public playlists.</param>
/// <param name="newDescription">Value for playlist description as displayed in Spotify Clients and in the Web API.</param>
/// <returns></returns> /// <returns></returns>
/// <remarks>AUTH NEEDED</remarks> /// <remarks>AUTH NEEDED</remarks>
public ErrorResponse UpdatePlaylist(string userId, string playlistId, string newName = null, bool? newPublic = null) public ErrorResponse UpdatePlaylist(string userId, string playlistId, string newName = null, bool? newPublic = null, bool? newCollaborative = null, string newDescription = null)
{ {
JObject body = new JObject(); JObject body = new JObject();
if (newName != null) if (newName != null)
body.Add("name", newName); body.Add("name", newName);
if (newPublic != null) if (newPublic != null)
body.Add("public", newPublic); body.Add("public", newPublic);
if (newCollaborative != null)
body.Add("collaborative", newCollaborative);
if (newDescription != null)
body.Add("description", newDescription);
return UploadData<ErrorResponse>(_builder.UpdatePlaylist(userId, playlistId), body.ToString(Formatting.None), "PUT") ?? new ErrorResponse(); return UploadData<ErrorResponse>(_builder.UpdatePlaylist(userId, playlistId), body.ToString(Formatting.None), "PUT") ?? new ErrorResponse();
} }