2022-11-18 11:30:09 +00:00
|
|
|
using System.Threading;
|
2020-05-08 11:09:59 +01:00
|
|
|
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) { }
|
|
|
|
|
2022-11-18 11:30:09 +00:00
|
|
|
public Task<Paging<FullArtist>> GetTopArtists(CancellationToken cancel = default)
|
2020-05-08 11:09:59 +01:00
|
|
|
{
|
2022-11-18 11:30:09 +00:00
|
|
|
return API.Get<Paging<FullArtist>>(URLs.PersonalizationTop("artists"), cancel);
|
2020-05-08 11:09:59 +01:00
|
|
|
}
|
|
|
|
|
2022-11-18 11:30:09 +00:00
|
|
|
public Task<Paging<FullArtist>> GetTopArtists(PersonalizationTopRequest request, CancellationToken cancel = default)
|
2020-05-08 11:09:59 +01:00
|
|
|
{
|
|
|
|
Ensure.ArgumentNotNull(request, nameof(request));
|
|
|
|
|
2022-11-18 11:30:09 +00:00
|
|
|
return API.Get<Paging<FullArtist>>(URLs.PersonalizationTop("artists"), request.BuildQueryParams(), cancel);
|
2020-05-08 11:09:59 +01:00
|
|
|
}
|
|
|
|
|
2022-11-18 11:30:09 +00:00
|
|
|
public Task<Paging<FullTrack>> GetTopTracks(CancellationToken cancel = default)
|
2020-05-08 11:09:59 +01:00
|
|
|
{
|
2022-11-18 11:30:09 +00:00
|
|
|
return API.Get<Paging<FullTrack>>(URLs.PersonalizationTop("tracks"), cancel);
|
2020-05-08 11:09:59 +01:00
|
|
|
}
|
|
|
|
|
2022-11-18 11:30:09 +00:00
|
|
|
public Task<Paging<FullTrack>> GetTopTracks(PersonalizationTopRequest request, CancellationToken cancel = default)
|
2020-05-08 11:09:59 +01:00
|
|
|
{
|
|
|
|
Ensure.ArgumentNotNull(request, nameof(request));
|
|
|
|
|
2022-11-18 11:30:09 +00:00
|
|
|
return API.Get<Paging<FullTrack>>(URLs.PersonalizationTop("tracks"), request.BuildQueryParams(), cancel);
|
2020-05-08 11:09:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|