This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

cowin

1.0.4 • Public • Published

Cowin

A NodeJS wrapper of Cowin Public API. We can win Covid 🤝

Installation:

npm install cowin

Available methods:

  • getState - Get all states in India
  • getListofDistricts - Get get all the districts of state
  • findByPin - Get planned vaccination sessions on a specific date in a given pin
  • findByDistrict - Get planned vaccination sessions on a specific date in a given district
  • calendarByPin - Get planned vaccination sessions for 7 days from a specific date in a given pin,
  • calendarByDistrict - Get planned vaccination sessions for 7 days from a specific date in a given district

Referred to Cowin API Docs for more details.

Usage:

  • Import required modules
const {
    getStates,
    getListofDistricts,
    findByPin,
    findByDistrict,
    calendarByPin,
    calendarByDistrict
} = require('cowin')
  • Write asynchronous function
async function fireitup() { /* asynchronous */

    const allstates = await getStates()
    console.log(allstates)

    const alldistricts = await getListofDistricts(36) /* { state_id } */
    console.log(alldistricts)

    const calenderbypin = await calendarByPin(731204, '13-05-2021') /* { pincode, date } */
    console.log(calenderbypin)

    const calenderbydistrict = await calendarByDistrict(713, '13-05-2021') /* district_id, date */
    console.log(calenderbydistrict)

    const findbypin = await findByPin(731204, '13-05-2021') /* { pincode, date } */
    console.log(findbypin)

    const findbydistrict = await findByDistrict(713, '13-05-2021') /* district_id, date */
    console.log(findbydistrict)

}

fireitup()
  • Response will looks like
{
    status: true,
    result: [/* Results */]
}
  • Exception handling
{
    status: false,
    message: "Sorry that's an error"
}

Limitation:

APIs are subject to a rate limit of 100 API calls per 5 minutes per IP

Crafted with care by Tuhin 💗

Package Sidebar

Install

npm i cowin

Weekly Downloads

2

Version

1.0.4

License

Apache-2.0

Unpacked Size

20.9 kB

Total Files

4

Last publish

Collaborators

  • cachecleanerjeet