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

39 lines
1.2 KiB
C#
Raw Normal View History

using System.Threading;
2020-05-01 19:05:28 +01:00
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)
2020-05-01 19:05:28 +01:00
{
return API.Get<PrivateUser>(SpotifyUrls.Me(), cancel);
2020-05-01 19:05:28 +01:00
}
public Task<PublicUser> Get(string userId, CancellationToken cancel = default)
2020-05-01 19:05:28 +01:00
{
Ensure.ArgumentNotNullOrEmptyString(userId, nameof(userId));
return API.Get<PublicUser>(SpotifyUrls.User(userId), cancel);
2020-05-01 19:05:28 +01:00
}
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);
}
2020-05-01 19:05:28 +01:00
}
}