Files
YandexMusic/YandexMusic.API/Requests/Ugc/YUgcUploadBuilder.cs

21 lines
1006 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>
internal class YUgcUploadBuilder : YJsonRequestBuilder<YResponse<string>?, (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<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" } };
}