24 lines
995 B
C#
24 lines
995 B
C#
using System.Collections.Specialized;
|
|
using System.Globalization;
|
|
using System.Net;
|
|
using YandexMusic.API.Models.Playlist;
|
|
using YandexMusic.API.Models.Ugc;
|
|
|
|
namespace YandexMusic.API.Requests.Ugc;
|
|
|
|
internal class YUgcGetUploadLinkBuilder : YMusicRequestBuilder<YUgcUpload?, (YPlaylist playlist, string fileName)>
|
|
{
|
|
private static readonly Random _random = new();
|
|
public YUgcGetUploadLinkBuilder(YandexMusicApi api) : base(api) { }
|
|
protected override string Method => WebRequestMethods.Http.Get;
|
|
protected override string PathTemplate => "handlers/ugc-upload.jsx";
|
|
protected override NameValueCollection GetQueryParams((YPlaylist playlist, string fileName) tuple)
|
|
=> new()
|
|
{
|
|
{ "filename", tuple.fileName },
|
|
{ "kind", tuple.playlist.Kind },
|
|
{ "visibility", "private" },
|
|
{ "external-domain", "music.yandex.ru" },
|
|
{ "ncrnd", _random.NextDouble().ToString(CultureInfo.InvariantCulture) }
|
|
};
|
|
} |