private static async Task Main() { using var client = new HttpClient(); var api = new IpInfoApi(client); var response = await api.GetCurrentInformationAsync(); Console.WriteLine($"City: {response.City}"); }
public async Task <FullResponse> getIPdetails(ProviderQuality p1) { FullResponse response = new FullResponse(); Stopwatch stopwatch = new Stopwatch(); try { var client = new HttpClient(); var api = new IpInfoApi(client); p1.requestCount++; stopwatch.Reset(); stopwatch.Start(); response = await api.GetCurrentInformationAsync(); stopwatch.Stop(); p1.avgResponseTime += stopwatch.ElapsedMilliseconds / 2; } catch (Exception e) { //log exception } return(response); }