using System; using System.Threading.Tasks; using IF.Lastfm.Core.Api.Commands.UserApi; using IF.Lastfm.Core.Api.Enums; using IF.Lastfm.Core.Api.Helpers; using IF.Lastfm.Core.Objects; namespace IF.Lastfm.Core.Api { public class UserApi : IUserApi { public IAuth Auth { get; private set; } public UserApi(IAuth auth) { Auth = auth; } /// /// Gets the top albums for the given user. /// /// /// /// /// /// public async Task> GetTopAlbums(string username, LastStatsTimeSpan span, int pagenumber = 0, int count = LastFm.DefaultPageLength) { var command = new GetTopAlbumsCommand(Auth, username, span) { Page = pagenumber, Count = count }; return await command.ExecuteAsync(); } /// /// Gets scrobbles and stuff /// /// /// /// /// /// public async Task> GetRecentScrobbles(string username, DateTime since, int pagenumber = 0, int count = LastFm.DefaultPageLength) { var command = new GetRecentScrobblesCommand(Auth, username, since) { Page = pagenumber, Count = count }; return await command.ExecuteAsync(); } public async Task> GetRecentStations(string username, int pagenumber = 0, int count = LastFm.DefaultPageLength) { var command = new GetRecentStationsCommand(Auth, username) { Page = pagenumber, Count = count }; return await command.ExecuteAsync(); } public async Task> GetShoutsAsync(string username, int pagenumber, int count = LastFm.DefaultPageLength) { var command = new GetUserShoutsCommand(Auth, username) { Page = pagenumber, Count = count }; return await command.ExecuteAsync(); } public async Task> GetInfoAsync(string username) { var command = new GetUserInfoCommand(Auth, username); return await command.ExecuteAsync(); } public async Task AddShoutAsync(string recipient, string message) { var command = new AddShoutCommand(Auth, recipient, message); return await command.ExecuteAsync(); } } }