Files
YandexMusic/YandexMusic.API/Requests/Ugc/YUgcUploadBuilder.cs
FrigaT 36e28ce3fe
All checks were successful
Release / pack-and-publish (release) Successful in 36s
Полностью переписанное api
2026-04-19 17:00:05 +03:00

21 lines
1004 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Net;
using YandexMusic.API.Models.Common;
using YandexMusic.API.Requests.Common;
namespace YandexMusic.API.Requests.Ugc;
/// <summary>Загрузка трека специальный запрос на произвольный URL.</summary>
public class YUgcUploadBuilder : YJsonRequestBuilder<YResponse<string>?, (string postTargetLink, byte[] fileBytes)>
{
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)
=> new() { { "postTargetLink", tuple.postTargetLink } };
protected override HttpContent? GetContent((string postTargetLink, byte[] fileBytes) tuple)
=> new MultipartFormDataContent { { new ByteArrayContent(tuple.fileBytes), "file" } };
}