20 lines
1.0 KiB
C#
20 lines
1.0 KiB
C#
using System.Net;
|
|
using YandexMusic.API.Models.Playlist;
|
|
|
|
namespace YandexMusic.API.Requests.Playlist;
|
|
|
|
internal class YPlaylistChangeBuilder : YMusicRequestBuilder<YPlaylist?, (YPlaylist playlist, IEnumerable<YPlaylistChange> changes)>
|
|
{
|
|
public YPlaylistChangeBuilder(YandexMusicApi api) : base(api) { }
|
|
protected override string Method => WebRequestMethods.Http.Post;
|
|
protected override string PathTemplate => "users/{uid}/playlists/{kind}/change";
|
|
protected override Dictionary<string, string> GetSubstitutions((YPlaylist playlist, IEnumerable<YPlaylistChange> changes) tuple)
|
|
=> new() { { "uid", Api.Storage.User.Uid }, { "kind", tuple.playlist.Kind } };
|
|
protected override HttpContent? GetContent((YPlaylist playlist, IEnumerable<YPlaylistChange> changes) tuple)
|
|
=> new FormUrlEncodedContent(new Dictionary<string, string>
|
|
{
|
|
{ "kind", tuple.playlist.Kind },
|
|
{ "revision", tuple.playlist.Revision.ToString() },
|
|
{ "diff", SerializeJson(tuple.changes) }
|
|
});
|
|
} |