public async Task <dynamic> GetJsonAsync(string api, CancellationToken token = new CancellationToken(), Pairs parapairs = null) { var query = parapairs.ToPairsString(); try { var response = await Client.GetAsync($"{api}{query}", token); var s = await response.Content.ReadAsStringAsync(); return(JsonConvert.DeserializeObject(s)); } catch (Exception e) { Extend.Log(e); Extend.ShowMessage(e.Message); return(null); } }
public async Task <XmlDocument> GetXmlAsync(string api, CancellationToken token = new CancellationToken(), Pairs pairs = null) { var query = pairs.ToPairsString(); var xml = new XmlDocument(); try { var response = await Client.GetAsync($"{api}{query}", token); var s = await response.Content.ReadAsStringAsync(); xml.LoadXml(s); } catch (Exception e) { Extend.ShowMessage(e.Message); Extend.Log(e); return(null); } return(xml); }