20 lines
1.0 KiB
C#
20 lines
1.0 KiB
C#
using System.Net;
|
|
using YandexMusic.API.Models.Library;
|
|
|
|
namespace YandexMusic.API.Requests.Library;
|
|
|
|
public class YLibraryRemoveBuilder<T> : YMusicRequestBuilder<T?, (string id, YLibrarySection section, YLibrarySectionType type)>
|
|
{
|
|
public YLibraryRemoveBuilder(YandexMusicApi api) : base(api) { }
|
|
protected override string Method => WebRequestMethods.Http.Post;
|
|
protected override string PathTemplate => "users/{uid}/{type}/{section}/remove";
|
|
protected override Dictionary<string, string> GetSubstitutions((string id, YLibrarySection section, YLibrarySectionType type) tuple)
|
|
=> new()
|
|
{
|
|
{ "uid", Api.Storage.User.Uid },
|
|
{ "type", tuple.type.ToString().ToLower() },
|
|
{ "section", tuple.section.ToString().ToLower() }
|
|
};
|
|
protected override HttpContent? GetContent((string id, YLibrarySection section, YLibrarySectionType type) tuple)
|
|
=> new FormUrlEncodedContent(new Dictionary<string, string> { { $"{tuple.section.ToString().ToLower().TrimEnd('s')}-ids", tuple.id } });
|
|
} |