diff --git a/SpotifyAPI.Web/SpotifyWebAPI.cs b/SpotifyAPI.Web/SpotifyWebAPI.cs
index c7ce8512..7eba5cfe 100644
--- a/SpotifyAPI.Web/SpotifyWebAPI.cs
+++ b/SpotifyAPI.Web/SpotifyWebAPI.cs
@@ -1319,6 +1319,7 @@ namespace SpotifyAPI.Web
/// An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.
///
/// AUTH NEEDED
+ [Obsolete("Calling GetPlaylist with a userId is deprecated, remove the parameter")]
public FullPlaylist GetPlaylist(string userId, string playlistId, string fields = "", string market = "")
{
if (!UseAuth)
@@ -1326,6 +1327,24 @@ namespace SpotifyAPI.Web
return DownloadData(_builder.GetPlaylist(userId, playlistId, fields, market));
}
+ ///
+ /// Get a playlist owned by a Spotify user.
+ ///
+ /// The Spotify ID for the playlist.
+ ///
+ /// Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are
+ /// returned.
+ ///
+ /// An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.
+ ///
+ /// AUTH NEEDED
+ public FullPlaylist GetPlaylist(string playlistId, string fields = "", string market = "")
+ {
+ if (!UseAuth)
+ throw new InvalidOperationException("Auth is required for GetPlaylist");
+ return DownloadData(_builder.GetPlaylist(playlistId, fields, market));
+ }
+
///
/// Get a playlist owned by a Spotify user asynchronously.
///
@@ -1338,6 +1357,7 @@ namespace SpotifyAPI.Web
/// An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.
///
/// AUTH NEEDED
+ [Obsolete("Calling GetPlaylist with a userId is deprecated, remove the parameter")]
public Task GetPlaylistAsync(string userId, string playlistId, string fields = "", string market = "")
{
if (!UseAuth)
@@ -1345,6 +1365,24 @@ namespace SpotifyAPI.Web
return DownloadDataAsync(_builder.GetPlaylist(userId, playlistId, fields, market));
}
+ ///
+ /// Get a playlist owned by a Spotify user asynchronously.
+ ///
+ /// The Spotify ID for the playlist.
+ ///
+ /// Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are
+ /// returned.
+ ///
+ /// An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.
+ ///
+ /// AUTH NEEDED
+ public Task GetPlaylistAsync(string playlistId, string fields = "", string market = "")
+ {
+ if (!UseAuth)
+ throw new InvalidOperationException("Auth is required for GetPlaylist");
+ return DownloadDataAsync(_builder.GetPlaylist(playlistId, fields, market));
+ }
+
///
/// Get full details of the tracks of a playlist owned by a Spotify user.
///
@@ -1359,6 +1397,7 @@ namespace SpotifyAPI.Web
/// An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.
///
/// AUTH NEEDED
+ [Obsolete("Calling GetPlaylistTracks with a userId is deprecated, remove the parameter")]
public Paging GetPlaylistTracks(string userId, string playlistId, string fields = "", int limit = 100, int offset = 0, string market = "")
{
if (!UseAuth)
@@ -1366,6 +1405,26 @@ namespace SpotifyAPI.Web
return DownloadData>(_builder.GetPlaylistTracks(userId, playlistId, fields, limit, offset, market));
}
+ ///
+ /// Get full details of the tracks of a playlist owned by a Spotify user.
+ ///
+ /// The Spotify ID for the playlist.
+ ///
+ /// Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are
+ /// returned.
+ ///
+ /// The maximum number of tracks to return. Default: 100. Minimum: 1. Maximum: 100.
+ /// The index of the first object to return. Default: 0 (i.e., the first object)
+ /// An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.
+ ///
+ /// AUTH NEEDED
+ public Paging GetPlaylistTracks(string playlistId, string fields = "", int limit = 100, int offset = 0, string market = "")
+ {
+ if (!UseAuth)
+ throw new InvalidOperationException("Auth is required for GetPlaylistTracks");
+ return DownloadData>(_builder.GetPlaylistTracks(playlistId, fields, limit, offset, market));
+ }
+
///
/// Get full details of the tracks of a playlist owned by a Spotify user asyncronously.
///
@@ -1380,6 +1439,7 @@ namespace SpotifyAPI.Web
/// An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.
///
/// AUTH NEEDED
+ [Obsolete("Calling GetPlaylistTracks with a userId is deprecated, remove the parameter")]
public Task> GetPlaylistTracksAsync(string userId, string playlistId, string fields = "", int limit = 100, int offset = 0, string market = "")
{
if (!UseAuth)
@@ -1387,6 +1447,27 @@ namespace SpotifyAPI.Web
return DownloadDataAsync>(_builder.GetPlaylistTracks(userId, playlistId, fields, limit, offset, market));
}
+ ///
+ /// Get full details of the tracks of a playlist owned by a Spotify user asyncronously.
+ ///
+ /// The Spotify ID for the playlist.
+ ///
+ /// Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are
+ /// returned.
+ ///
+ /// The maximum number of tracks to return. Default: 100. Minimum: 1. Maximum: 100.
+ /// The index of the first object to return. Default: 0 (i.e., the first object)
+ /// An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.
+ ///
+ /// AUTH NEEDED
+ [Obsolete("Calling GetPlaylistTracks with a userId is deprecated, remove the parameter")]
+ public Task> GetPlaylistTracksAsync(string playlistId, string fields = "", int limit = 100, int offset = 0, string market = "")
+ {
+ if (!UseAuth)
+ throw new InvalidOperationException("Auth is required for GetPlaylistTracks");
+ return DownloadDataAsync>(_builder.GetPlaylistTracks(playlistId, fields, limit, offset, market));
+ }
+
///
/// Create a playlist for a Spotify user. (The playlist will be empty until you add tracks.)
///
@@ -1457,6 +1538,7 @@ namespace SpotifyAPI.Web
/// Value for playlist description as displayed in Spotify Clients and in the Web API.
///
/// AUTH NEEDED
+ [Obsolete("Calling UpdatePlaylist with a userId is deprecated, remove the parameter")]
public ErrorResponse UpdatePlaylist(string userId, string playlistId, string newName = null, bool? newPublic = null, bool? newCollaborative = null, string newDescription = null)
{
JObject body = new JObject();
@@ -1471,6 +1553,31 @@ namespace SpotifyAPI.Web
return UploadData(_builder.UpdatePlaylist(userId, playlistId), body.ToString(Formatting.None), "PUT") ?? new ErrorResponse();
}
+ ///
+ /// Change a playlist’s name and public/private state. (The user must, of course, own the playlist.)
+ ///
+ /// The Spotify ID for the playlist.
+ /// The new name for the playlist, for example "My New Playlist Title".
+ /// If true the playlist will be public, if false it will be private.
+ /// 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.
+ /// Value for playlist description as displayed in Spotify Clients and in the Web API.
+ ///
+ /// AUTH NEEDED
+ public ErrorResponse UpdatePlaylist(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 UploadData(_builder.UpdatePlaylist(playlistId), body.ToString(Formatting.None), "PUT") ?? new ErrorResponse();
+ }
+
///
/// Change a playlist’s name and public/private state asynchronously. (The user must, of course, own the playlist.)
///
@@ -1482,6 +1589,7 @@ namespace SpotifyAPI.Web
/// Value for playlist description as displayed in Spotify Clients and in the Web API.
///
/// AUTH NEEDED
+ [Obsolete("Calling UpdatePlaylist with a userId is deprecated, remove the parameter")]
public async Task UpdatePlaylistAsync(string userId, string playlistId, string newName = null, bool? newPublic = null, bool? newCollaborative = null, string newDescription = null)
{
JObject body = new JObject();
@@ -1495,6 +1603,30 @@ namespace SpotifyAPI.Web
body.Add("description", newDescription);
return (await UploadDataAsync(_builder.UpdatePlaylist(userId, playlistId), body.ToString(Formatting.None), "PUT").ConfigureAwait(false)) ?? new ErrorResponse();
}
+
+ ///
+ /// Change a playlist’s name and public/private state asynchronously. (The user must, of course, own the playlist.)
+ ///
+ /// The Spotify ID for the playlist.
+ /// The new name for the playlist, for example "My New Playlist Title".
+ /// If true the playlist will be public, if false it will be private.
+ /// 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.
+ /// Value for playlist description as displayed in Spotify Clients and in the Web API.
+ ///
+ /// AUTH NEEDED
+ public async Task UpdatePlaylistAsync(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(_builder.UpdatePlaylist(playlistId), body.ToString(Formatting.None), "PUT").ConfigureAwait(false)) ?? new ErrorResponse();
+ }
///
/// Change a playlist’s name and public/private state. (The user must, of course, own the playlist.)
@@ -1543,7 +1675,8 @@ namespace SpotifyAPI.Web
/// AUTH NEEDED
public async Task UploadPlaylistImageAsync(string playlistId, string base64EncodedJpgImage)
{
- return (await UploadDataAsync(_builder.UploadPlaylistImage(playlistId), base64EncodedJpgImage, "PUT").ConfigureAwait(false)) ?? new ErrorResponse();
+ return (await UploadDataAsync(_builder.UploadPlaylistImage(playlistId),
+ base64EncodedJpgImage, "PUT").ConfigureAwait(false)) ?? new ErrorResponse();
}
///
@@ -1555,6 +1688,7 @@ namespace SpotifyAPI.Web
/// A list of Spotify track URIs to set. A maximum of 100 tracks can be set in one request.
///
/// AUTH NEEDED
+ [Obsolete("Calling ReplacePlaylistTracks with a userId is deprecated, remove the parameter")]
public ErrorResponse ReplacePlaylistTracks(string userId, string playlistId, List uris)
{
JObject body = new JObject
@@ -1564,6 +1698,23 @@ namespace SpotifyAPI.Web
return UploadData(_builder.ReplacePlaylistTracks(userId, playlistId), body.ToString(Formatting.None), "PUT") ?? new ErrorResponse();
}
+ ///
+ /// Replace all the tracks in a playlist, overwriting its existing tracks. This powerful request can be useful for
+ /// replacing tracks, re-ordering existing tracks, or clearing the playlist.
+ ///
+ /// The Spotify ID for the playlist.
+ /// A list of Spotify track URIs to set. A maximum of 100 tracks can be set in one request.
+ ///
+ /// AUTH NEEDED
+ public ErrorResponse ReplacePlaylistTracks(string playlistId, List uris)
+ {
+ JObject body = new JObject
+ {
+ {"uris", new JArray(uris.Take(100))}
+ };
+ return UploadData(_builder.ReplacePlaylistTracks(playlistId), body.ToString(Formatting.None), "PUT") ?? new ErrorResponse();
+ }
+
///
/// Replace all the tracks in a playlist asynchronously, overwriting its existing tracks. This powerful request can be useful for
/// replacing tracks, re-ordering existing tracks, or clearing the playlist.
@@ -1573,6 +1724,7 @@ namespace SpotifyAPI.Web
/// A list of Spotify track URIs to set. A maximum of 100 tracks can be set in one request.
///
/// AUTH NEEDED
+ [Obsolete("Calling ReplacePlaylistTracks with a userId is deprecated, remove the parameter")]
public async Task ReplacePlaylistTracksAsync(string userId, string playlistId, List uris)
{
JObject body = new JObject
@@ -1582,6 +1734,23 @@ namespace SpotifyAPI.Web
return await (UploadDataAsync(_builder.ReplacePlaylistTracks(userId, playlistId), body.ToString(Formatting.None), "PUT").ConfigureAwait(false)) ?? new ErrorResponse();
}
+ ///
+ /// Replace all the tracks in a playlist asynchronously, overwriting its existing tracks. This powerful request can be useful for
+ /// replacing tracks, re-ordering existing tracks, or clearing the playlist.
+ ///
+ /// The Spotify ID for the playlist.
+ /// A list of Spotify track URIs to set. A maximum of 100 tracks can be set in one request.
+ ///
+ /// AUTH NEEDED
+ public async Task ReplacePlaylistTracksAsync(string playlistId, List uris)
+ {
+ JObject body = new JObject
+ {
+ {"uris", new JArray(uris.Take(100))}
+ };
+ return await (UploadDataAsync(_builder.ReplacePlaylistTracks(playlistId), body.ToString(Formatting.None), "PUT").ConfigureAwait(false)) ?? new ErrorResponse();
+ }
+
///
/// Remove one or more tracks from a user’s playlist.
///
@@ -1593,6 +1762,7 @@ namespace SpotifyAPI.Web
///
///
/// AUTH NEEDED
+ [Obsolete("Calling RemovePlaylistTracks with a userId is deprecated, remove the parameter")]
public ErrorResponse RemovePlaylistTracks(string userId, string playlistId, List uris)
{
JObject body = new JObject
@@ -1602,6 +1772,25 @@ namespace SpotifyAPI.Web
return UploadData(_builder.RemovePlaylistTracks(userId, playlistId, uris), body.ToString(Formatting.None), "DELETE") ?? new ErrorResponse();
}
+ ///
+ /// Remove one or more tracks from a user’s playlist.
+ ///
+ /// The Spotify ID for the playlist.
+ ///
+ /// array of objects containing Spotify URI strings (and their position in the playlist). A maximum of
+ /// 100 objects can be sent at once.
+ ///
+ ///
+ /// AUTH NEEDED
+ public ErrorResponse RemovePlaylistTracks(string playlistId, List uris)
+ {
+ JObject body = new JObject
+ {
+ {"tracks", JArray.FromObject(uris.Take(100))}
+ };
+ return UploadData(_builder.RemovePlaylistTracks(playlistId, uris), body.ToString(Formatting.None), "DELETE") ?? new ErrorResponse();
+ }
+
///
/// Remove one or more tracks from a user’s playlist asynchronously.
///
@@ -1613,6 +1802,7 @@ namespace SpotifyAPI.Web
///
///
/// AUTH NEEDED
+ [Obsolete("Calling RemovePlaylistTracks with a userId is deprecated, remove the parameter")]
public async Task RemovePlaylistTracksAsync(string userId, string playlistId, List uris)
{
JObject body = new JObject
@@ -1622,6 +1812,25 @@ namespace SpotifyAPI.Web
return await (UploadDataAsync(_builder.RemovePlaylistTracks(userId, playlistId, uris), body.ToString(Formatting.None), "DELETE").ConfigureAwait(false)) ?? new ErrorResponse();
}
+ ///
+ /// Remove one or more tracks from a user’s playlist asynchronously.
+ ///
+ /// The Spotify ID for the playlist.
+ ///
+ /// array of objects containing Spotify URI strings (and their position in the playlist). A maximum of
+ /// 100 objects can be sent at once.
+ ///
+ ///
+ /// AUTH NEEDED
+ public async Task RemovePlaylistTracksAsync(string playlistId, List uris)
+ {
+ JObject body = new JObject
+ {
+ {"tracks", JArray.FromObject(uris.Take(100))}
+ };
+ return await (UploadDataAsync(_builder.RemovePlaylistTracks(playlistId, uris), body.ToString(Formatting.None), "DELETE").ConfigureAwait(false)) ?? new ErrorResponse();
+ }
+
///
/// Remove a track from a user’s playlist.
///
@@ -1630,9 +1839,22 @@ namespace SpotifyAPI.Web
/// Spotify URI
///
/// AUTH NEEDED
+ [Obsolete("Calling RemovePlaylistTrack with a userId is deprecated, remove the parameter")]
public ErrorResponse RemovePlaylistTrack(string userId, string playlistId, DeleteTrackUri uri)
{
- return RemovePlaylistTracks(userId, playlistId, new List { uri });
+ return RemovePlaylistTracks(playlistId, new List { uri });
+ }
+
+ ///
+ /// Remove a track from a user’s playlist.
+ ///
+ /// The Spotify ID for the playlist.
+ /// Spotify URI
+ ///
+ /// AUTH NEEDED
+ public ErrorResponse RemovePlaylistTrack(string playlistId, DeleteTrackUri uri)
+ {
+ return RemovePlaylistTracks(playlistId, new List { uri });
}
///
@@ -1643,9 +1865,22 @@ namespace SpotifyAPI.Web
/// Spotify URI
///
/// AUTH NEEDED
+ [Obsolete("Calling RemovePlaylistTrack with a userId is deprecated, remove the parameter")]
public Task RemovePlaylistTrackAsync(string userId, string playlistId, DeleteTrackUri uri)
{
- return RemovePlaylistTracksAsync(userId, playlistId, new List { uri });
+ return RemovePlaylistTracksAsync(playlistId, new List { uri });
+ }
+
+ ///
+ /// Remove a track from a user’s playlist asynchronously.
+ ///
+ /// The Spotify ID for the playlist.
+ /// Spotify URI
+ ///
+ /// AUTH NEEDED
+ public Task RemovePlaylistTrackAsync(string playlistId, DeleteTrackUri uri)
+ {
+ return RemovePlaylistTracksAsync(playlistId, new List { uri });
}
///
@@ -1657,6 +1892,7 @@ namespace SpotifyAPI.Web
/// The position to insert the tracks, a zero-based index
///
/// AUTH NEEDED
+ [Obsolete("Calling AddPlaylistTracks with a userId is deprecated, remove the parameter")]
public ErrorResponse AddPlaylistTracks(string userId, string playlistId, List uris, int? position = null)
{
JObject body = new JObject
@@ -1666,6 +1902,23 @@ namespace SpotifyAPI.Web
return UploadData(_builder.AddPlaylistTracks(userId, playlistId, uris, position), body.ToString(Formatting.None)) ?? new ErrorResponse();
}
+ ///
+ /// Add one or more tracks to a user’s playlist.
+ ///
+ /// The Spotify ID for the playlist.
+ /// A list of Spotify track URIs to add
+ /// The position to insert the tracks, a zero-based index
+ ///
+ /// AUTH NEEDED
+ public ErrorResponse AddPlaylistTracks(string playlistId, List uris, int? position = null)
+ {
+ JObject body = new JObject
+ {
+ {"uris", JArray.FromObject(uris.Take(100))}
+ };
+ return UploadData(_builder.AddPlaylistTracks(playlistId, uris, position), body.ToString(Formatting.None)) ?? new ErrorResponse();
+ }
+
///
/// Add one or more tracks to a user’s playlist asynchronously.
///
@@ -1675,6 +1928,7 @@ namespace SpotifyAPI.Web
/// The position to insert the tracks, a zero-based index
///
/// AUTH NEEDED
+ [Obsolete("Calling AddPlaylistTracks with a userId is deprecated, remove the parameter")]
public async Task AddPlaylistTracksAsync(string userId, string playlistId, List uris, int? position = null)
{
JObject body = new JObject
@@ -1684,6 +1938,23 @@ namespace SpotifyAPI.Web
return await (UploadDataAsync(_builder.AddPlaylistTracks(userId, playlistId, uris, position), body.ToString(Formatting.None)).ConfigureAwait(false)) ?? new ErrorResponse();
}
+ ///
+ /// Add one or more tracks to a user’s playlist asynchronously.
+ ///
+ /// The Spotify ID for the playlist.
+ /// A list of Spotify track URIs to add
+ /// The position to insert the tracks, a zero-based index
+ ///
+ /// AUTH NEEDED
+ public async Task AddPlaylistTracksAsync(string playlistId, List uris, int? position = null)
+ {
+ JObject body = new JObject
+ {
+ {"uris", JArray.FromObject(uris.Take(100))}
+ };
+ return await (UploadDataAsync(_builder.AddPlaylistTracks(playlistId, uris, position), body.ToString(Formatting.None)).ConfigureAwait(false)) ?? new ErrorResponse();
+ }
+
///
/// Add a track to a user’s playlist.
///
@@ -1693,9 +1964,24 @@ namespace SpotifyAPI.Web
/// The position to insert the tracks, a zero-based index
///
/// AUTH NEEDED
+ [Obsolete("Calling AddPlaylistTrack with a userId is deprecated, remove the parameter")]
public ErrorResponse AddPlaylistTrack(string userId, string playlistId, string uri, int? position = null)
{
- return AddPlaylistTracks(userId, playlistId, new List { uri }, position);
+ return AddPlaylistTracks(playlistId, new List { uri }, position);
+ }
+
+
+ ///
+ /// Add a track to a user’s playlist.
+ ///
+ /// The Spotify ID for the playlist.
+ /// A Spotify Track URI
+ /// The position to insert the tracks, a zero-based index
+ ///
+ /// AUTH NEEDED
+ public ErrorResponse AddPlaylistTrack(string playlistId, string uri, int? position = null)
+ {
+ return AddPlaylistTracks(playlistId, new List { uri }, position);
}
///
@@ -1707,11 +1993,25 @@ namespace SpotifyAPI.Web
/// The position to insert the tracks, a zero-based index
///
/// AUTH NEEDED
+ [Obsolete("Calling AddPlaylistTrack with a userId is deprecated, remove the parameter")]
public Task AddPlaylistTrackAsync(string userId, string playlistId, string uri, int? position = null)
{
return AddPlaylistTracksAsync(userId, playlistId, new List { uri }, position);
}
+ ///
+ /// Add a track to a user’s playlist asynchronously.
+ ///
+ /// The Spotify ID for the playlist.
+ /// A Spotify Track URI
+ /// The position to insert the tracks, a zero-based index
+ ///
+ /// AUTH NEEDED
+ public Task AddPlaylistTrackAsync(string playlistId, string uri, int? position = null)
+ {
+ return AddPlaylistTracksAsync(playlistId, new List { uri }, position);
+ }
+
///
/// Reorder a track or a group of tracks in a playlist.
///
@@ -1723,6 +2023,7 @@ namespace SpotifyAPI.Web
/// The playlist's snapshot ID against which you want to make the changes.
///
/// AUTH NEEDED
+ [Obsolete("Calling ReorderPlaylist with a userId is deprecated, remove the parameter")]
public Snapshot ReorderPlaylist(string userId, string playlistId, int rangeStart, int insertBefore, int rangeLength = 1, string snapshotId = "")
{
JObject body = new JObject
@@ -1736,6 +2037,29 @@ namespace SpotifyAPI.Web
return UploadData(_builder.ReorderPlaylist(userId, playlistId), body.ToString(Formatting.None), "PUT");
}
+ ///
+ /// Reorder a track or a group of tracks in a playlist.
+ ///
+ /// The Spotify ID for the playlist.
+ /// The position of the first track to be reordered.
+ /// The position where the tracks should be inserted.
+ /// The amount of tracks to be reordered. Defaults to 1 if not set.
+ /// The playlist's snapshot ID against which you want to make the changes.
+ ///
+ /// AUTH NEEDED
+ public Snapshot ReorderPlaylist(string playlistId, int rangeStart, int insertBefore, int rangeLength = 1, string snapshotId = "")
+ {
+ JObject body = new JObject
+ {
+ {"range_start", rangeStart},
+ {"range_length", rangeLength},
+ {"insert_before", insertBefore}
+ };
+ if (!string.IsNullOrEmpty(snapshotId))
+ body.Add("snapshot_id", snapshotId);
+ return UploadData(_builder.ReorderPlaylist(playlistId), body.ToString(Formatting.None), "PUT");
+ }
+
///
/// Reorder a track or a group of tracks in a playlist asynchronously.
///
@@ -1747,6 +2071,7 @@ namespace SpotifyAPI.Web
/// The playlist's snapshot ID against which you want to make the changes.
///
/// AUTH NEEDED
+ [Obsolete("Calling ReorderPlaylist with a userId is deprecated, remove the parameter")]
public Task ReorderPlaylistAsync(string userId, string playlistId, int rangeStart, int insertBefore, int rangeLength = 1, string snapshotId = "")
{
JObject body = new JObject
@@ -1761,6 +2086,30 @@ namespace SpotifyAPI.Web
return UploadDataAsync(_builder.ReorderPlaylist(userId, playlistId), body.ToString(Formatting.None), "PUT");
}
+ ///
+ /// Reorder a track or a group of tracks in a playlist asynchronously.
+ ///
+ /// The Spotify ID for the playlist.
+ /// The position of the first track to be reordered.
+ /// The position where the tracks should be inserted.
+ /// The amount of tracks to be reordered. Defaults to 1 if not set.
+ /// The playlist's snapshot ID against which you want to make the changes.
+ ///
+ /// AUTH NEEDED
+ public Task ReorderPlaylistAsync(string playlistId, int rangeStart, int insertBefore, int rangeLength = 1, string snapshotId = "")
+ {
+ JObject body = new JObject
+ {
+ {"range_start", rangeStart},
+ {"range_length", rangeLength},
+ {"insert_before", insertBefore},
+ {"snapshot_id", snapshotId}
+ };
+ if (!string.IsNullOrEmpty(snapshotId))
+ body.Add("snapshot_id", snapshotId);
+ return UploadDataAsync(_builder.ReorderPlaylist(playlistId), body.ToString(Formatting.None), "PUT");
+ }
+
#endregion Playlists
#region Profiles
diff --git a/SpotifyAPI.Web/SpotifyWebBuilder.cs b/SpotifyAPI.Web/SpotifyWebBuilder.cs
index d1778285..92877243 100644
--- a/SpotifyAPI.Web/SpotifyWebBuilder.cs
+++ b/SpotifyAPI.Web/SpotifyWebBuilder.cs
@@ -649,6 +649,26 @@ namespace SpotifyAPI.Web
return builder.ToString();
}
+ ///
+ /// Get a playlist owned by a Spotify user.
+ ///
+ /// The Spotify ID for the playlist.
+ ///
+ /// Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are
+ /// returned.
+ ///
+ /// An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.
+ ///
+ /// AUTH NEEDED
+ public string GetPlaylist(string playlistId, string fields = "", string market = "")
+ {
+ StringBuilder builder = new StringBuilder(APIBase + "/playlists/" + playlistId);
+ builder.Append("?fields=" + fields);
+ if (!string.IsNullOrEmpty(market))
+ builder.Append("&market=" + market);
+ return builder.ToString();
+ }
+
///
/// Get full details of the tracks of a playlist owned by a Spotify user.
///
@@ -675,6 +695,31 @@ namespace SpotifyAPI.Web
return builder.ToString();
}
+ ///
+ /// Get full details of the tracks of a playlist owned by a Spotify user.
+ ///
+ /// The Spotify ID for the playlist.
+ ///
+ /// Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are
+ /// returned.
+ ///
+ /// The maximum number of tracks to return. Default: 100. Minimum: 1. Maximum: 100.
+ /// The index of the first object to return. Default: 0 (i.e., the first object)
+ /// An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.
+ ///
+ /// AUTH NEEDED
+ public string GetPlaylistTracks(string playlistId, string fields = "", int limit = 100, int offset = 0, string market = "")
+ {
+ limit = Math.Min(limit, 100);
+ StringBuilder builder = new StringBuilder(APIBase + "/playlists/" + playlistId + "/tracks");
+ builder.Append("?fields=" + fields);
+ builder.Append("&limit=" + limit);
+ builder.Append("&offset=" + offset);
+ if (!string.IsNullOrEmpty(market))
+ builder.Append("&market=" + market);
+ return builder.ToString();
+ }
+
///
/// Create a playlist for a Spotify user. (The playlist will be empty until you add tracks.)
///
@@ -706,6 +751,17 @@ namespace SpotifyAPI.Web
return $"{APIBase}/users/{userId}/playlists/{playlistId}";
}
+ ///
+ /// Change a playlist’s name and public/private state. (The user must, of course, own the playlist.)
+ ///
+ /// The Spotify ID for the playlist.
+ ///
+ /// AUTH NEEDED
+ public string UpdatePlaylist(string playlistId)
+ {
+ return $"{APIBase}/playlists/{playlistId}";
+ }
+
///
/// Replace all the tracks in a playlist, overwriting its existing tracks. This powerful request can be useful for
/// replacing tracks, re-ordering existing tracks, or clearing the playlist.
@@ -719,6 +775,18 @@ namespace SpotifyAPI.Web
return $"{APIBase}/users/{userId}/playlists/{playlistId}/tracks";
}
+ ///
+ /// Replace all the tracks in a playlist, overwriting its existing tracks. This powerful request can be useful for
+ /// replacing tracks, re-ordering existing tracks, or clearing the playlist.
+ ///
+ /// The Spotify ID for the playlist.
+ ///
+ /// AUTH NEEDED
+ public string ReplacePlaylistTracks(string playlistId)
+ {
+ return $"{APIBase}/playlists/{playlistId}/tracks";
+ }
+
///
/// Remove one or more tracks from a user’s playlist.
///
@@ -735,6 +803,21 @@ namespace SpotifyAPI.Web
return $"{APIBase}/users/{userId}/playlists/{playlistId}/tracks";
}
+ ///
+ /// Remove one or more tracks from a user’s playlist.
+ ///
+ /// The Spotify ID for the playlist.
+ ///
+ /// array of objects containing Spotify URI strings (and their position in the playlist). A maximum of
+ /// 100 objects can be sent at once.
+ ///
+ ///
+ /// AUTH NEEDED
+ public string RemovePlaylistTracks(string playlistId, List uris)
+ {
+ return $"{APIBase}/playlists/{playlistId}/tracks";
+ }
+
///
/// Add one or more tracks to a user’s playlist.
///
@@ -751,6 +834,21 @@ namespace SpotifyAPI.Web
return $"{APIBase}/users/{userId}/playlists/{playlistId}/tracks?position={position}";
}
+ ///
+ /// Add one or more tracks to a user’s playlist.
+ ///
+ /// The Spotify ID for the playlist.
+ /// A list of Spotify track URIs to add
+ /// The position to insert the tracks, a zero-based index
+ ///
+ /// AUTH NEEDED
+ public string AddPlaylistTracks(string playlistId, List uris, int? position = null)
+ {
+ if (position == null)
+ return $"{APIBase}/playlists/{playlistId}/tracks";
+ return $"{APIBase}/playlists/{playlistId}/tracks?position={position}";
+ }
+
///
/// Reorder a track or a group of tracks in a playlist.
///
@@ -762,6 +860,17 @@ namespace SpotifyAPI.Web
{
return $"{APIBase}/users/{userId}/playlists/{playlistId}/tracks";
}
+
+ ///
+ /// Reorder a track or a group of tracks in a playlist.
+ ///
+ /// The Spotify ID for the playlist.
+ ///
+ /// AUTH NEEDED
+ public string ReorderPlaylist(string playlistId)
+ {
+ return $"{APIBase}/playlists/{playlistId}/tracks";
+ }
///
/// Upload an image for a playlist.