public static LastFmAuthResult FromJson(JToken json) { if (json == null) throw new ArgumentException("Json can not be null."); var result = new LastFmAuthResult(); result.Username = json["name"].Value<string>(); result.Key = json["key"].Value<string>(); return result; }
public static LastFmAuthResult FromJson(JToken json) { if (json == null) { throw new ArgumentException("Json can not be null."); } var result = new LastFmAuthResult(); result.Username = json["name"].Value <string>(); result.Key = json["key"].Value <string>(); return(result); }
public async Task <LastFmAuthResult> GetMobileSession(string username, string password) { var parameters = new Dictionary <string, string>(); parameters.Add("username", username); parameters.Add("password", password); parameters.Add("api_key", _lastFm.ApiKey); parameters.Add("api_sig", LastFmUtils.BuildSig(_lastFm.ApiSecret, "auth.getMobileSession", parameters)); var response = await new CoreRequest(new Uri(LastFmConst.MethodBaseSecure + "auth.getMobileSession"), null, "POST", parameters).Execute(); if (!LastFmErrorProcessor.ProcessError(response)) { return(null); } if (response["session"] != null) { return(LastFmAuthResult.FromJson(response["session"])); } return(null); }