-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLastFMClient.cs
44 lines (32 loc) · 1.4 KB
/
LastFMClient.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using RestSharp;
using RestSharp.Deserializers;
using System;
namespace LastFM.ReaderCore
{
public class LastFMClient : BaseClient
{
public string apiKey { get; set; }
public LastFMClient (ICacheService cache, IDeserializer serializer, IErrorLogger errorLogger)
: base(cache, serializer, errorLogger, "http://ws.audioscrobbler.com/2.0/") { }
public LastFMArtistCorrection artistCorrection(string artist)
{
var request = new RestRequest("", Method.POST);
var prefix = "corr";
request.AddQueryParameter("method", "artist.getcorrection");
request.AddQueryParameter("api_key", apiKey);
request.AddQueryParameter("format", "json");
request.AddQueryParameter("artist", artist);
return GetFromCache<LastFMArtistCorrection>(request, String.Concat(prefix, artist));
}
public LastFMArtistTag artistTag(string artist)
{
var request = new RestRequest("", Method.POST);
var prefix = "tag";
request.AddQueryParameter("method", "artist.gettoptags");
request.AddQueryParameter("api_key", apiKey);
request.AddQueryParameter("format", "json");
request.AddQueryParameter("artist", artist);
return GetFromCache<LastFMArtistTag>(request, String.Concat(prefix, artist));
}
}
}