Skip to content

Commit

Permalink
Added GetTopTagsByMbidAsync function in Artist
Browse files Browse the repository at this point in the history
  • Loading branch information
fckoppenol committed Apr 20, 2016
1 parent 4007afe commit 8ea1a0c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
16 changes: 15 additions & 1 deletion src/IF.Lastfm.Core/Api/ArtistApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,29 @@ public Task<PageResponse<LastTag>> GetTagsByUserAsync(string artist, string user

public Task<PageResponse<LastTag>> 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<PageResponse<LastTag>> GetTopTagsByMbidAsync(string mbid, bool autocorrect = false)
{
var command = new GetTopTagsCommand(Auth)
{
ArtistMbid = mbid,
Autocorrect = autocorrect,
HttpClient = HttpClient
};

return command.ExecuteAsync();
}


public async Task<PageResponse<LastShout>> GetShoutsAsync(string artist, int page = 0, int count = LastFm.DefaultPageLength, bool autocorrect = false)
{
var command = new GetShoutsCommand(Auth, artist)
Expand Down
15 changes: 12 additions & 3 deletions src/IF.Lastfm.Core/Api/Commands/Artist/GetTopTagsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,27 @@ namespace IF.Lastfm.Core.Api.Commands.Artist
[ApiMethodName("artist.getTopTags")]
internal class GetTopTagsCommand : GetAsyncCommandBase<PageResponse<LastTag>>
{
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());
}

Expand Down

0 comments on commit 8ea1a0c

Please sign in to comment.