Skip to content

Latest commit

 

History

History
146 lines (101 loc) · 4.46 KB

V1.0.0README.md

File metadata and controls

146 lines (101 loc) · 4.46 KB

IconCovid19Tracker.NET v1.0.0

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.

Setup

Note

Add namespace Covid19Tracker.Services and call Covid19TrackerAPI class to access to all methods.

Usage

  • 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();

Classes

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; }
}

Credits

Thanks to @ExpDev07 for developing coronavirus-tracker-api.

Created by: Kodjo Laurent Egbakou

License

The MIT License (MIT) see License file

Contribution

Feel free to create issues and PRs 😃