Skip to content

Commit a82bbbf

Browse files
GruhlumJonas Dellinger
authored andcommitted
Adds collaborative and description to UpdatePlaylist and CreatePlaylist
1 parent acc59d1 commit a82bbbf

1 file changed

Lines changed: 23 additions & 6 deletions

File tree

‎SpotifyAPI.Web/SpotifyWebAPI.cs‎

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,14 +1395,19 @@ public Task<Paging<PlaylistTrack>> GetPlaylistTracksAsync(string userId, string
13951395
/// default true. If true the playlist will be public, if false it will be private. To be able to
13961396
/// create private playlists, the user must have granted the playlist-modify-private scope.
13971397
/// </param>
1398+
/// <param name="isCollaborative">If true the playlist will become collaborative and other users will be able to modify the playlist in their Spotify client.
1399+
/// Note: You can only set collaborative to true on non-public playlists.</param>
1400+
/// <param name="playlistDescription">Value for playlist description as displayed in Spotify Clients and in the Web API.</param>
13981401
/// <returns></returns>
13991402
/// <remarks>AUTH NEEDED</remarks>
1400-
public FullPlaylist CreatePlaylist(string userId, string playlistName, bool isPublic = true)
1403+
public FullPlaylist CreatePlaylist(string userId, string playlistName, bool isPublic = true, bool isCollaborative = false, string playlistDescription = "")
14011404
{
14021405
JObject body = new JObject
14031406
{
14041407
{"name", playlistName},
1405-
{"public", isPublic}
1408+
{"public", isPublic},
1409+
{"collaborative", isCollaborative},
1410+
{"description", playlistDescription}
14061411
};
14071412
return UploadData<FullPlaylist>(_builder.CreatePlaylist(userId, playlistName, isPublic), body.ToString(Formatting.None));
14081413
}
@@ -1419,14 +1424,19 @@ public FullPlaylist CreatePlaylist(string userId, string playlistName, bool isPu
14191424
/// default true. If true the playlist will be public, if false it will be private. To be able to
14201425
/// create private playlists, the user must have granted the playlist-modify-private scope.
14211426
/// </param>
1427+
/// <param name="isCollaborative">If true the playlist will become collaborative and other users will be able to modify the playlist in their Spotify client.
1428+
/// Note: You can only set collaborative to true on non-public playlists.</param>
1429+
/// <param name="playlistDescription">Value for playlist description as displayed in Spotify Clients and in the Web API.</param>
14221430
/// <returns></returns>
14231431
/// <remarks>AUTH NEEDED</remarks>
1424-
public Task<FullPlaylist> CreatePlaylistAsync(string userId, string playlistName, bool isPublic = true)
1432+
public Task<FullPlaylist> CreatePlaylistAsync(string userId, string playlistName, bool isPublic = true, bool isCollaborative = false, string playlistDescription = "")
14251433
{
14261434
JObject body = new JObject
14271435
{
14281436
{"name", playlistName},
1429-
{"public", isPublic}
1437+
{"public", isPublic},
1438+
{"collaborative", isCollaborative},
1439+
{"description", playlistDescription}
14301440
};
14311441
return UploadDataAsync<FullPlaylist>(_builder.CreatePlaylist(userId, playlistName, isPublic), body.ToString(Formatting.None));
14321442
}
@@ -1438,7 +1448,8 @@ public Task<FullPlaylist> CreatePlaylistAsync(string userId, string playlistName
14381448
/// <param name="playlistId">The Spotify ID for the playlist.</param>
14391449
/// <param name="newName">The new name for the playlist, for example "My New Playlist Title".</param>
14401450
/// <param name="newPublic">If true the playlist will be public, if false it will be private.</param>
1441-
/// <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>
1451+
/// <param name="newCollaborative">If true the playlist will become collaborative and other users will be able to modify the playlist in their Spotify client.
1452+
/// Note: You can only set collaborative to true on non-public playlists.</param>
14421453
/// <param name="newDescription">Value for playlist description as displayed in Spotify Clients and in the Web API.</param>
14431454
/// <returns></returns>
14441455
/// <remarks>AUTH NEEDED</remarks>
@@ -1463,15 +1474,21 @@ public ErrorResponse UpdatePlaylist(string userId, string playlistId, string new
14631474
/// <param name="playlistId">The Spotify ID for the playlist.</param>
14641475
/// <param name="newName">The new name for the playlist, for example "My New Playlist Title".</param>
14651476
/// <param name="newPublic">If true the playlist will be public, if false it will be private.</param>
1477+
/// <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>
1478+
/// <param name="newDescription">Value for playlist description as displayed in Spotify Clients and in the Web API.</param>
14661479
/// <returns></returns>
14671480
/// <remarks>AUTH NEEDED</remarks>
1468-
public async Task<ErrorResponse> UpdatePlaylistAsync(string userId, string playlistId, string newName = null, bool? newPublic = null)
1481+
public async Task<ErrorResponse> UpdatePlaylistAsync(string userId, string playlistId, string newName = null, bool? newPublic = null, bool? newCollaborative = null, string newDescription = null)
14691482
{
14701483
JObject body = new JObject();
14711484
if (newName != null)
14721485
body.Add("name", newName);
14731486
if (newPublic != null)
14741487
body.Add("public", newPublic);
1488+
if (newCollaborative != null)
1489+
body.Add("collaborative", newCollaborative);
1490+
if (newDescription != null)
1491+
body.Add("description", newDescription);
14751492
return (await UploadDataAsync<ErrorResponse>(_builder.UpdatePlaylist(userId, playlistId), body.ToString(Formatting.None), "PUT").ConfigureAwait(false)) ?? new ErrorResponse();
14761493
}
14771494

0 commit comments

Comments
 (0)