Skip to content

Commit

Permalink
Initial development (#1)
Browse files Browse the repository at this point in the history
* 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
asrafalih authored May 23, 2021
1 parent 2ccf6fa commit 8b09a45
Show file tree
Hide file tree
Showing 21 changed files with 2,311 additions and 1,584 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ jobs:
node-version: "12.x"
- name: Install dependencies
run: yarn
- name: Test Package
run: yarn test
- name: Lint Package
run: yarn lint
- name: Build Package
run: yarn build
- name: Webpack Compile
run: yarn compile
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ scripts/
docs/
examples/
.eslintrc
.eslintignore
.eslintignore
*.map
101 changes: 94 additions & 7 deletions README.md
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"
```
2 changes: 1 addition & 1 deletion docs/assets/js/search.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8b09a45

Please sign in to comment.