mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-24 23:16:28 +00:00
a27c3729c8
* add top tracks & artists endpoints * fix file extenstion * added TODO * Add Methods to interface * Add Top items query class * implement query into UserProfileClient.cs - Top Requests * Tidy Up Naming * Removed random json file change * Added Tests. * run formatter * remove additional namespace --------- Co-authored-by: Jonas Dellinger <jonas@dellinger.dev>
39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using SpotifyAPI.Web.Http;
|
|
|
|
namespace SpotifyAPI.Web
|
|
{
|
|
public class UserProfileClient : APIClient, IUserProfileClient
|
|
{
|
|
public UserProfileClient(IAPIConnector apiConnector) : base(apiConnector) { }
|
|
|
|
public Task<PrivateUser> Current(CancellationToken cancel = default)
|
|
{
|
|
return API.Get<PrivateUser>(SpotifyUrls.Me(), cancel);
|
|
}
|
|
|
|
public Task<PublicUser> Get(string userId, CancellationToken cancel = default)
|
|
{
|
|
Ensure.ArgumentNotNullOrEmptyString(userId, nameof(userId));
|
|
|
|
return API.Get<PublicUser>(SpotifyUrls.User(userId), cancel);
|
|
}
|
|
|
|
public Task<UsersTopTracksResponse> GetTopTracks(UsersTopItemsRequest request, CancellationToken cancel = default)
|
|
{
|
|
Ensure.ArgumentNotNull(request, nameof(request));
|
|
|
|
return API.Get<UsersTopTracksResponse>(SpotifyUrls.TopTracks(), request.BuildQueryParams(), cancel);
|
|
|
|
}
|
|
|
|
public Task<UsersTopArtistsResponse> GetTopArtists(UsersTopItemsRequest request, CancellationToken cancel = default)
|
|
{
|
|
Ensure.ArgumentNotNull(request, nameof(request));
|
|
|
|
return API.Get<UsersTopArtistsResponse>(SpotifyUrls.TopArtists(), request.BuildQueryParams(), cancel);
|
|
}
|
|
}
|
|
}
|