Files
YandexMusic/YandexMusic.API/Requests/Queue/YQueueUpdatePositionBuilder.cs
2026-04-10 12:12:33 +03:00

43 lines
1.5 KiB
C#

using System.Collections.Specialized;
using System.Net;
using System.Net.Http.Headers;
using YandexMusic.API.Common;
using YandexMusic.API.Models.Common;
using YandexMusic.API.Models.Queue;
using YandexMusic.API.Requests.Common;
using YandexMusic.API.Requests.Common.Attributes;
namespace YandexMusic.API.Requests.Queue
{
[YApiRequest(WebRequestMethods.Http.Post, "queues/{queueId}/update-position")]
public class YQueueUpdatePositionBuilder : YRequestBuilder<YResponse<YUpdatedQueue>, (string queueId, int currentIndex, bool isInteractive)>
{
public YQueueUpdatePositionBuilder(YandexMusicApi yandex, AuthStorage auth, string device = null) : base(yandex, auth)
{
if (device != null)
this.device = device;
}
protected override Dictionary<string, string> GetSubstitutions((string queueId, int currentIndex, bool isInteractive) tuple)
{
return new Dictionary<string, string> {
{ "queueId", tuple.queueId },
};
}
protected override void SetCustomHeaders(HttpRequestHeaders headers)
{
headers.Add("X-Yandex-Music-Device", device);
}
protected override NameValueCollection GetQueryParams((string queueId, int currentIndex, bool isInteractive) tuple)
{
return new NameValueCollection {
{ "currentIndex", tuple.currentIndex.ToString() },
{ "isInteractive", tuple.isInteractive.ToString().ToLower() }
};
}
}
}