From 8ea1a0cb0802addc1b3718fd1bb88e1cbea75d2c Mon Sep 17 00:00:00 2001 From: fckoppenol Date: Wed, 20 Apr 2016 13:06:03 +0200 Subject: [PATCH] Added GetTopTagsByMbidAsync function in Artist --- src/IF.Lastfm.Core/Api/ArtistApi.cs | 16 +++++++++++++++- .../Api/Commands/Artist/GetTopTagsCommand.cs | 15 ++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/IF.Lastfm.Core/Api/ArtistApi.cs b/src/IF.Lastfm.Core/Api/ArtistApi.cs index e0683e76..1aab1c77 100644 --- a/src/IF.Lastfm.Core/Api/ArtistApi.cs +++ b/src/IF.Lastfm.Core/Api/ArtistApi.cs @@ -104,8 +104,21 @@ public Task> GetTagsByUserAsync(string artist, string user public Task> GetTopTagsAsync(string artist, bool autocorrect = false) { - var command = new GetTopTagsCommand(Auth, artist) + var command = new GetTopTagsCommand(Auth) { + ArtistName = artist, + Autocorrect = autocorrect, + HttpClient = HttpClient + }; + + return command.ExecuteAsync(); + } + + public Task> GetTopTagsByMbidAsync(string mbid, bool autocorrect = false) + { + var command = new GetTopTagsCommand(Auth) + { + ArtistMbid = mbid, Autocorrect = autocorrect, HttpClient = HttpClient }; @@ -113,6 +126,7 @@ public Task> GetTopTagsAsync(string artist, bool autocorre return command.ExecuteAsync(); } + public async Task> GetShoutsAsync(string artist, int page = 0, int count = LastFm.DefaultPageLength, bool autocorrect = false) { var command = new GetShoutsCommand(Auth, artist) diff --git a/src/IF.Lastfm.Core/Api/Commands/Artist/GetTopTagsCommand.cs b/src/IF.Lastfm.Core/Api/Commands/Artist/GetTopTagsCommand.cs index 2f02f539..05d148c0 100644 --- a/src/IF.Lastfm.Core/Api/Commands/Artist/GetTopTagsCommand.cs +++ b/src/IF.Lastfm.Core/Api/Commands/Artist/GetTopTagsCommand.cs @@ -12,18 +12,27 @@ namespace IF.Lastfm.Core.Api.Commands.Artist [ApiMethodName("artist.getTopTags")] internal class GetTopTagsCommand : GetAsyncCommandBase> { + public string ArtistMbid { get; set; } + public string ArtistName { get; set; } public bool Autocorrect { get; set; } - public GetTopTagsCommand(ILastAuth auth, string artistName) : base(auth) + public GetTopTagsCommand(ILastAuth auth) : base(auth) { - ArtistName = artistName; + } public override void SetParameters() { - Parameters.Add("artist", ArtistName); + if (ArtistMbid != null) + { + Parameters.Add("mbid", ArtistMbid); + } + else + { + Parameters.Add("artist", ArtistName); + } Parameters.Add("autocorrect", Convert.ToInt32(Autocorrect).ToString()); }