Files
YandexMusic/YandexMusic.API/Requests/Queue/YQueueUpdatePositionBuilder.cs
FrigaT 36e28ce3fe
All checks were successful
Release / pack-and-publish (release) Successful in 36s
Полностью переписанное api
2026-04-19 17:00:05 +03:00

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);
}
}