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, (string postTargetLink, byte[] fileBytes)> { public YUgcUploadBuilder(YandexMusicApi yandex, AuthStorage auth) : base(yandex, auth) { } protected override Dictionary GetSubstitutions((string postTargetLink, byte[] fileBytes) tuple) { return new Dictionary { { "postTargetLink", tuple.postTargetLink } }; } protected override HttpContent GetContent((string postTargetLink, byte[] fileBytes) tuple) { return new MultipartFormDataContent { { new ByteArrayContent(tuple.fileBytes), "file" } }; } } }