Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xxczaki/airly
Simple wrapper for Airly API, works in Node.js & the browser
https://github.com/xxczaki/airly
air air-pollution air-pollution-levels airly airly-api api async-await data got js library nodejs npm package pollution promise simple small smog wrapper
Last synced: about 1 month ago
JSON representation
Simple wrapper for Airly API, works in Node.js & the browser
- Host: GitHub
- URL: https://github.com/xxczaki/airly
- Owner: xxczaki
- License: mit
- Created: 2018-11-30T23:38:33.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-07-31T20:07:19.000Z (over 2 years ago)
- Last Synced: 2024-05-01T14:30:08.913Z (8 months ago)
- Topics: air, air-pollution, air-pollution-levels, airly, airly-api, api, async-await, data, got, js, library, nodejs, npm, package, pollution, promise, simple, small, smog, wrapper
- Language: TypeScript
- Homepage:
- Size: 43.9 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: license
Awesome Lists containing this project
README
# Airly :cloud:
> Simple wrapper for [Airly API](https://developer.airly.eu/docs)
[![Build Status](https://travis-ci.org/xxczaki/airly.svg?branch=master)](https://travis-ci.org/xxczaki/airly)
[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo)
[![Install size](https://packagephobia.now.sh/badge?p=airly)](https://packagephobia.now.sh/result?p=airly)[**Czytaj po polsku :poland:**](https://github.com/xxczaki/airly/blob/master/readme_pl.md)
## Highlights
* Simple, asynchronous API
* Works in Node.js & the browser
* Uses the 2.0 version of Airly API
* Full API coverage
* Actively maintained
* Lightweight
* Written in TypeScript## Install
```
$ npm install airly
```## Usage
```js
const Airly = require('airly');const airly = new Airly('API_KEY');
(async () => {
try {
const data = await airly.installationInfo(240);
console.log(data);
} catch (error) {
console.log(error);
}
})();
```## API
> Check out the [`examples`](https://github.com/xxczaki/airly/tree/master/examples) folder :rocket:
### new Airly(key, language)
> Constructor for other operations
**key**
Type: `string`
Your Airly API key. You can obtain one [here](https://developer.airly.eu/).
**language**
Type: `string`
Default: `en`
Get air quality descriptions in specified language. Currently supported languages are English ('en' - default) and Polish ('pl').
For more information check out [Airly's documentation](https://developer.airly.eu/docs#general.language)
### airly.installationMeasurements(id)
> Returns detailed measurements (current, historical and future) for an installation
**id**
Type: `number`
Unique number of the installation
### airly.installationInfo(id)
> Returns information about specified installation
**id**
Type: `number`
Unique number of the installation
### airly.nearestInstallations(lat, lng, maxDistanceKM, maxResults)
> Returns information about the nearest installations (including their ID's)
**lat**
Type: `number`
Latitude
**lng**
Type: `number`
Longitude
**maxDistanceKM**
Type: `number`
Default: 3
All the returned installations must be located within this limit from the given point (in km); negative value means no limit.
**maxResults**
Type: `number`
Default: -1
Maximum number of installations to return; negative value means no limit.
### airly.nearestMeasurements(lat, lng, maxDistanceKM)
> Returns detailed measurements (current, historical and future) from the installation which is closest to a given point
**lat**
Type: `number`
Latitude
**lng**
Type: `number`
Longitude
**maxDistanceKM**
Type: `number`
Default: 3
All the returned installations must be located within this limit from the given point (in km); negative value means no limit.
### airly.pointMeasurements(lat, lng)
> Returns detailed measurements (current, historical and future) for a map point, which can be interpolated from nearby installations
**lat**
Type: `number`
Latitude
**lng**
Type: `number`
Longitude
### airly.metaIndexes()
> Returns a list of IndexTypes supported by the platform
### airly.metaMeasurements()
> Returns a list of MeasurementTypes supported by the platform
## License
MIT © [Antoni Kepinski](https://kepinski.me)