A CovidActNow.org API client written in TypeScript.
Note: @kolyaventuri is not affiliated with CovidActNow in any way. This is moreso a side-project, as a way to explore building a strictly typed API client from the ground up.
Browser:
<script type="text/javascript" src="https://unpkg.com/@kolyaventuri/covid-act-now"/>
Node:
npm install @kolyaventuri/covid-act-now
// import CovidActNow from '@kolyaventuri/covid-act-now';
const client = new CovidActNow(`{API_KEY}`);
...
await client.state.az(); // Get current data for Arizona
Types are importable on their own via the /types
directory
import {County} from '@kolyaventuri/covid-act-now/types';
Generally the structure follows what is outlined on CovidActNow.org, under their API docs section (https://apidocs.covidactnow.org/api/). The schema outlined in their docs is equivalent to the included type definitions.
- Returns a Promise, resolving with a summary for all states.
- Returns a Promise, resolving with a summary of timeseries data for all states
- Returns a Promise, resolving with a summary for a single state (ex:
client.state.az()
)
- Returns a Promise, resolving with a summary with timeseries data for a single state (ex:
client.state.az.timeseries()
)
- Returns a Promise, resolving with a summary for all counties for a single state (ex:
client.state.az.counties()
)
- Returns a Promise, resolving with a summary with timeseries data for all counties in a single state (ex:
client.state.az.counties.timeseries()
)
- Returns a Promise, resolving with a summary for all counties.
- Returns a Promise, resolving with a summary with timeseries data for all counties.
- Returns a Promise, resolving with a summary of a single county.
- Returns a Promise, resolving with a summary with timeseries data for a single county.
- See entry under Singular State.
- Returns a Promise, resolving with a summary for all metro areas.
- Returns a Promise, resolving with a summary with timeseries data for all metro areas.
- Returns a Promise, resolving with a summary for a single metro area.
- Returns a Promise, resolving with a summary with timeseries data for a single metro area.
- Returns a Promise, resolving with a summary for the entire United States.
- Returns a Promise, resolving with a summary with timeseries data for the entire United States.
PRs are more than welcome! There's some more work to do, such as parsing dates out of the response data (string -> Date
conversion), and some more robust docs.
npm run test
will run the linter (tsc && xo
), and the test withava
npm run test:integration
will run a basic integration suite, provided you have defined yourCOVID_ACT_NOW_KEY
in a.env
file (see.env.example
)