using YandexMusic.API.Common;
using YandexMusic.API.Models.Common;
using YandexMusic.API.Models.Queue;
using YandexMusic.API.Requests.Queue;
namespace YandexMusic.API;
///
/// API для взаимодействия с очередями
///
public partial class YQueueAPI : YCommonAPI
{
public YQueueAPI(YandexMusicApi yandex) : base(yandex)
{
}
///
/// Получение всех очередей треков с разных устройств для синхронизации между ними
///
/// Хранилище
/// Устройство
///
public Task> ListAsync(AuthStorage storage, string? device = null)
{
return new YQueuesListBuilder(api, storage)
.Build(device)
.GetResponseAsync();
}
///
/// Получение очереди
///
/// Хранилище
/// Идентификатор очереди
///
public Task> GetAsync(AuthStorage storage, string queueId)
{
return new YGetQueueBuilder(api, storage)
.Build(queueId)
.GetResponseAsync();
}
///
/// Создание новой очереди треков
///
/// Хранилище
/// Очередь треков
/// Устройство
///
public Task> CreateAsync(AuthStorage storage, YQueue queue, string? device = null)
{
return new YQueueCreateBuilder(api, storage, device)
.Build(queue)
.GetResponseAsync();
}
///
/// Установка текущего индекса проигрываемого трека в очереди треков
///
/// Хранилище
/// Идентификатор очереди
/// Текущий индекс
/// Флаг интерактивности
/// Устройство
///
public Task> UpdatePositionAsync(AuthStorage storage, string queueId, int currentIndex, bool isInteractive, string device = null)
{
return new YQueueUpdatePositionBuilder(api, storage, device)
.Build((queueId, currentIndex, isInteractive))
.GetResponseAsync();
}
}