Spotify.NET/SpotifyAPI.Web/Clients/ArtistsClient.cs

57 lines
2.1 KiB
C#
Raw Normal View History

using System.Threading;
2020-05-08 10:10:53 +01:00
using System.Threading.Tasks;
using SpotifyAPI.Web.Http;
using URLs = SpotifyAPI.Web.SpotifyUrls;
namespace SpotifyAPI.Web
{
public class ArtistsClient : APIClient, IArtistsClient
{
public ArtistsClient(IAPIConnector apiConnector) : base(apiConnector) { }
public Task<FullArtist> Get(string artistId, CancellationToken cancel = default)
2020-05-08 10:10:53 +01:00
{
Ensure.ArgumentNotNullOrEmptyString(artistId, nameof(artistId));
return API.Get<FullArtist>(URLs.Artist(artistId), cancel);
2020-05-08 10:10:53 +01:00
}
public Task<Paging<SimpleAlbum>> GetAlbums(string artistId, CancellationToken cancel = default)
2020-05-08 10:10:53 +01:00
{
Ensure.ArgumentNotNullOrEmptyString(artistId, nameof(artistId));
return API.Get<Paging<SimpleAlbum>>(URLs.ArtistAlbums(artistId), cancel);
2020-05-08 10:10:53 +01:00
}
public Task<Paging<SimpleAlbum>> GetAlbums(string artistId, ArtistsAlbumsRequest request, CancellationToken cancel = default)
2020-05-08 10:10:53 +01:00
{
Ensure.ArgumentNotNullOrEmptyString(artistId, nameof(artistId));
Ensure.ArgumentNotNull(request, nameof(request));
return API.Get<Paging<SimpleAlbum>>(URLs.ArtistAlbums(artistId), request.BuildQueryParams(), cancel);
2020-05-08 10:10:53 +01:00
}
public Task<ArtistsRelatedArtistsResponse> GetRelatedArtists(string artistId, CancellationToken cancel = default)
2020-05-08 10:10:53 +01:00
{
Ensure.ArgumentNotNullOrEmptyString(artistId, nameof(artistId));
return API.Get<ArtistsRelatedArtistsResponse>(URLs.ArtistRelatedArtists(artistId), cancel);
2020-05-08 10:10:53 +01:00
}
public Task<ArtistsResponse> GetSeveral(ArtistsRequest request, CancellationToken cancel = default)
2020-05-08 10:10:53 +01:00
{
Ensure.ArgumentNotNull(request, nameof(request));
return API.Get<ArtistsResponse>(URLs.Artists(), request.BuildQueryParams(), cancel);
2020-05-08 10:10:53 +01:00
}
public Task<ArtistsTopTracksResponse> GetTopTracks(string artistId, ArtistsTopTracksRequest request, CancellationToken cancel = default)
2020-05-08 10:10:53 +01:00
{
Ensure.ArgumentNotNullOrEmptyString(artistId, nameof(artistId));
Ensure.ArgumentNotNull(request, nameof(request));
return API.Get<ArtistsTopTracksResponse>(URLs.ArtistTopTracks(artistId), request.BuildQueryParams(), cancel);
2020-05-08 10:10:53 +01:00
}
}
}