Files
YandexMusic/YandexMusic.API/Requests/Library/YLibraryAddBuilder.cs
FrigaT add7f08215
All checks were successful
Release / pack-and-publish (release) Successful in 32s
Добавлен вывод AuthStorage. Спрятаны внутренние api запросы
2026-04-19 17:41:30 +03:00

20 lines
1.0 KiB
C#

using System.Net;
using YandexMusic.API.Models.Library;
namespace YandexMusic.API.Requests.Library;
internal class YLibraryAddBuilder<T> : YMusicRequestBuilder<T?, (string id, YLibrarySection section, YLibrarySectionType type)>
{
public YLibraryAddBuilder(YandexMusicApi api) : base(api) { }
protected override string Method => WebRequestMethods.Http.Post;
protected override string PathTemplate => "users/{uid}/{type}/{section}/add-multiple";
protected override Dictionary<string, string> GetSubstitutions((string id, YLibrarySection section, YLibrarySectionType type) tuple)
=> new()
{
{ "uid", Api.Storage.User.Uid },
{ "type", tuple.type.ToString().ToLower() },
{ "section", tuple.section.ToString().ToLower() }
};
protected override HttpContent? GetContent((string id, YLibrarySection section, YLibrarySectionType type) tuple)
=> new FormUrlEncodedContent(new Dictionary<string, string> { { $"{tuple.section.ToString().ToLower().TrimEnd('s')}-ids", tuple.id } });
}