21 lines
1004 B
C#
21 lines
1004 B
C#
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" } };
|
||
} |