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

37 lines
1.3 KiB
C#
Raw Normal View History

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