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:
Gavin 2022-11-08 14:58:05 -06:00 committed by GitHub
parent 167e96cd28
commit b39941f523
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 0 deletions

View File

@ -204,5 +204,14 @@ namespace SpotifyAPI.Web
/// </remarks> /// </remarks>
/// <returns></returns> /// <returns></returns>
Task<bool> AddToQueue(PlayerAddToQueueRequest request); 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();
} }
} }

View File

@ -17,6 +17,11 @@ namespace SpotifyAPI.Web
return statusCode == HttpStatusCode.NoContent; return statusCode == HttpStatusCode.NoContent;
} }
public Task<QueueResponse> GetQueue()
{
return API.Get<QueueResponse>(URLs.PlayerQueue());
}
public Task<DeviceResponse> GetAvailableDevices() public Task<DeviceResponse> GetAvailableDevices()
{ {
return API.Get<DeviceResponse>(URLs.PlayerDevices()); return API.Get<DeviceResponse>(URLs.PlayerDevices());

View 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!;
}
}