27 lines
1.2 KiB
C#
27 lines
1.2 KiB
C#
using System.Collections.Specialized;
|
|
using System.Net;
|
|
using System.Net.Http.Headers;
|
|
using YandexMusic.API.Models.Queue;
|
|
|
|
namespace YandexMusic.API.Requests.Queue;
|
|
|
|
public class YQueueUpdatePositionBuilder : YMusicRequestBuilder<YUpdatedQueue?, (string queueId, int currentIndex, bool isInteractive)>
|
|
{
|
|
private string? _device;
|
|
public YQueueUpdatePositionBuilder(YandexMusicApi api, string? device = null) : base(api) => _device = device;
|
|
protected override string Method => WebRequestMethods.Http.Post;
|
|
protected override string PathTemplate => "queues/{queueId}/update-position";
|
|
protected override Dictionary<string, string> GetSubstitutions((string queueId, int currentIndex, bool isInteractive) tuple)
|
|
=> new() { { "queueId", tuple.queueId } };
|
|
protected override NameValueCollection GetQueryParams((string queueId, int currentIndex, bool isInteractive) tuple)
|
|
=> new()
|
|
{
|
|
{ "currentIndex", tuple.currentIndex.ToString() },
|
|
{ "isInteractive", tuple.isInteractive.ToString().ToLower() }
|
|
};
|
|
protected override void SetCustomHeaders(HttpRequestHeaders headers)
|
|
{
|
|
if (!string.IsNullOrEmpty(_device))
|
|
headers.Add("X-Yandex-Music-Device", _device);
|
|
}
|
|
} |