diff --git a/PROGRESS.md b/PROGRESS.md
index 7504833..c3b4705 100644
--- a/PROGRESS.md
+++ b/PROGRESS.md
@@ -1,4 +1,4 @@
-# Api Progress ![Progress](http://progressed.io/bar/30)
+# Api Progress ![Progress](http://progressed.io/bar/31)
These are all the Last.fm API methods currently available.
@@ -6,7 +6,7 @@ These are all the Last.fm API methods currently available.
- Methods ~~marked with strikethrough~~ aren't currently implemented. Pull requests are welcome!
- Methods _marked with an asterisk *_ aren't listed on [the Last.fm documentation](http://www.last.fm/api), so they might not work!
-This list is generated by the [ProgressReport](src/IF.Lastfm.ProgressReport) tool in the solution. Last updated on Wednesday, 08 July 2015 11:39
+This list is generated by the [ProgressReport](src/IF.Lastfm.ProgressReport) tool in the solution. Last updated on Sunday, 12 July 2015 17:08
## Album
- [album.getInfo](http://www.last.fm/api/show/album.getInfo)
@@ -115,8 +115,8 @@ This list is generated by the [ProgressReport](src/IF.Lastfm.ProgressReport) too
- [tag.getInfo](http://www.last.fm/api/show/tag.getInfo)
- [tag.getSimilar](http://www.last.fm/api/show/tag.getSimilar)
+- [tag.getTopAlbums](http://www.last.fm/api/show/tag.getTopAlbums)
- [tag.getTopTags](http://www.last.fm/api/show/tag.getTopTags)
-- ~~[tag.getTopAlbums](http://www.last.fm/api/show/tag.getTopAlbums)~~
- ~~[tag.getTopArtists](http://www.last.fm/api/show/tag.getTopArtists)~~
- ~~[tag.getTopTracks](http://www.last.fm/api/show/tag.getTopTracks)~~
- ~~[tag.getWeeklyArtistChart](http://www.last.fm/api/show/tag.getWeeklyArtistChart)~~
diff --git a/src/IF.Lastfm.Core.Tests/Api/Commands/Tag/GetTopAlbumsCommandTests.cs b/src/IF.Lastfm.Core.Tests/Api/Commands/Tag/GetTopAlbumsCommandTests.cs
new file mode 100644
index 0000000..a4ba507
--- /dev/null
+++ b/src/IF.Lastfm.Core.Tests/Api/Commands/Tag/GetTopAlbumsCommandTests.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using IF.Lastfm.Core.Api.Commands.Tag;
+using IF.Lastfm.Core.Api.Enums;
+using IF.Lastfm.Core.Tests.Resources;
+using NUnit.Framework;
+
+namespace IF.Lastfm.Core.Tests.Api.Commands.Tag
+{
+ public class GetTopAlbumsCommandTests: CommandTestsBase
+ {
+ [Test]
+ public async Task HandleSingleResultResponse()
+ {
+ //Arrange
+ GetTopAlbumsCommand command = new GetTopAlbumsCommand(MAuth.Object, "disco");
+
+ //Act
+ var response = CreateResponseMessage(Encoding.UTF8.GetString(TagApiResponses.GetTopAlbumsSingle));
+ var parsed = await command.HandleResponse(response);
+
+ //Assert
+ Assert.IsTrue(parsed.Success);
+ Assert.IsNotNull(parsed.Content);
+ }
+
+ [Test]
+ public async Task HandleSuccessResponse()
+ {
+ //Arrange
+ GetTopAlbumsCommand command = new GetTopAlbumsCommand(MAuth.Object, "disco");
+
+ //Act
+ var response = CreateResponseMessage(Encoding.UTF8.GetString(TagApiResponses.GetTopAlbumsSuccess));
+ var parsed = await command.HandleResponse(response);
+
+ //Assert
+ Assert.IsTrue(parsed.Success);
+ Assert.IsNotNull(parsed.Content);
+ }
+
+ [Test]
+ public async Task HandleErrorResponse()
+ {
+ var command = new GetTopAlbumsCommand(MAuth.Object, "errorTag");
+
+ var response = CreateResponseMessage(Encoding.UTF8.GetString(TagApiResponses.GetTopAlbumsError));
+
+ var parsed = await command.HandleResponse(response);
+
+ Assert.IsFalse(parsed.Success);
+ Assert.IsTrue(parsed.Status == LastResponseStatus.MissingParameters);
+ }
+ }
+}
diff --git a/src/IF.Lastfm.Core.Tests/IF.Lastfm.Core.Tests.csproj b/src/IF.Lastfm.Core.Tests/IF.Lastfm.Core.Tests.csproj
index 52724f6..b5933ad 100644
--- a/src/IF.Lastfm.Core.Tests/IF.Lastfm.Core.Tests.csproj
+++ b/src/IF.Lastfm.Core.Tests/IF.Lastfm.Core.Tests.csproj
@@ -94,6 +94,7 @@
+
@@ -173,6 +174,9 @@
+
+
+
diff --git a/src/IF.Lastfm.Core.Tests/Resources/GetTopAlbumsError.json b/src/IF.Lastfm.Core.Tests/Resources/GetTopAlbumsError.json
new file mode 100644
index 0000000..5e8cc0e
--- /dev/null
+++ b/src/IF.Lastfm.Core.Tests/Resources/GetTopAlbumsError.json
@@ -0,0 +1,5 @@
+{
+ "error": 6,
+ "message": "No tag with that name",
+ "links": []
+}
diff --git a/src/IF.Lastfm.Core.Tests/Resources/GetTopAlbumsSingle.json b/src/IF.Lastfm.Core.Tests/Resources/GetTopAlbumsSingle.json
new file mode 100644
index 0000000..7a2e89f
--- /dev/null
+++ b/src/IF.Lastfm.Core.Tests/Resources/GetTopAlbumsSingle.json
@@ -0,0 +1,42 @@
+{
+ "topalbums": {
+ "album": {
+ "name": "Number Ones",
+ "mbid": "12cc16cb-5649-4e1a-bd10-a8a496280990",
+ "url": "http://www.last.fm/music/Bee+Gees/Number+Ones",
+ "artist": {
+ "name": "Bee Gees",
+ "mbid": "bf0f7e29-dfe1-416c-b5c6-f9ebc19ea810",
+ "url": "http://www.last.fm/music/Bee+Gees"
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/100167607.png",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/100167607.png",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/100167607.png",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/100167607.png",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "1"
+ }
+ },
+ "@attr": {
+ "tag": "Disco",
+ "page": "0",
+ "perPage": "1",
+ "totalPages": "1000",
+ "total": "1000"
+ }
+ }
+}
diff --git a/src/IF.Lastfm.Core.Tests/Resources/GetTopAlbumsSuccess.json b/src/IF.Lastfm.Core.Tests/Resources/GetTopAlbumsSuccess.json
new file mode 100644
index 0000000..1d7f489
--- /dev/null
+++ b/src/IF.Lastfm.Core.Tests/Resources/GetTopAlbumsSuccess.json
@@ -0,0 +1,633 @@
+{
+ "topalbums": {
+ "album": [
+ {
+ "name": "Number Ones",
+ "mbid": "12cc16cb-5649-4e1a-bd10-a8a496280990",
+ "url": "http://www.last.fm/music/Bee+Gees/Number+Ones",
+ "artist": {
+ "name": "Bee Gees",
+ "mbid": "bf0f7e29-dfe1-416c-b5c6-f9ebc19ea810",
+ "url": "http://www.last.fm/music/Bee+Gees"
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/100167607.png",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/100167607.png",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/100167607.png",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/100167607.png",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "1"
+ }
+ },
+ {
+ "name": "Gold: Greatest Hits",
+ "mbid": "ffb8aad2-b7fd-434c-951b-fd1dc1c0095f",
+ "url": "http://www.last.fm/music/ABBA/Gold:+Greatest+Hits",
+ "artist": {
+ "name": "ABBA",
+ "mbid": "d87e52c5-bb8d-4da8-b941-9f4928627dc8",
+ "url": "http://www.last.fm/music/ABBA"
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/100145365.png",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/100145365.png",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/100145365.png",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/100145365.png",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "2"
+ }
+ },
+ {
+ "name": "Greatest Hits",
+ "mbid": "b05fbfb7-833e-4f40-acbf-103539bec01b",
+ "url": "http://www.last.fm/music/Earth,+Wind+&+Fire/Greatest+Hits",
+ "artist": {
+ "name": "Earth, Wind & Fire",
+ "mbid": "535afeda-2538-435d-9dd1-5e10be586774",
+ "url": "http://www.last.fm/music/Earth,+Wind+&+Fire"
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/9699191.jpg",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/9699191.jpg",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/9699191.jpg",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/9699191.jpg",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "3"
+ }
+ },
+ {
+ "name": "Remix 2005",
+ "mbid": "08b95338-faa4-489e-87b3-7ea3a69aa7b6",
+ "url": "http://www.last.fm/music/Boney+M./Remix+2005",
+ "artist": {
+ "name": "Boney M.",
+ "mbid": "1a79fc33-3cfb-4736-9042-b6b9e8ce4fe9",
+ "url": "http://www.last.fm/music/Boney+M."
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/9102817.jpg",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/9102817.jpg",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/9102817.jpg",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/9102817.jpg",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "4"
+ }
+ },
+ {
+ "name": "Greatest Hits",
+ "mbid": "11f1262d-9be0-46d4-8e74-a273f803a327",
+ "url": "http://www.last.fm/music/KC+and+The+Sunshine+Band/Greatest+Hits",
+ "artist": {
+ "name": "KC and The Sunshine Band",
+ "mbid": "25ad6e44-40a9-4b67-82cd-d20bb3b27afa",
+ "url": "http://www.last.fm/music/KC+and+The+Sunshine+Band"
+ },
+ "image": [
+ {
+ "#text": "http://images.amazon.com/images/P/B00002NDAL.01.MZZZZZZZ.jpg",
+ "size": "small"
+ },
+ {
+ "#text": "http://images.amazon.com/images/P/B00002NDAL.01.MZZZZZZZ.jpg",
+ "size": "medium"
+ },
+ {
+ "#text": "http://images.amazon.com/images/P/B00002NDAL.01.MZZZZZZZ.jpg",
+ "size": "large"
+ },
+ {
+ "#text": "http://images.amazon.com/images/P/B00002NDAL.01.MZZZZZZZ.jpg",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "5"
+ }
+ },
+ {
+ "name": "On the Radio (Greatest Hits)",
+ "mbid": "",
+ "url": "http://www.last.fm/music/Donna+Summer/On+the+Radio+(Greatest+Hits)",
+ "artist": {
+ "name": "Donna Summer",
+ "mbid": "00bf0071-e5a2-44d7-bcd1-ad9e8d46e960",
+ "url": "http://www.last.fm/music/Donna+Summer"
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/99649711.png",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/99649711.png",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/99649711.png",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/99649711.png",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "6"
+ }
+ },
+ {
+ "name": "Bad Girls",
+ "mbid": "70d781c3-94a8-43a1-a823-2a0ce110e8e1",
+ "url": "http://www.last.fm/music/Donna+Summer/Bad+Girls",
+ "artist": {
+ "name": "Donna Summer",
+ "mbid": "00bf0071-e5a2-44d7-bcd1-ad9e8d46e960",
+ "url": "http://www.last.fm/music/Donna+Summer"
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/56577403.png",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/56577403.png",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/56577403.png",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/56577403.png",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "7"
+ }
+ },
+ {
+ "name": "Off the Wall",
+ "mbid": "ead57fd6-b1f5-4087-aa4c-5f0a0cce1964",
+ "url": "http://www.last.fm/music/Michael+Jackson/Off+the+Wall",
+ "artist": {
+ "name": "Michael Jackson",
+ "mbid": "210769a3-4aca-4199-a2e1-676ef376e078",
+ "url": "http://www.last.fm/music/Michael+Jackson"
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/57606053.png",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/57606053.png",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/57606053.png",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/57606053.png",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "8"
+ }
+ },
+ {
+ "name": "Live At The Budokan",
+ "mbid": "7464156c-347b-4323-85f3-04d0ef9914cb",
+ "url": "http://www.last.fm/music/Chic/Live+At+The+Budokan",
+ "artist": {
+ "name": "Chic",
+ "mbid": "a4ed036b-5f18-439c-b1e1-96d205bab255",
+ "url": "http://www.last.fm/music/Chic"
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/103093173.jpg",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/103093173.jpg",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/103093173.jpg",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/103093173.jpg",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "9"
+ }
+ },
+ {
+ "name": "Grandmix: The Millennium Edition (Mixed by Ben Liebrand) (disc 2)",
+ "mbid": "",
+ "url": "http://www.last.fm/music/Ben+Liebrand/Grandmix:+The+Millennium+Edition+(Mixed+by+Ben+Liebrand)+(disc+2)",
+ "artist": {
+ "name": "Ben Liebrand",
+ "mbid": "a9abe28b-5774-41ea-8393-8b26903fee72",
+ "url": "http://www.last.fm/music/Ben+Liebrand"
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/4576293.jpg",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/4576293.jpg",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/4576293.jpg",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/4576293.jpg",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "10"
+ }
+ },
+ {
+ "name": "Grandmix: The Summer Edition (Mixed by Ben Liebrand) (disc 1)",
+ "mbid": "",
+ "url": "http://www.last.fm/music/Ben+Liebrand/Grandmix:+The+Summer+Edition+(Mixed+by+Ben+Liebrand)+(disc+1)",
+ "artist": {
+ "name": "Ben Liebrand",
+ "mbid": "a9abe28b-5774-41ea-8393-8b26903fee72",
+ "url": "http://www.last.fm/music/Ben+Liebrand"
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/4162885.jpg",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/4162885.jpg",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/4162885.jpg",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/4162885.jpg",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "11"
+ }
+ },
+ {
+ "name": "I Will Survive",
+ "mbid": "48780f4d-53a9-48ae-90b8-68d684b21581",
+ "url": "http://www.last.fm/music/Gloria+Gaynor/I+Will+Survive",
+ "artist": {
+ "name": "Gloria Gaynor",
+ "mbid": "0efc0853-78ed-40f7-b5be-b1b4cc866dba",
+ "url": "http://www.last.fm/music/Gloria+Gaynor"
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/101897739.jpg",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/101897739.jpg",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/101897739.jpg",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/101897739.jpg",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "12"
+ }
+ },
+ {
+ "name": "The Final Album",
+ "mbid": "67ea5fce-5ad6-4311-bdfa-4b605bc0d5c2",
+ "url": "http://www.last.fm/music/Modern+Talking/The+Final+Album",
+ "artist": {
+ "name": "Modern Talking",
+ "mbid": "98913495-8867-43b3-aa8d-db88ee4d4cdc",
+ "url": "http://www.last.fm/music/Modern+Talking"
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/47771735.png",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/47771735.png",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/47771735.png",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/47771735.png",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "13"
+ }
+ },
+ {
+ "name": "Take the Heat Off Me",
+ "mbid": "002a65d3-ab21-4fdd-adbf-ca6d5f39033a",
+ "url": "http://www.last.fm/music/Boney+M./Take+the+Heat+Off+Me",
+ "artist": {
+ "name": "Boney M.",
+ "mbid": "1a79fc33-3cfb-4736-9042-b6b9e8ce4fe9",
+ "url": "http://www.last.fm/music/Boney+M."
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/85837663.png",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/85837663.png",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/85837663.png",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/85837663.png",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "14"
+ }
+ },
+ {
+ "name": "We Are Family",
+ "mbid": "2c570dcb-8812-4898-850d-929f8a5f706a",
+ "url": "http://www.last.fm/music/Sister+Sledge/We+Are+Family",
+ "artist": {
+ "name": "Sister Sledge",
+ "mbid": "1ed00158-c6a3-45cd-819c-2f91997fc480",
+ "url": "http://www.last.fm/music/Sister+Sledge"
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/68619144.png",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/68619144.png",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/68619144.png",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/68619144.png",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "15"
+ }
+ },
+ {
+ "name": "Platinum & Gold Collection Series",
+ "mbid": "",
+ "url": "http://www.last.fm/music/The+Pointer+Sisters/Platinum+&+Gold+Collection+Series",
+ "artist": {
+ "name": "The Pointer Sisters",
+ "mbid": "5b71c3d3-1fbf-4516-baae-471f6aeb913c",
+ "url": "http://www.last.fm/music/The+Pointer+Sisters"
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/8003551.jpg",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/8003551.jpg",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/8003551.jpg",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/8003551.jpg",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "16"
+ }
+ },
+ {
+ "name": "Endless Summer",
+ "mbid": "58f354bc-0aa9-4434-8d47-8698f8731225",
+ "url": "http://www.last.fm/music/Donna+Summer/Endless+Summer",
+ "artist": {
+ "name": "Donna Summer",
+ "mbid": "00bf0071-e5a2-44d7-bcd1-ad9e8d46e960",
+ "url": "http://www.last.fm/music/Donna+Summer"
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/99650463.png",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/99650463.png",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/99650463.png",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/99650463.png",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "17"
+ }
+ },
+ {
+ "name": "GOLD 20 Super Hits",
+ "mbid": "",
+ "url": "http://www.last.fm/music/Boney+M./GOLD+20+Super+Hits",
+ "artist": {
+ "name": "Boney M.",
+ "mbid": "1a79fc33-3cfb-4736-9042-b6b9e8ce4fe9",
+ "url": "http://www.last.fm/music/Boney+M."
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/81385545.jpg",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/81385545.jpg",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/81385545.jpg",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/81385545.jpg",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "18"
+ }
+ },
+ {
+ "name": "The Best of Village People",
+ "mbid": "e8e0f45e-5624-4068-8b50-fb4e13f95c07",
+ "url": "http://www.last.fm/music/Village+People/The+Best+of+Village+People",
+ "artist": {
+ "name": "Village People",
+ "mbid": "f19d3d49-be22-4ca6-9903-64d86984fbf2",
+ "url": "http://www.last.fm/music/Village+People"
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/49902793.jpg",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/49902793.jpg",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/49902793.jpg",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/49902793.jpg",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "19"
+ }
+ },
+ {
+ "name": "20 Hottest Hits",
+ "mbid": "a4a32dc8-e049-4dd6-94ff-5b948e60db22",
+ "url": "http://www.last.fm/music/Hot+Chocolate/20+Hottest+Hits",
+ "artist": {
+ "name": "Hot Chocolate",
+ "mbid": "6bf5d00c-78c6-4adb-b2e6-1fbd93dcb8b1",
+ "url": "http://www.last.fm/music/Hot+Chocolate"
+ },
+ "image": [
+ {
+ "#text": "http://userserve-ak.last.fm/serve/34s/6301769.jpg",
+ "size": "small"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/64s/6301769.jpg",
+ "size": "medium"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/126/6301769.jpg",
+ "size": "large"
+ },
+ {
+ "#text": "http://userserve-ak.last.fm/serve/300x300/6301769.jpg",
+ "size": "extralarge"
+ }
+ ],
+ "@attr": {
+ "rank": "20"
+ }
+ }
+ ],
+ "@attr": {
+ "tag": "Disco",
+ "page": "0",
+ "perPage": "20",
+ "totalPages": "50",
+ "total": "1000"
+ }
+ }
+}
diff --git a/src/IF.Lastfm.Core.Tests/Resources/TagApiResponses.Designer.cs b/src/IF.Lastfm.Core.Tests/Resources/TagApiResponses.Designer.cs
index b128c7d..663a47f 100644
--- a/src/IF.Lastfm.Core.Tests/Resources/TagApiResponses.Designer.cs
+++ b/src/IF.Lastfm.Core.Tests/Resources/TagApiResponses.Designer.cs
@@ -99,5 +99,35 @@ internal static byte[] GetSimilarSuccess {
return ((byte[])(obj));
}
}
+
+ ///
+ /// Looks up a localized resource of type System.Byte[].
+ ///
+ internal static byte[] GetTopAlbumsError {
+ get {
+ object obj = ResourceManager.GetObject("GetTopAlbumsError", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Byte[].
+ ///
+ internal static byte[] GetTopAlbumsSingle {
+ get {
+ object obj = ResourceManager.GetObject("GetTopAlbumsSingle", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Byte[].
+ ///
+ internal static byte[] GetTopAlbumsSuccess {
+ get {
+ object obj = ResourceManager.GetObject("GetTopAlbumsSuccess", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
}
}
diff --git a/src/IF.Lastfm.Core.Tests/Resources/TagApiResponses.resx b/src/IF.Lastfm.Core.Tests/Resources/TagApiResponses.resx
index f76ddde..351ec82 100644
--- a/src/IF.Lastfm.Core.Tests/Resources/TagApiResponses.resx
+++ b/src/IF.Lastfm.Core.Tests/Resources/TagApiResponses.resx
@@ -130,4 +130,13 @@
tag\getsimilarsuccess.json;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ GetTopAlbumsError.json;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ GetTopAlbumsSingle.json;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ GetTopAlbumsSuccess.json;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
\ No newline at end of file
diff --git a/src/IF.Lastfm.Core/Api/Commands/Tag/GetTopAlbumsCommand.cs b/src/IF.Lastfm.Core/Api/Commands/Tag/GetTopAlbumsCommand.cs
new file mode 100644
index 0000000..e174e1a
--- /dev/null
+++ b/src/IF.Lastfm.Core/Api/Commands/Tag/GetTopAlbumsCommand.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using System.Text;
+using System.Threading.Tasks;
+using IF.Lastfm.Core.Api.Enums;
+using IF.Lastfm.Core.Api.Helpers;
+using IF.Lastfm.Core.Objects;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+
+namespace IF.Lastfm.Core.Api.Commands.Tag
+{
+ [ApiMethodName("tag.getTopAlbums")]
+ internal class GetTopAlbumsCommand: GetAsyncCommandBase>
+ {
+ public string TagName { get; set; }
+
+ public GetTopAlbumsCommand(ILastAuth auth, string tagName) : base(auth)
+ {
+ TagName = tagName;
+ }
+
+ public override void SetParameters()
+ {
+ Parameters.Add("tag", TagName);
+ AddPagingParameters();
+ DisableCaching();
+ }
+
+ public async override Task> HandleResponse(HttpResponseMessage response)
+ {
+ var json = await response.Content.ReadAsStringAsync();
+
+ LastResponseStatus status;
+ if (LastFm.IsResponseValid(json, out status) && response.IsSuccessStatusCode)
+ {
+ var jtoken = JsonConvert.DeserializeObject(json);
+ var resultsToken = jtoken.SelectToken("topalbums");
+ var itemsToken = resultsToken.SelectToken("album");
+
+ return PageResponse.CreateSuccessResponse(itemsToken, resultsToken, LastAlbum.ParseJToken, LastPageResultsType.Attr);
+ }
+ else
+ {
+ return LastResponse.CreateErrorResponse>(status);
+ }
+ }
+ }
+}
diff --git a/src/IF.Lastfm.Core/Api/ITagApi.cs b/src/IF.Lastfm.Core/Api/ITagApi.cs
index 35278ae..8ce94d6 100644
--- a/src/IF.Lastfm.Core/Api/ITagApi.cs
+++ b/src/IF.Lastfm.Core/Api/ITagApi.cs
@@ -8,5 +8,6 @@ public interface ITagApi
{
Task> GetSimilarAsync(string tagName);
Task> GetInfoAsync(string tagName);
+ Task> GetTopAlbumsAsync(string tagName,int page,int itemsPerPage);
}
}
\ No newline at end of file
diff --git a/src/IF.Lastfm.Core/Api/TagApi.cs b/src/IF.Lastfm.Core/Api/TagApi.cs
index 0273b73..3602134 100644
--- a/src/IF.Lastfm.Core/Api/TagApi.cs
+++ b/src/IF.Lastfm.Core/Api/TagApi.cs
@@ -43,6 +43,21 @@ public Task> GetInfoAsync(string tagName)
return command.ExecuteAsync();
}
+ ///
+ /// Get the top albums tagged by this tag, ordered by tag count.
+ ///
+ public Task> GetTopAlbumsAsync(string tagName, int page=1, int itemsPerPage= LastFm.DefaultPageLength)
+ {
+ var command = new GetTopAlbumsCommand(Auth, tagName)
+ {
+ HttpClient = HttpClient,
+ Page = page,
+ Count = itemsPerPage
+ };
+
+ return command.ExecuteAsync();
+ }
+
///
/// Fetches the top global tags on Last.fm, sorted by popularity (number of times used).
///
diff --git a/src/IF.Lastfm.Core/IF.Lastfm.Core.csproj b/src/IF.Lastfm.Core/IF.Lastfm.Core.csproj
index b44daa8..7460a2a 100644
--- a/src/IF.Lastfm.Core/IF.Lastfm.Core.csproj
+++ b/src/IF.Lastfm.Core/IF.Lastfm.Core.csproj
@@ -65,6 +65,7 @@
+