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