mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 14:46:26 +00:00
b8a2190168
* feat: implements markets API * fix: use correct constructor name * feat: allow to pass a cancellation token * pass cancellation token * pass cancellation token only >NETSTANDARD2_1 Co-authored-by: Jonas Dellinger <jonas@dellinger.dev>
37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using SpotifyAPI.Web.Http;
|
|
using URLs = SpotifyAPI.Web.SpotifyUrls;
|
|
|
|
namespace SpotifyAPI.Web
|
|
{
|
|
public class PersonalizationClient : APIClient, IPersonalizationClient
|
|
{
|
|
public PersonalizationClient(IAPIConnector apiConnector) : base(apiConnector) { }
|
|
|
|
public Task<Paging<FullArtist>> GetTopArtists(CancellationToken cancel = default)
|
|
{
|
|
return API.Get<Paging<FullArtist>>(URLs.PersonalizationTop("artists"), cancel);
|
|
}
|
|
|
|
public Task<Paging<FullArtist>> GetTopArtists(PersonalizationTopRequest request, CancellationToken cancel = default)
|
|
{
|
|
Ensure.ArgumentNotNull(request, nameof(request));
|
|
|
|
return API.Get<Paging<FullArtist>>(URLs.PersonalizationTop("artists"), request.BuildQueryParams(), cancel);
|
|
}
|
|
|
|
public Task<Paging<FullTrack>> GetTopTracks(CancellationToken cancel = default)
|
|
{
|
|
return API.Get<Paging<FullTrack>>(URLs.PersonalizationTop("tracks"), cancel);
|
|
}
|
|
|
|
public Task<Paging<FullTrack>> GetTopTracks(PersonalizationTopRequest request, CancellationToken cancel = default)
|
|
{
|
|
Ensure.ArgumentNotNull(request, nameof(request));
|
|
|
|
return API.Get<Paging<FullTrack>>(URLs.PersonalizationTop("tracks"), request.BuildQueryParams(), cancel);
|
|
}
|
|
}
|
|
}
|