This is a .NET wrapper library around the API provided by @ExpDev07 https://github.com/ExpDev07/coronavirus-tracker-api for tracking the global coronavirus (COVID-19, SARS-CoV-2) outbreak.
It provides up-to-date data about Coronavirus outbreak includes numbers about confirmed cases, and deaths.
- Available on NuGet: https://www.nuget.org/packages/Covid19Tracker.NET/
- Install into your .NET project(.NET Standard, .NET Core, Xamarin, etc).
Add namespace
Covid19Tracker.Services
and call Covid19TrackerAPI
class to access to all methods.
- Get latest about total confirmed cases and deaths in the world.
Latest latest = await Covid19Tracker.GetLatestAsync();
// Output
Console.WriteLine("Confirmed: " + latest.Confirmed);
Console.WriteLine("Deaths: " + latest.Deaths);
- Get latest related to a specific country based on the country code.
Latest latest = await Covid19Tracker.GetLatestAboutCountryByCodeAsync(string countryCode);
Country code example: "IT" for Italy
- Gets the Coordinates(Longitude and Latitude), the latest data about the country and the last updated date based on the country code.
Location location = await Covid19Tracker.GetLocationWithDataByCodeAsync(string countryCode);
// Output
Console.WriteLine("Country: " + location.Country);
Console.WriteLine("Longitude: " + location.Longitude);
Console.WriteLine("Latitude: " + location.Latitude.);
Console.WriteLine("Confirmed: " + location.Latest.Confirmed);
Console.WriteLine("Deaths: " + location.Latest.Deaths);
Console.WriteLine("Last updated Date: " + location.LastUpdated);
Country code example: "IT" for Italy
- Get latest related to a specific country based on the country name.
Latest latest = await Covid19Tracker.GetLatestAboutCountryByNameAsync(string countryName);
- Gets the Coordinates(Longitude and Latitude), the latest data about the country and the last updated date based on the country name.
Location location = await Covid19Tracker.GetLocationWithDataByNameAsync(string countryName);
// Output
Console.WriteLine("Country: " + location.Country);
Console.WriteLine("Longitude: " + location.Longitude);
Console.WriteLine("Latitude: " + location.Latitude.);
Console.WriteLine("Confirmed: " + location.Latest.Confirmed);
Console.WriteLine("Deaths: " + location.Latest.Deaths);
Console.WriteLine("Last updated Date: " + location.LastUpdated);
Country name example: "Italy"
- Get Data from of all locations in the world (Latest + Locations).
CoronavirusOutbreakData data = await Covid19Tracker.GetTheWorldCovid19Data();
- Get all countries data.
List<Location> result = await Covid19Tracker.GetAllCountriesDataAsync();
public class Latest
{
// Gets or sets the total of confirmed cases.
public long Confirmed { get; set; }
// Gets or sets the total of deaths.
public long Deaths { get; set; }
}
public class Location
{
// Gets or sets the coordinates.
public Coordinates Coordinates { get; set; }
// Gets or sets the country name.
public string Country { get; set; }
// Gets or sets the country Code.
public string CountryCode { get; set; }
// Gets or sets the last updated date.
public DateTime LastUpdated { get; set; }
// Gets or sets the latest data about the location.
// Gets or sets the province.
public string Province { get; set; }
}
public class CoronavirusOutbreakData
{
// Gets or sets the Latest.
public Latest Latest { get; set; }
// Gets or sets the Locations.
public List<Location> Locations { get; set; }
}
Thanks to @ExpDev07 for developing coronavirus-tracker-api.
- LinkedIn: Kodjo Laurent Egbakou
- Twitter: @lioncoding
The MIT License (MIT) see License file
Feel free to create issues and PRs 😃