mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 22:56:25 +00:00
Added paylist-reordering
This commit is contained in:
parent
d0211fd03b
commit
98f3bf3952
@ -83,6 +83,7 @@
|
||||
<Compile Include="SpotifyWebAPI\Models\SimpleAlbum.cs" />
|
||||
<Compile Include="SpotifyWebAPI\Models\SimpleArtist.cs" />
|
||||
<Compile Include="SpotifyWebAPI\Models\SimpleTrack.cs" />
|
||||
<Compile Include="SpotifyWebAPI\Models\Snapshot.cs" />
|
||||
<Compile Include="SpotifyWebAPI\Models\Token.cs" />
|
||||
<Compile Include="SpotifyWebAPI\Models\SimplePlaylist.cs" />
|
||||
<Compile Include="SpotifyWebAPI\Models\Paging.cs" />
|
||||
|
11
SpotifyAPI/SpotifyWebAPI/Models/Snapshot.cs
Normal file
11
SpotifyAPI/SpotifyWebAPI/Models/Snapshot.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SpotifyAPI.SpotifyWebAPI.Models
|
||||
{
|
||||
public class Snapshot : BasicModel
|
||||
{
|
||||
[JsonProperty("snapshot_id")]
|
||||
public String SnapshotId { get; set; }
|
||||
}
|
||||
}
|
@ -161,13 +161,25 @@ namespace SpotifyAPI.SpotifyWebAPI
|
||||
{
|
||||
if (position == int.MaxValue)
|
||||
return UploadData<ErrorResponse>("https://api.spotify.com/v1/users/" + userId + "/playlists/" + playlistId + "/tracks", JsonConvert.SerializeObject(uris));
|
||||
else
|
||||
{
|
||||
String tracks = string.Join(",", uris);
|
||||
return UploadData<ErrorResponse>("https://api.spotify.com/v1/users/" + userId + "/playlists/" + playlistId + "/tracks?position=" + position
|
||||
+ "&ids=" + tracks
|
||||
, JsonConvert.SerializeObject(uris));
|
||||
}
|
||||
String tracks = string.Join(",", uris);
|
||||
return UploadData<ErrorResponse>("https://api.spotify.com/v1/users/" + userId + "/playlists/" + playlistId + "/tracks?position=" + position
|
||||
+ "&ids=" + tracks
|
||||
, JsonConvert.SerializeObject(uris));
|
||||
}
|
||||
|
||||
public Snapshot ReorderPlaylist(String userId, String playlistId, int rangeStart, int rangeLength,
|
||||
int insertBefore, String snapshotId = "")
|
||||
{
|
||||
JObject ob = new JObject();
|
||||
ob.Add("range_start", rangeStart);
|
||||
ob.Add("range_length", rangeLength);
|
||||
ob.Add("insert_before", insertBefore);
|
||||
if(snapshotId != "")
|
||||
ob.Add("snapshot_id", snapshotId);
|
||||
return
|
||||
UploadData<Snapshot>(
|
||||
"https://api.spotify.com/v1/users/" + userId + "/playlists/" + playlistId + "/tracks",
|
||||
ob.ToString(Formatting.None), "PUT");
|
||||
}
|
||||
public FeaturedPlaylists GetFeaturedPlaylists(String locale = "", String country = "", DateTime timestamp = default(DateTime), int limit = 20, int offset = 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user