3个版本 (重大变更)
0.3.0 | 2020年5月8日 |
---|---|
0.2.0 | 2020年5月3日 |
0.1.0 | 2020年4月16日 |
#1 in #covid
43KB
544 代码行
为cv19api和coviddata提供的快速且简单的Rust包装器
为什么?
为什么不呢?学习新事物很有趣。
cv19api
处理以下端点并返回每个端点的Ok(Response)。每个端点都有自己的响应类型,而不是使信任和区域字段可选。
/deaths
{
"data": [
{
"date": "2020-04-14",
"deaths": 113
},
...
]
,
"metaData": {
"recordedOnTo": "2020-04-15",
"from": "2020-03-16",
"to": "2020-04-15",
"recordedOnFrom": "2020-01-01"
}
}
/deaths/trusts
{
"data": [
{
"date": "2020-04-14",
"trust": "AIREDALE NHS FOUNDATION TRUST",
"deaths": 0
},
...
]
,
"metaData": {
"recordedOnTo": "2020-04-15",
"from": "2020-03-16",
"to": "2020-04-15",
"recordedOnFrom": "2020-01-01"
}
}
/deaths/regions
{
"data": [
{
"date": "2020-04-14",
"region": "EAST_OF_ENGLAND",
"deaths": 41
},
...
]
,
"metaData": {
"recordedOnTo": "2020-04-15",
"from": "2020-03-16",
"to": "2020-04-15",
"recordedOnFrom": "2020-01-01"
}
}
coviddata
v1/countries/stats.json
[
{
"country": {
"key": "united-states",
"name": "United States"
},
"dates": {
"2020-01-22": {
"new": {
"cases": 1,
"deaths": 0,
"recoveries": 0
},
"cumulative": {
"cases": 1,
"deaths": 0,
"recoveries": 0
}
},
"2020-01-23": {
"new": {
"cases": 0,
"deaths": 0,
"recoveries": 0
},
"cumulative": {
"cases": 1,
"deaths": 0,
"recoveries": 0
}
}
}
}
]
v1/regions/stats.json
[
{
"region": {
"key": "new-york-united-states",
"name": "New York",
"full_name": "New York, United States",
"country": {
"location_type": "country",
"key": "united-states",
"name": "United States"
}
},
"dates": {
"2020-03-01": {
"new": {
"cases": 1,
"deaths": 0,
"recoveries": 0
},
"cumulative": {
"cases": 1,
"deaths": 0,
"recoveries": 0
}
},
"2020-03-02": {
"new": {
"cases": 0,
"deaths": 0,
"recoveries": 0
},
"cumulative": {
"cases": 1,
"deaths": 0,
"recoveries": 0
}
}
}
}
]
v1/places/stats.json
[
{
"place": {
"key": "new-york-city-new-york-united-states",
"name": "New York City",
"full_name": "New York City, New York, United States",
"country": {
"location_type": "country",
"key": "united-states",
"name": "United States"
},
"region": {
"location_type": "region",
"key": "new-york-united-states",
"name": "New York",
"full_name": "New York, United States",
"country": {
"location_type": "country",
"key": "united-states",
"name": "United States"
}
}
},
"dates": {
"2020-03-01": {
"new": {
"cases": 1,
"deaths": 0,
"recoveries": 0
},
"cumulative": {
"cases": 1,
"deaths": 0,
"recoveries": 0
}
},
"2020-03-02": {
"new": {
"cases": 0,
"deaths": 0,
"recoveries": 0
},
"cumulative": {
"cases": 1,
"deaths": 0,
"recoveries": 0
}
}
}
}
]
示例
快速且简单的使用
cargo run --example cv19api_deaths_by_region
cargo run --example cv19api_deaths_by_trust
cargo run --example cv19api_deaths
cargo run --example coviddata_countries
依赖关系
~4–8.5MB
~190K SLoC