Добавьте файлы проекта.

This commit is contained in:
FrigaT
2026-04-10 12:12:33 +03:00
parent 9615cf42ee
commit 11d0b0d72f
383 changed files with 9661 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
using System.Net;
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.Get, "queues/{queueId}")]
public class YGetQueueBuilder : YRequestBuilder<YResponse<YQueue>, string>
{
public YGetQueueBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
{
}
protected override Dictionary<string, string> GetSubstitutions(string queueId)
{
return new Dictionary<string, string> {
{ "queueId", queueId }
};
}
}
}

View File

@@ -0,0 +1,44 @@
using System.Net;
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Serialization;
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")]
public class YQueueCreateBuilder : YRequestBuilder<YResponse<YNewQueue>, YQueue>
{
public YQueueCreateBuilder(YandexMusicApi yandex, AuthStorage auth, string device = null) : base(yandex, auth)
{
if (device != null)
this.device = device;
}
protected override HttpContent GetContent(YQueue queue)
{
JsonSerializerOptions settings = new()
{
Converters = {
new JsonStringEnumConverter()
},
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
};
return JsonContent.Create(queue, new MediaTypeHeaderValue("application/json"), settings);
}
protected override void SetCustomHeaders(HttpRequestHeaders headers)
{
headers.Add("X-Yandex-Music-Device", device);
}
}
}

View File

@@ -0,0 +1,42 @@
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() }
};
}
}
}

View File

@@ -0,0 +1,26 @@
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.Get, "queues")]
public class YQueuesListBuilder : YRequestBuilder<YResponse<YQueueItemsContainer>, string>
{
public YQueuesListBuilder(YandexMusicApi yandex, AuthStorage auth, string device = null) : base(yandex, auth)
{
if (device != null)
this.device = device;
}
protected override void SetCustomHeaders(HttpRequestHeaders headers)
{
headers.Add("X-Yandex-Music-Device", device);
}
}
}