mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 14:46:26 +00:00
Adding Endpoint to get a User's Queue (#807)
* Adding support to Get a player queue * Update to return Tracks and Episodes
This commit is contained in:
parent
167e96cd28
commit
b39941f523
@ -204,5 +204,14 @@ namespace SpotifyAPI.Web
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
Task<bool> AddToQueue(PlayerAddToQueueRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Get the list of objects that make up the user's queue.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.spotify.com/documentation/web-api/reference/#/operations/get-queue
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
Task<QueueResponse> GetQueue();
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,11 @@ namespace SpotifyAPI.Web
|
||||
return statusCode == HttpStatusCode.NoContent;
|
||||
}
|
||||
|
||||
public Task<QueueResponse> GetQueue()
|
||||
{
|
||||
return API.Get<QueueResponse>(URLs.PlayerQueue());
|
||||
}
|
||||
|
||||
public Task<DeviceResponse> GetAvailableDevices()
|
||||
{
|
||||
return API.Get<DeviceResponse>(URLs.PlayerDevices());
|
||||
|
14
SpotifyAPI.Web/Models/Response/QueueResponse.cs
Normal file
14
SpotifyAPI.Web/Models/Response/QueueResponse.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SpotifyAPI.Web
|
||||
{
|
||||
public class QueueResponse
|
||||
{
|
||||
[JsonConverter(typeof(PlayableItemConverter))]
|
||||
public IPlayableItem CurrentlyPlaying { get; set; } = default!;
|
||||
[JsonProperty(ItemConverterType = typeof(PlayableItemConverter))]
|
||||
public List<IPlayableItem> Queue { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user