openaq

0.1.0 • Public • Published

openaq

A ES6 promise-based JS client for the OpenAQ API

Install:

npm install openaq
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)

  • example:
cities().then(results => {
  //results here
})
 
//with optional parameters
cities({country:'US', page:2}).then(results => {
  //results here
})

.countries(params)

  • example:
countries().then(results => {
  //results here
})
 
//with optional parameters
countries({limit:10, page:2}).then(results => {
  //results here
})

.fetches(params)

  • example:
fetches().then(results = {
  //results here
})
 
//with optional parameters
fetches({limit:10, page:2}).then(results => {
  //results here
})

.latest(params)

  • example:
latest().then(results => {
  //results here
})
 
//with optional parameters
latest({location:'Bowling Green', parameter:'o3'}).then(results => {
  //results here
})

.locations(params)

  • example:
locations().then(results => {
  //results here
})
 
//with optional parameters
locations({location:'Bowling Green', parameter:'o3'}).then(results => {
  //results here
})

.measurements(params)

  • example:
measurements().then(results => {
  //results here
})
 
//with optional parameters
measurements({location:'Bowling Green', parameter:'o3'}).then(results => {
  //results here
})

.parameters()

  • example:
parameters().then(results => {
  //results here
})

.sources(params)

  • example:
 
sources().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)

Readme

Keywords

Package Sidebar

Install

npm i openaq

Weekly Downloads

4

Version

0.1.0

License

MIT

Last publish

Collaborators

  • nickolasclarke