mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 22:56:25 +00:00
Adds collaborative and description to UpdatePlaylist and CreatePlaylist
This commit is contained in:
parent
acc59d11bf
commit
a82bbbf5b7
@ -1395,14 +1395,19 @@ namespace SpotifyAPI.Web
|
||||
/// default true. If true the playlist will be public, if false it will be private. To be able to
|
||||
/// create private playlists, the user must have granted the playlist-modify-private scope.
|
||||
/// </param>
|
||||
/// <param name="isCollaborative">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="playlistDescription">Value for playlist description as displayed in Spotify Clients and in the Web API.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public FullPlaylist CreatePlaylist(string userId, string playlistName, bool isPublic = true)
|
||||
public FullPlaylist CreatePlaylist(string userId, string playlistName, bool isPublic = true, bool isCollaborative = false, string playlistDescription = "")
|
||||
{
|
||||
JObject body = new JObject
|
||||
{
|
||||
{"name", playlistName},
|
||||
{"public", isPublic}
|
||||
{"public", isPublic},
|
||||
{"collaborative", isCollaborative},
|
||||
{"description", playlistDescription}
|
||||
};
|
||||
return UploadData<FullPlaylist>(_builder.CreatePlaylist(userId, playlistName, isPublic), body.ToString(Formatting.None));
|
||||
}
|
||||
@ -1419,14 +1424,19 @@ namespace SpotifyAPI.Web
|
||||
/// default true. If true the playlist will be public, if false it will be private. To be able to
|
||||
/// create private playlists, the user must have granted the playlist-modify-private scope.
|
||||
/// </param>
|
||||
/// <param name="isCollaborative">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="playlistDescription">Value for playlist description as displayed in Spotify Clients and in the Web API.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public Task<FullPlaylist> CreatePlaylistAsync(string userId, string playlistName, bool isPublic = true)
|
||||
public Task<FullPlaylist> CreatePlaylistAsync(string userId, string playlistName, bool isPublic = true, bool isCollaborative = false, string playlistDescription = "")
|
||||
{
|
||||
JObject body = new JObject
|
||||
{
|
||||
{"name", playlistName},
|
||||
{"public", isPublic}
|
||||
{"public", isPublic},
|
||||
{"collaborative", isCollaborative},
|
||||
{"description", playlistDescription}
|
||||
};
|
||||
return UploadDataAsync<FullPlaylist>(_builder.CreatePlaylist(userId, playlistName, isPublic), body.ToString(Formatting.None));
|
||||
}
|
||||
@ -1438,7 +1448,8 @@ namespace SpotifyAPI.Web
|
||||
/// <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="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="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>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
@ -1463,15 +1474,21 @@ namespace SpotifyAPI.Web
|
||||
/// <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="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>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public async Task<ErrorResponse> UpdatePlaylistAsync(string userId, string playlistId, string newName = null, bool? newPublic = null)
|
||||
public async Task<ErrorResponse> UpdatePlaylistAsync(string userId, string playlistId, string newName = null, bool? newPublic = null, bool? newCollaborative = null, string newDescription = null)
|
||||
{
|
||||
JObject body = new JObject();
|
||||
if (newName != null)
|
||||
body.Add("name", newName);
|
||||
if (newPublic != null)
|
||||
body.Add("public", newPublic);
|
||||
if (newCollaborative != null)
|
||||
body.Add("collaborative", newCollaborative);
|
||||
if (newDescription != null)
|
||||
body.Add("description", newDescription);
|
||||
return (await UploadDataAsync<ErrorResponse>(_builder.UpdatePlaylist(userId, playlistId), body.ToString(Formatting.None), "PUT").ConfigureAwait(false)) ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user