Files
YandexMusic/YandexMusic.API/Extensions/API/YArtistExtensionsAsync.cs
FrigaT 36e28ce3fe
All checks were successful
Release / pack-and-publish (release) Successful in 36s
Полностью переписанное api
2026-04-19 17:00:05 +03:00

40 lines
1.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using YandexMusic.API.Models.Artist;
using YandexMusic.API.Models.Track;
namespace YandexMusic.API.Extensions.API;
/// <summary>
/// Методы-расширения для исполнителя.
/// </summary>
public static class YArtistExtensions
{
/// <summary>
/// Получает расширенную информацию об исполнителе.
/// </summary>
public static async Task<YArtistBriefInfo?> BriefInfoAsync(this YArtist artist)
=> await artist.Context.API.Artist.GetAsync(artist.Id);
/// <summary>
/// Получает страницу треков исполнителя.
/// </summary>
public static async Task<YTracksPage?> GetTracksAsync(this YArtist artist, int page = 0, int pageSize = 20)
=> await artist.Context.API.Artist.GetTracksAsync(artist.Id, page, pageSize);
/// <summary>
/// Получает все треки исполнителя.
/// </summary>
public static async Task<List<YTrack>?> GetAllTracksAsync(this YArtist artist)
=> (await artist.Context.API.Artist.GetAllTracksAsync(artist.Id))?.Tracks;
/// <summary>
/// Добавляет исполнителя в список лайкнутых.
/// </summary>
public static async Task<string?> AddLikeAsync(this YArtist artist)
=> await artist.Context.API.Library.AddArtistLikeAsync(artist);
/// <summary>
/// Удаляет исполнителя из списка лайкнутых.
/// </summary>
public static async Task<string?> RemoveLikeAsync(this YArtist artist)
=> await artist.Context.API.Library.RemoveArtistLikeAsync(artist);
}