Skip to content
This repository has been archived by the owner on Mar 12, 2022. It is now read-only.

A .NET client for the Corona virus COVID-19 Data Repository by Johns Hopkins CSSE

License

Notifications You must be signed in to change notification settings

Chitova263/COVID19API-NET-CLIENT

Repository files navigation

COVID19API-NET-CLIENT

A .NET Client for the Corona Virus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE

Nuget Nuget

What is COVID-19

Coronavirus disease 2019 (COVID-19) is an infectious disease caused by severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2). The disease was first identified in 2019 in Wuhan, the capital of Hubei, China, and has since spread globally, resulting in the 2019–20 coronavirus pandemic. Wikipedia

Nuget

.NET CLI

dotnet add package COVID19API-NET --version 4.0.1

PACKAGE MANAGER

Install-Package COVID19API-NET -Version 4.0.1

Examples

Get All Locations

using System.Threading.Tasks;
using Covid19.Client;
using Covid19.Client.Models;

namespace Covid19API.Web.Examples.Console
{
    class Program
    {
        public static ICovid19Client _client = new Covid19Client();

        static async Task Main(string[] args)
        {
           IEnumerable<Location> locations = await client.GetLocationsAsync();
           locations.Dump();
        }
    }
}
[
  {
    "UID": "4",
    "Iso2": "AF",
    "Iso3": "AFG",
    "Code3": "4",
    "FIPS": "",
    "Admin2": "",
    "CountryRegion": "Afghanistan",
    "ProvinceState": "",
    "Latitude": 33.93911,
    "Longitude": 67.709953,
    "Population": 38928341,
    "CombinedKey": "Afghanistan"
  },
  {
    "UID": "8",
    "Iso2": "AL",
    "Iso3": "ALB",
    "Code3": "8",
    "FIPS": "",
    "Admin2": "",
    "CountryRegion": "Albania",
    "ProvinceState": "",
    "Latitude": 41.1533,
    "Longitude": 20.1683,
    "Population": 2877800,
    "CombinedKey": "Albania"
  }
]

Get TimeSeries

static async Task Main(string[] args)
{
   IEnumerable<TimeSeries> timeSeriesForAllLocations = await client.GetTimeSeriesAsync();
   timeSeriesForAllLocations.Dump();
     
    var location = locations.First();
    var fromDate = DateTime.Now.AddDays(-10);
    var toDate = DateTime.Now;
    IEnumerable<TimeSeries> locationTimeSeries = await client.GetTimeSeriesAsync(fromDate, toDate, location.UID);
    locationTimeSeries.Dump();
}
[
    {
      "Location": "Afghanistan-",
      "Data": [
        {
          "Date": "2020-01-22T00:00:00",
          "Confirmed": 0,
          "Deaths": 0,
          "Recovered": 0
        },
        {
          "Date": "2020-01-23T00:00:00",
          "Confirmed": 0,
          "Deaths": 0,
          "Recovered": 0
        },
        {
          "Date": "2020-01-24T00:00:00",
          "Confirmed": 0,
          "Deaths": 0,
          "Recovered": 0
        },
       ]
    }
]

Licence

The library is released under terms of the MIT License

About

A .NET client for the Corona virus COVID-19 Data Repository by Johns Hopkins CSSE

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages