public ExchangeRatesItem ExchangeRate(Currency currency) { var client = new WebClient(); client.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"); var ls = ExchangeRatesItem.FromJson( client.DownloadString($"https://api.paybear.io/v2/exchange/{currency.ToString()}/rate")); return(ls); }
public static string ToJson(this ExchangeRatesItem self) => JsonConvert.SerializeObject((object)self, (JsonSerializerSettings)Converter.Settings);