Обнновлено до .net10
This commit is contained in:
72
YandexMusic.API/API/YQueueAPI.cs
Normal file
72
YandexMusic.API/API/YQueueAPI.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using YandexMusic.API.Common;
|
||||
using YandexMusic.API.Models.Common;
|
||||
using YandexMusic.API.Models.Queue;
|
||||
using YandexMusic.API.Requests.Queue;
|
||||
|
||||
namespace YandexMusic.API;
|
||||
|
||||
/// <summary>
|
||||
/// API для взаимодействия с очередями
|
||||
/// </summary>
|
||||
public partial class YQueueAPI : YCommonAPI
|
||||
{
|
||||
public YQueueAPI(YandexMusicApi yandex) : base(yandex)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение всех очередей треков с разных устройств для синхронизации между ними
|
||||
/// </summary>
|
||||
/// <param name="storage">Хранилище</param>
|
||||
/// <param name="device">Устройство</param>
|
||||
/// <returns></returns>
|
||||
public Task<YResponse<YQueueItemsContainer>> ListAsync(AuthStorage storage, string? device = null)
|
||||
{
|
||||
return new YQueuesListBuilder(api, storage)
|
||||
.Build(device)
|
||||
.GetResponseAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение очереди
|
||||
/// </summary>
|
||||
/// <param name="storage">Хранилище</param>
|
||||
/// <param name="queueId">Идентификатор очереди</param>
|
||||
/// <returns></returns>
|
||||
public Task<YResponse<YQueue>> GetAsync(AuthStorage storage, string queueId)
|
||||
{
|
||||
return new YGetQueueBuilder(api, storage)
|
||||
.Build(queueId)
|
||||
.GetResponseAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание новой очереди треков
|
||||
/// </summary>
|
||||
/// <param name="storage">Хранилище</param>
|
||||
/// <param name="queue">Очередь треков</param>
|
||||
/// <param name="device">Устройство</param>
|
||||
/// <returns></returns>
|
||||
public Task<YResponse<YNewQueue>> CreateAsync(AuthStorage storage, YQueue queue, string? device = null)
|
||||
{
|
||||
return new YQueueCreateBuilder(api, storage, device)
|
||||
.Build(queue)
|
||||
.GetResponseAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Установка текущего индекса проигрываемого трека в очереди треков
|
||||
/// </summary>
|
||||
/// <param name="storage">Хранилище</param>
|
||||
/// <param name="queueId">Идентификатор очереди</param>
|
||||
/// <param name="currentIndex">Текущий индекс</param>
|
||||
/// <param name="isInteractive">Флаг интерактивности</param>
|
||||
/// <param name="device">Устройство</param>
|
||||
/// <returns></returns>
|
||||
public Task<YResponse<YUpdatedQueue>> UpdatePositionAsync(AuthStorage storage, string queueId, int currentIndex, bool isInteractive, string device = null)
|
||||
{
|
||||
return new YQueueUpdatePositionBuilder(api, storage, device)
|
||||
.Build((queueId, currentIndex, isInteractive))
|
||||
.GetResponseAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user