• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Abdirahiim/covidtrackerapiwrapper: CovidSharp is a crossplatform C# API wrapper ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

Abdirahiim/covidtrackerapiwrapper

开源软件地址:

https://github.com/Abdirahiim/covidtrackerapiwrapper

开源编程语言:

C# 100.0%

开源软件介绍:

CovidSharp

All Contributors Build status NuGet NuGet GitHub stars GitHub forks HitCount

CovidSharp is a crossplatform C# API wrapper for the Coronavirus tracking API

Installation

You can install it as a nuget package

Usage

Call the Library

using CovidSharp;
  • Declares the instance of the library
CoronavirusData data = new CoronavirusData();

Get the Latest Data

  • Fetches the latest worldwide data
 Console.WriteLine("Confirmed: " + data.LatestConfirmed());
 Console.WriteLine("Recovered: " + data.LatestRecovered());
 Console.WriteLine("Deaths: " + data.LatestDeaths());

Get Data by country code

  • Use a country code and fetch the data of that country
 Console.WriteLine("Denmark Confirmed: " + data.FromCountryConfirmed("DK"));
 Console.WriteLine("Denmark Recovered: " + data.FromCountryRecovered("DK"));
 Console.WriteLine("Denmark Deaths: " + data.FromCountryDeaths("DK"));
 Console.WriteLine("Denmark Population: " + data.FromCountryCodePopulation("DK"));

Get Data by country name

  • Use a country code and fetch the data of that country
   Console.WriteLine("China Confirmed: " + data.FromCountryNameConfirmed("China"));
   Console.WriteLine("China Recovered: " + data.FromCountryNameRecovered("China"));
   Console.WriteLine("China population: " + data.FromCountryNamePopulation("China"));

Get Data by ID

You can use the associated ID of a province or country to get the desired information You can find countries IDs here

  • This code gets the latest data of Denmark using ID instead of a country code
 Console.WriteLine("Denmark ID Confirmed: " + data.FromIDConfirmed("94"));
 Console.WriteLine("Denmark  ID Recovered: " + data.FromCountryRecovered("94"));
 Console.WriteLine("Denmark ID Deaths: " + data.FromCountryDeaths("94"));
  • Get the province name associated with an ID, in this case the ID of 92 is associated with the Faroe Islands province
  Console.WriteLine("Name of the Faroe Islands: " + data.FromIDProvince("92"));
  • Get the country name associated with an ID, in this case the ID of 92 is associated with the Faroe Islands province
  Console.WriteLine("Name of the country of the Faroe Islands: " + data.FromIDCountry("92"));
  • Get the latitude associated with an ID
  Console.WriteLine("Denmark Latitude: " + data.FromIDLatitude("94"));
  • Get the longitude associated with an ID
  Console.WriteLine("Denmark Longtitude: " + data.FromIDLongitude("94"));
  • Get the country population associated with an ID
   Console.WriteLine("Denmark Population: " + data.FromIDPopulation("94"));

Get a list of data

You can easily fetch a list of your desired data, the default source is always jhs

  • Get a list of the all the countries in the world
  Console.WriteLine(data.GetCountryList());
  • Get a list of the populations of all the countries in the world
  Console.WriteLine(data.GetPopulationList());
  • Get a list of the provinces of all the countries in the world
  Console.WriteLine(data.GetProvinceList());
  • Get a list of the counties in the US using CSBS as a source
  Console.WriteLine(data.GetCountyList("csbs"));

Contributors

Thanks goes to these wonderful people (emoji key):


Abdirahiim Yassin


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
prafulla-codes/express-autodocs: A GitHub action which automatically generates d ...发布时间:2022-06-13
下一篇:
ExpDev07/coronavirus-tracker-api: 发布时间:2022-06-13
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap