Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nickolasclarke/openaq
A JS client for the OpenAQ API
https://github.com/nickolasclarke/openaq
air-quality es2015 es6 iot isomorphic node npm-module openaq sustainability
Last synced: 12 days ago
JSON representation
A JS client for the OpenAQ API
- Host: GitHub
- URL: https://github.com/nickolasclarke/openaq
- Owner: nickolasclarke
- License: mit
- Created: 2017-01-22T06:41:51.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-14T07:36:21.000Z (over 7 years ago)
- Last Synced: 2024-10-05T18:04:47.131Z (about 1 month ago)
- Topics: air-quality, es2015, es6, iot, isomorphic, node, npm-module, openaq, sustainability
- Language: JavaScript
- Homepage: https://openaq.org
- Size: 8.79 KB
- Stars: 17
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-air-quality - openaq - _A JS client for the OpenAQ API_ (Software Libraries)
README
# openaq
A ES6 promise-based JS client for the [OpenAQ](https://openaq.org) API## Install:
```bash
npm install openaq
```
```javascript
const openaq = require('openaq')
const client = new openaq
```## API:
Any parameters should be passed as an optional `params` object as seen in the examples.### [.getCities(params)](https://docs.openaq.org/#api-Cities)
- example:
```javascript
cities().then(results => {
//results here
})//with optional parameters
cities({country:'US', page:2}).then(results => {
//results here
})
```### [.countries(params)](https://docs.openaq.org/#api-Countries)
- example:
```javascript
countries().then(results => {
//results here
})//with optional parameters
countries({limit:10, page:2}).then(results => {
//results here
})
```
### [.fetches(params)](https://docs.openaq.org/#api-Fetches)
- example:
```javascript
fetches().then(results = {
//results here
})//with optional parameters
fetches({limit:10, page:2}).then(results => {
//results here
})
```### [.latest(params)](https://docs.openaq.org/#api-Latest)
- example:
```javascript
latest().then(results => {
//results here
})//with optional parameters
latest({location:'Bowling Green', parameter:'o3'}).then(results => {
//results here
})
```### [.locations(params)](https://docs.openaq.org/#api-Locations)
- example:
```javascript
locations().then(results => {
//results here
})//with optional parameters
locations({location:'Bowling Green', parameter:'o3'}).then(results => {
//results here
})
```### [.measurements(params)](https://docs.openaq.org/#api-Measurements)
- example:
```javascript
measurements().then(results => {
//results here
})//with optional parameters
measurements({location:'Bowling Green', parameter:'o3'}).then(results => {
//results here
})
```### [.parameters()](https://docs.openaq.org/#api-Parameters)
- example:
```javascript
parameters().then(results => {
//results here
})
```### [.sources(params)](https://docs.openaq.org/#api-Sources)
- example:
```javascriptsources().then(results => {
//results here
})//with optional parameters
sources({limit:10, page:2}).then(results => {
//results here
})
```
## TODO
- add testing
- make isomorphic (commonJS and ES2015 module support)