using System.Net;
using YandexMusic.API.Models.Common;
using YandexMusic.API.Requests.Common;
namespace YandexMusic.API.Requests.Ugc;
/// Загрузка трека – специальный запрос на произвольный URL.
internal class YUgcUploadBuilder : YJsonRequestBuilder?, (string postTargetLink, byte[] fileBytes)>
{
public YUgcUploadBuilder(YandexMusicApi api) : base(api) { }
protected override string BaseUrl => "{postTargetLink}";
protected override string Method => WebRequestMethods.Http.Post;
protected override string PathTemplate => "";
protected override Dictionary 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" } };
}