private async Task<XDocument> QueryTrackAsync(LastFmMethod method, string artist, string track) { Dictionary<string, string> query = new Dictionary<string, string>(){ { "artist", artist }, { "track", track } }; return await QueryAsync(GenerateUrl(method, query)); }
private async Task<XDocument> QueryTrackAsync(LastFmMethod method, string artist, string track) { var query = new Dictionary<string, object>(){ { "artist", artist }, { "track", track }, { "limit", ResultLimit } }; return await QueryAsync(GenerateUrl(method, query)); }
private async Task<XDocument> QueryGlobalAsync(LastFmMethod method) { var query = new Dictionary<string, object>(){ { "limit", ResultLimit } }; return await QueryAsync(GenerateUrl(method, new Dictionary<string, object>())); }
private string GetMethodName(LastFmMethod method) { var attribute = (LastFmMethodNameAttribute)method.GetType() .GetMember(method.ToString()).First() .GetCustomAttributes(typeof(LastFmMethodNameAttribute), false) .First(); return attribute.Value; }
private async Task <XDocument> QueryGlobalAsync(LastFmMethod method) { var query = new Dictionary <string, object>() { { "limit", ResultLimit } }; return(await QueryAsync(GenerateUrl(method, new Dictionary <string, object>()))); }
private async Task <XDocument> QueryTrackAsync(LastFmMethod method, string artist, string track) { var query = new Dictionary <string, object>() { { "artist", artist }, { "track", track }, { "limit", ResultLimit } }; return(await QueryAsync(GenerateUrl(method, query))); }
private string GetMethodName(LastFmMethod method) { var attribute = (LastFmMethodNameAttribute)method.GetType() .GetMember(method.ToString()).First() .GetCustomAttributes(typeof(LastFmMethodNameAttribute), false) .First(); return(attribute.Value); }
private string GenerateUrl( LastFmMethod method, Dictionary<string, string> query) { StringBuilder uri = new StringBuilder(this.serviceUrl); AppendQueryString(uri, "method", GetMethodName(method)); foreach (var kvp in query) { AppendQueryString(uri, kvp.Key, kvp.Value); } return uri.ToString(); }
private string GenerateUrl( LastFmMethod method, Dictionary <string, object> query) { StringBuilder uri = new StringBuilder(this.serviceUrl); AppendQueryString(uri, "method", GetMethodName(method)); foreach (var kvp in query) { AppendQueryString(uri, kvp.Key, kvp.Value.ToString()); } return(uri.ToString()); }
private async Task<XDocument> QueryGlobalAsync(LastFmMethod method) { return await QueryAsync(GenerateUrl(method, new Dictionary<string, string>())); }