0.5.5 • Published 2 years ago

covid19-cz-api v0.5.5

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Czech Republic Covid 19 REST API wrapper

Node.js wrapper for official data provided by Ministry of Health. Documentation and data content are in czech language.

API is publicly accessible, you only need to get your personal token via registration. There is an hourly quota for calling the API, so be careful.

This package is lightweight wrapper around the REST api endpoints - what query parameters are available for given endpoint is stated in the documentation of the endpoint you want to call.

Endpoints are thematically grouped under classes. Usage is pretty much the same, so for example in case of getting overview data of vaccinations:

import {Vaccination} from "covid19-cz-api";

(async () => {
    const api = new Vaccination("yourApiToken");

    const [status, body] =  await api.getOverviewData({
        queryParams: { page: "1", itemsPerPage: "100" },
        options: { headers: { accept: "application/json" } },
      });

    if (status) {
        body.forEach((record) => {
            console.log(JSON.stringify(record, null, 2));
        })
    }
})();

status will be true if response has statusCode in interval <200, 300>. More precisely, if used package node-fetch call has response with status.ok.

Otherwise returns false and in the body object there is either error message by the api server, or if error was caught, the error message.

0.5.5

2 years ago

0.5.4

2 years ago

0.5.3

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.5.0

2 years ago