Полностью переписанное api
All checks were successful
Release / pack-and-publish (release) Successful in 36s

This commit is contained in:
FrigaT
2026-04-19 17:00:05 +03:00
parent 5541d0ad27
commit 36e28ce3fe
111 changed files with 1552 additions and 3358 deletions

View File

@@ -1,32 +1,24 @@
using System.Collections.Specialized;
using System.Globalization;
using System.Net;
using YandexMusic.API.Common;
using YandexMusic.API.Models.Playlist;
using YandexMusic.API.Models.Ugc;
using YandexMusic.API.Requests.Common;
using YandexMusic.API.Requests.Common.Attributes;
namespace YandexMusic.API.Requests.Ugc;
[YWebApiRequest(WebRequestMethods.Http.Get, "handlers/ugc-upload.jsx")]
public class YUgcGetUploadLinkBuilder : YRequestBuilder<YUgcUpload, (YPlaylist playlist, string fileName)>
public class YUgcGetUploadLinkBuilder : YMusicRequestBuilder<YUgcUpload?, (YPlaylist playlist, string fileName)>
{
private static readonly Lazy<Random> Random = new(() => new Random());
public YUgcGetUploadLinkBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
{
}
private static readonly Random _random = new();
public YUgcGetUploadLinkBuilder(YandexMusicApi api) : base(api) { }
protected override string Method => WebRequestMethods.Http.Get;
protected override string PathTemplate => "handlers/ugc-upload.jsx";
protected override NameValueCollection GetQueryParams((YPlaylist playlist, string fileName) tuple)
{
return new NameValueCollection {
=> new()
{
{ "filename", tuple.fileName },
{ "kind", tuple.playlist.Kind },
{ "visibility", "private" },
{ "external-domain", "music.yandex.ru" },
{ "ncrnd", Random.Value.NextDouble().ToString(CultureInfo.InvariantCulture) }
{ "ncrnd", _random.NextDouble().ToString(CultureInfo.InvariantCulture) }
};
}
}