generated from hi-imcodeman/typescript-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: initial development * chore: pre-commit fix * chore: 18+ slots * chore: find state and district by text * chore: remove unwanted files * chore: fix ci * chore: cli added * chore: map files added to npmignore * chore: lint fix * chore: cron added * chore: tg message changes * chore: cron modified * chore: test cron * chore: cron modified for statewise * chore: Proper readme added * chore: docs updated * chore: EOL fix * chore: minor EOL fix
- Loading branch information
Showing
21 changed files
with
2,311 additions
and
1,584 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ scripts/ | |
docs/ | ||
examples/ | ||
.eslintrc | ||
.eslintignore | ||
.eslintignore | ||
*.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,98 @@ | ||
# Typescript Template | ||
# CoWin-ator | ||
|
||
This is the template repo of typescript project. | ||
This is the package to get Cowin slots and stats by state/district. | ||
|
||
Download this repo and start using it as base template of your project. | ||
Please refer [API Documentation](https://hi-imcodeman.github.io/cowinator) here. | ||
|
||
Pre-installed and confiured with followings: | ||
[![NPM](https://nodei.co/npm/cowinator.png)](https://nodei.co/npm/cowinator/) | ||
|
||
- [Typescript](https://www.typescriptlang.org/) | ||
- [Jest](https://jestjs.io/) | ||
- [Webpack](https://webpack.js.org/) | ||
## Installation | ||
|
||
Install using 'npm' | ||
|
||
```sh | ||
npm i cowinator | ||
``` | ||
|
||
Install using 'yarn' | ||
|
||
```sh | ||
yarn add cowinator | ||
``` | ||
|
||
## Development Usage | ||
|
||
```javascript | ||
import { Cowinator } from "cowinator"; | ||
|
||
const client = new Cowinator(); | ||
|
||
// List of states having state_id and state_name | ||
client.getStates().then((states) => { | ||
console.log(states); | ||
}); | ||
|
||
// List of districts having district_id and district_name | ||
const state_id = 2; // state_d:2 for 'Andhra Pradesh' | ||
client.getDistricts(state_id).then((districts) => { | ||
console.log(districts); | ||
}); | ||
|
||
// Get stats for specified state | ||
client.getStatsByState(state_id).then((stats) => { | ||
console.log(stats); | ||
}); | ||
|
||
const district_id = 571; // district_id:571 for 'Chennai' | ||
// Get stats for specified state | ||
client.getStatsByDistrict(district_id).then((stats) => { | ||
console.log(stats); | ||
}); | ||
|
||
// Get list of sessions for a district | ||
client.findByDistrict(district_id).then((sessions) => { | ||
console.log(sessions); | ||
}); | ||
|
||
// Find state_id by search string | ||
client.findStateByName("tamil").then((matchedState) => { | ||
console.log(matchedState); // Will get state_id and state_name for 'tamil nadu' | ||
}); | ||
|
||
// Find state_id by search string | ||
client.findDistrictByName(state_id, "east").then((matchedDistrict) => { | ||
console.log(matchedDistrict); // Will get district_id and district_name for 'East Godavari' | ||
}); | ||
``` | ||
|
||
## CLI | ||
|
||
We can use this package in CLI. | ||
|
||
Install for CLI | ||
|
||
```sh | ||
npm i -g cowinator | ||
``` | ||
|
||
### CLI Usage | ||
|
||
To get the stats for a state | ||
|
||
```sh | ||
cowinator andhra | ||
``` | ||
|
||
To get the stats for a particular district in a state | ||
|
||
```sh | ||
cowinator "tamil nadu" --district chennai | ||
``` | ||
|
||
To post the stats to the telegram channel. | ||
|
||
`Note: Please assign your bot token to 'TELEGRAM_BOT_TOKEN' as environment variable.` | ||
|
||
```sh | ||
cowinator "tamil nadu" --district chennai --tgChannel "@channelname" | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.