using System.Collections.Specialized; using System.Net; using System.Net.Http.Headers; using YandexMusic.API.Models.Queue; namespace YandexMusic.API.Requests.Queue; internal class YQueueUpdatePositionBuilder : YMusicRequestBuilder { 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 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); } }