Полностью переписанное 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,31 +1,21 @@
using System.Net;
using YandexMusic.API.Common;
using YandexMusic.API.Models.Common;
using YandexMusic.API.Requests.Common;
using YandexMusic.API.Requests.Common.Attributes;
namespace YandexMusic.API.Requests.Ugc;
[YRequest(WebRequestMethods.Http.Post, "{postTargetLink}")]
public class YUgcUploadBuilder : YRequestBuilder<YResponse<string>, (string postTargetLink, byte[] fileBytes)>
/// <summary>Загрузка трека специальный запрос на произвольный URL.</summary>
public class YUgcUploadBuilder : YJsonRequestBuilder<YResponse<string>?, (string postTargetLink, byte[] fileBytes)>
{
public YUgcUploadBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth)
{
}
public YUgcUploadBuilder(YandexMusicApi api) : base(api) { }
protected override string BaseUrl => "";
protected override string Method => WebRequestMethods.Http.Post;
protected override string PathTemplate => "{postTargetLink}";
protected override Dictionary<string, string> GetSubstitutions((string postTargetLink, byte[] fileBytes) tuple)
{
return new Dictionary<string, string> {
{ "postTargetLink", tuple.postTargetLink }
};
}
protected override HttpContent GetContent((string postTargetLink, byte[] fileBytes) tuple)
{
return new MultipartFormDataContent {
{ new ByteArrayContent(tuple.fileBytes), "file" }
};
}
=> new() { { "postTargetLink", tuple.postTargetLink } };
protected override HttpContent? GetContent((string postTargetLink, byte[] fileBytes) tuple)
=> new MultipartFormDataContent { { new ByteArrayContent(tuple.fileBytes), "file" } };
}