using System.Threading; 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 Get(string artistId, CancellationToken cancel = default) { Ensure.ArgumentNotNullOrEmptyString(artistId, nameof(artistId)); return API.Get(URLs.Artist(artistId), cancel); } public Task Get(string artistId, ArtistRequest request, CancellationToken cancel = default) { Ensure.ArgumentNotNullOrEmptyString(artistId, nameof(artistId)); Ensure.ArgumentNotNull(request, nameof(request)); return API.Get(URLs.Artist(artistId), request.BuildQueryParams(), cancel); } public Task> GetAlbums(string artistId, CancellationToken cancel = default) { Ensure.ArgumentNotNullOrEmptyString(artistId, nameof(artistId)); return API.Get>(URLs.ArtistAlbums(artistId), cancel); } public Task> GetAlbums(string artistId, ArtistsAlbumsRequest request, CancellationToken cancel = default) { Ensure.ArgumentNotNullOrEmptyString(artistId, nameof(artistId)); Ensure.ArgumentNotNull(request, nameof(request)); return API.Get>(URLs.ArtistAlbums(artistId), request.BuildQueryParams(), cancel); } public Task GetRelatedArtists(string artistId, CancellationToken cancel = default) { Ensure.ArgumentNotNullOrEmptyString(artistId, nameof(artistId)); return API.Get(URLs.ArtistRelatedArtists(artistId), cancel); } public Task GetRelatedArtists(string artistId, ArtistsRelatedArtistsRequest request, CancellationToken cancel = default) { Ensure.ArgumentNotNullOrEmptyString(artistId, nameof(artistId)); Ensure.ArgumentNotNull(request, nameof(request)); return API.Get(URLs.ArtistRelatedArtists(artistId), request.BuildQueryParams(), cancel); } public Task GetSeveral(ArtistsRequest request, CancellationToken cancel = default) { Ensure.ArgumentNotNull(request, nameof(request)); return API.Get(URLs.Artists(), request.BuildQueryParams(), cancel); } public Task GetTopTracks(string artistId, ArtistsTopTracksRequest request, CancellationToken cancel = default) { Ensure.ArgumentNotNullOrEmptyString(artistId, nameof(artistId)); Ensure.ArgumentNotNull(request, nameof(request)); return API.Get(URLs.ArtistTopTracks(artistId), request.BuildQueryParams(), cancel); } } }