Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

airly

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

airly - npm Package Compare versions

Comparing version 2.0.1 to 3.0.0

36

dist/index.d.ts

@@ -18,11 +18,19 @@ interface AirlyConfig {

/**
* @param {number} lat Latitude - Geographical coordinate
* @param {number} lng Longitude - Geographical coordinate
* @param {number} [maxDistanceKM=3] All the returned installations must be located within this limit from the given point (in km); negative value means no limit
* @param {number} [maxResults=-1] Maximum number of installations to return; negative value means no limit
* @returns {Promise<object[]>} List of installations given by location point, ordered by distance to that point
*/
nearestInstallations(lat: number, lng: number, maxDistanceKM?: number, maxResults?: number): Promise<string>;
/**
* @param {number} id Installation ID - Unique number of the installation
* @returns {Promise<object[]>} Data from the installation
* @returns {Promise<object[]>} Information about specified installation
*/
idData(id: number): Promise<string>;
installationInfo(id: number): Promise<string>;
/**
* @param {number} id Installation ID - Unique number of the installation
* @returns {Promise<object[]>} Info about installation
* @returns {Promise<object[]>} Detailed measurements (current, historical and future) for an installation
*/
idInfo(id: number): Promise<string>;
installationMeasurements(id: number): Promise<string>;
/**

@@ -32,20 +40,20 @@ * @param {number} lat Latitude - Geographical coordinate

* @param {number} [maxDistanceKM=3] All the returned installations must be located within this limit from the given point (in km); negative value means no limit
* @param {number} [maxResults=-1] Maximum number of installations to return; negative value means no limit
* @returns {Promise<object[]>} Info about 3 nearest installations
* @returns {Promise<object[]>} Detailed measurements (current, historical and future) from the installation which is closest to a given point
*/
nearestInstallations(lat: number, lng: number, maxDistanceKM?: number, maxResults?: number): Promise<string>;
nearestMeasurements(lat: number, lng: number, maxDistanceKM?: number): Promise<string>;
/**
* @param {number} lat Latitude - Geographical coordinate
* @param {number} lng Longitude - Geographical coordinate
* @param {number} [maxDistanceKM=3] All the returned installations must be located within this limit from the given point (in km); negative value means no limit
* @returns {Promise<object[]>} Measurements for an installation closest to a given location.
* @returns {Promise<object[]>} Detailed measurements (current, historical and future) for a map point, which can be interpolated from nearby installations
*/
nearestIdMeasurements(lat: number, lng: number, maxDistanceKM?: number): Promise<string>;
pointMeasurements(lat: number, lng: number): Promise<string>;
/**
* @param {number} lat Latitude - Geographical coordinate
* @param {number} lng Longitude - Geographical coordinate
* @returns {Promise<object[]>} Measurements for any geographical location. Measurement values are interpolated by averaging measurements from nearby sensors (up to 1,5km away from the given point).
* @returns {Promise<object[]>} List of IndexTypes supported by the platform
*/
nearestAverageMeasurements(lat: number, lng: number): Promise<string>;
metaIndexes(): Promise<string>;
/**
* @returns {Promise<object[]>} List of MeasurementTypes supported by the platform
*/
metaMeasurements(): Promise<string>;
}
export default Airly;

@@ -52,6 +52,11 @@ 'use strict';

/**
* @param {number} id Installation ID - Unique number of the installation
* @returns {Promise<object[]>} Data from the installation
* @param {number} lat Latitude - Geographical coordinate
* @param {number} lng Longitude - Geographical coordinate
* @param {number} [maxDistanceKM=3] All the returned installations must be located within this limit from the given point (in km); negative value means no limit
* @param {number} [maxResults=-1] Maximum number of installations to return; negative value means no limit
* @returns {Promise<object[]>} List of installations given by location point, ordered by distance to that point
*/
Airly.prototype.idData = function (id) {
Airly.prototype.nearestInstallations = function (lat, lng, maxDistanceKM, maxResults) {
if (maxDistanceKM === void 0) { maxDistanceKM = 3; }
if (maxResults === void 0) { maxResults = -1; }
return __awaiter(this, void 0, void 0, function () {

@@ -61,3 +66,3 @@ var response;

switch (_a.label) {
case 0: return [4 /*yield*/, fetch(this.baseUrl + "/measurements/installation?installationId=" + id, this.config).then(function (res) { return res.json(); })];
case 0: return [4 /*yield*/, fetch(this.baseUrl + "/installations/nearest?lat=" + lat + "&lng=" + lng + "&maxDistanceKM=" + maxDistanceKM + "&maxResults=" + maxResults, this.config).then(function (res) { return res.json(); })];
case 1:

@@ -72,5 +77,5 @@ response = _a.sent();

* @param {number} id Installation ID - Unique number of the installation
* @returns {Promise<object[]>} Info about installation
* @returns {Promise<object[]>} Information about specified installation
*/
Airly.prototype.idInfo = function (id) {
Airly.prototype.installationInfo = function (id) {
return __awaiter(this, void 0, void 0, function () {

@@ -89,11 +94,6 @@ var response;

/**
* @param {number} lat Latitude - Geographical coordinate
* @param {number} lng Longitude - Geographical coordinate
* @param {number} [maxDistanceKM=3] All the returned installations must be located within this limit from the given point (in km); negative value means no limit
* @param {number} [maxResults=-1] Maximum number of installations to return; negative value means no limit
* @returns {Promise<object[]>} Info about 3 nearest installations
* @param {number} id Installation ID - Unique number of the installation
* @returns {Promise<object[]>} Detailed measurements (current, historical and future) for an installation
*/
Airly.prototype.nearestInstallations = function (lat, lng, maxDistanceKM, maxResults) {
if (maxDistanceKM === void 0) { maxDistanceKM = 3; }
if (maxResults === void 0) { maxResults = -1; }
Airly.prototype.installationMeasurements = function (id) {
return __awaiter(this, void 0, void 0, function () {

@@ -103,3 +103,3 @@ var response;

switch (_a.label) {
case 0: return [4 /*yield*/, fetch(this.baseUrl + "/installations/nearest?lat=" + lat + "&lng=" + lng + "&maxDistanceKM=" + maxDistanceKM + "&maxResults=" + maxResults, this.config).then(function (res) { return res.json(); })];
case 0: return [4 /*yield*/, fetch(this.baseUrl + "/measurements/installation?installationId=" + id, this.config).then(function (res) { return res.json(); })];
case 1:

@@ -116,5 +116,5 @@ response = _a.sent();

* @param {number} [maxDistanceKM=3] All the returned installations must be located within this limit from the given point (in km); negative value means no limit
* @returns {Promise<object[]>} Measurements for an installation closest to a given location.
* @returns {Promise<object[]>} Detailed measurements (current, historical and future) from the installation which is closest to a given point
*/
Airly.prototype.nearestIdMeasurements = function (lat, lng, maxDistanceKM) {
Airly.prototype.nearestMeasurements = function (lat, lng, maxDistanceKM) {
if (maxDistanceKM === void 0) { maxDistanceKM = 3; }

@@ -136,5 +136,5 @@ return __awaiter(this, void 0, void 0, function () {

* @param {number} lng Longitude - Geographical coordinate
* @returns {Promise<object[]>} Measurements for any geographical location. Measurement values are interpolated by averaging measurements from nearby sensors (up to 1,5km away from the given point).
* @returns {Promise<object[]>} Detailed measurements (current, historical and future) for a map point, which can be interpolated from nearby installations
*/
Airly.prototype.nearestAverageMeasurements = function (lat, lng) {
Airly.prototype.pointMeasurements = function (lat, lng) {
return __awaiter(this, void 0, void 0, function () {

@@ -152,4 +152,36 @@ var response;

};
/**
* @returns {Promise<object[]>} List of IndexTypes supported by the platform
*/
Airly.prototype.metaIndexes = function () {
return __awaiter(this, void 0, void 0, function () {
var response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, fetch(this.baseUrl + "/meta/indexes", this.config).then(function (res) { return res.json(); })];
case 1:
response = _a.sent();
return [2 /*return*/, response];
}
});
});
};
/**
* @returns {Promise<object[]>} List of MeasurementTypes supported by the platform
*/
Airly.prototype.metaMeasurements = function () {
return __awaiter(this, void 0, void 0, function () {
var response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, fetch(this.baseUrl + "/meta/measurements", this.config).then(function (res) { return res.json(); })];
case 1:
response = _a.sent();
return [2 /*return*/, response];
}
});
});
};
return Airly;
}());
export default Airly;

@@ -56,6 +56,11 @@ 'use strict';

/**
* @param {number} id Installation ID - Unique number of the installation
* @returns {Promise<object[]>} Data from the installation
* @param {number} lat Latitude - Geographical coordinate
* @param {number} lng Longitude - Geographical coordinate
* @param {number} [maxDistanceKM=3] All the returned installations must be located within this limit from the given point (in km); negative value means no limit
* @param {number} [maxResults=-1] Maximum number of installations to return; negative value means no limit
* @returns {Promise<object[]>} List of installations given by location point, ordered by distance to that point
*/
Airly.prototype.idData = function (id) {
Airly.prototype.nearestInstallations = function (lat, lng, maxDistanceKM, maxResults) {
if (maxDistanceKM === void 0) { maxDistanceKM = 3; }
if (maxResults === void 0) { maxResults = -1; }
return __awaiter(this, void 0, void 0, function () {

@@ -65,3 +70,3 @@ var response;

switch (_a.label) {
case 0: return [4 /*yield*/, node_fetch_1.default(this.baseUrl + "/measurements/installation?installationId=" + id, this.config).then(function (res) { return res.json(); })];
case 0: return [4 /*yield*/, node_fetch_1.default(this.baseUrl + "/installations/nearest?lat=" + lat + "&lng=" + lng + "&maxDistanceKM=" + maxDistanceKM + "&maxResults=" + maxResults, this.config).then(function (res) { return res.json(); })];
case 1:

@@ -76,5 +81,5 @@ response = _a.sent();

* @param {number} id Installation ID - Unique number of the installation
* @returns {Promise<object[]>} Info about installation
* @returns {Promise<object[]>} Information about specified installation
*/
Airly.prototype.idInfo = function (id) {
Airly.prototype.installationInfo = function (id) {
return __awaiter(this, void 0, void 0, function () {

@@ -93,11 +98,6 @@ var response;

/**
* @param {number} lat Latitude - Geographical coordinate
* @param {number} lng Longitude - Geographical coordinate
* @param {number} [maxDistanceKM=3] All the returned installations must be located within this limit from the given point (in km); negative value means no limit
* @param {number} [maxResults=-1] Maximum number of installations to return; negative value means no limit
* @returns {Promise<object[]>} Info about 3 nearest installations
* @param {number} id Installation ID - Unique number of the installation
* @returns {Promise<object[]>} Detailed measurements (current, historical and future) for an installation
*/
Airly.prototype.nearestInstallations = function (lat, lng, maxDistanceKM, maxResults) {
if (maxDistanceKM === void 0) { maxDistanceKM = 3; }
if (maxResults === void 0) { maxResults = -1; }
Airly.prototype.installationMeasurements = function (id) {
return __awaiter(this, void 0, void 0, function () {

@@ -107,3 +107,3 @@ var response;

switch (_a.label) {
case 0: return [4 /*yield*/, node_fetch_1.default(this.baseUrl + "/installations/nearest?lat=" + lat + "&lng=" + lng + "&maxDistanceKM=" + maxDistanceKM + "&maxResults=" + maxResults, this.config).then(function (res) { return res.json(); })];
case 0: return [4 /*yield*/, node_fetch_1.default(this.baseUrl + "/measurements/installation?installationId=" + id, this.config).then(function (res) { return res.json(); })];
case 1:

@@ -120,5 +120,5 @@ response = _a.sent();

* @param {number} [maxDistanceKM=3] All the returned installations must be located within this limit from the given point (in km); negative value means no limit
* @returns {Promise<object[]>} Measurements for an installation closest to a given location.
* @returns {Promise<object[]>} Detailed measurements (current, historical and future) from the installation which is closest to a given point
*/
Airly.prototype.nearestIdMeasurements = function (lat, lng, maxDistanceKM) {
Airly.prototype.nearestMeasurements = function (lat, lng, maxDistanceKM) {
if (maxDistanceKM === void 0) { maxDistanceKM = 3; }

@@ -140,5 +140,5 @@ return __awaiter(this, void 0, void 0, function () {

* @param {number} lng Longitude - Geographical coordinate
* @returns {Promise<object[]>} Measurements for any geographical location. Measurement values are interpolated by averaging measurements from nearby sensors (up to 1,5km away from the given point).
* @returns {Promise<object[]>} Detailed measurements (current, historical and future) for a map point, which can be interpolated from nearby installations
*/
Airly.prototype.nearestAverageMeasurements = function (lat, lng) {
Airly.prototype.pointMeasurements = function (lat, lng) {
return __awaiter(this, void 0, void 0, function () {

@@ -156,4 +156,36 @@ var response;

};
/**
* @returns {Promise<object[]>} List of IndexTypes supported by the platform
*/
Airly.prototype.metaIndexes = function () {
return __awaiter(this, void 0, void 0, function () {
var response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, node_fetch_1.default(this.baseUrl + "/meta/indexes", this.config).then(function (res) { return res.json(); })];
case 1:
response = _a.sent();
return [2 /*return*/, response];
}
});
});
};
/**
* @returns {Promise<object[]>} List of MeasurementTypes supported by the platform
*/
Airly.prototype.metaMeasurements = function () {
return __awaiter(this, void 0, void 0, function () {
var response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, node_fetch_1.default(this.baseUrl + "/meta/measurements", this.config).then(function (res) { return res.json(); })];
case 1:
response = _a.sent();
return [2 /*return*/, response];
}
});
});
};
return Airly;
}());
exports.default = Airly;
{
"name": "airly",
"version": "2.0.1",
"version": "3.0.0",
"description": "Simple wrapper for Airly API, works in Node.js & the browser.",

@@ -56,4 +56,4 @@ "main": "dist/index.js",

"@types/node-fetch": "^2.5.2",
"@typescript-eslint/eslint-plugin": "^2.4.0",
"@typescript-eslint/parser": "^2.4.0",
"@typescript-eslint/eslint-plugin": "^2.6.0",
"@typescript-eslint/parser": "^2.6.0",
"cpy-cli": "^2.0.0",

@@ -60,0 +60,0 @@ "del-cli": "^3.0.0",

@@ -13,8 +13,8 @@ # Airly :cloud:

* Simple API
* Simple, asynchronous API
* Works in Node.js & the browser
* Uses the 2.0 version of Airly API
* Full API coverage
* Actively maintained
* Lightweight
* Single source file (containing ~120 lines of code)
* Written in TypeScript

@@ -42,3 +42,3 @@

try {
const data = await airly.idInfo(240);
const data = await airly.installationInfo(240);
console.log(data);

@@ -76,5 +76,5 @@ } catch (error) {

### airly.idData(id)
### airly.installationMeasurements(id)
> Returns pollution data from the specified installation
> Returns detailed measurements (current, historical and future) for an installation

@@ -87,5 +87,5 @@ **id**

### airly.idInfo(id)
### airly.installationInfo(id)
> Returns information about the specified installation
> Returns information about specified installation

@@ -100,3 +100,3 @@ **id**

> Returns information about 3 nearest installations (including their ID's)
> Returns information about the nearest installations (including their ID's)

@@ -113,2 +113,4 @@ **lat**

Longitude
**maxDistanceKM**

@@ -130,5 +132,5 @@

### airly.nearestIdMeasurements(lat, lng, maxDistanceKM)
### airly.nearestMeasurements(lat, lng, maxDistanceKM)
> Returns measurements for an installation closest to a given location.
> Returns detailed measurements (current, historical and future) from the installation which is closest to a given point

@@ -155,5 +157,5 @@ **lat**

### airly.nearestAverageMeasurements(lat, lng)
### airly.pointMeasurements(lat, lng)
> Returns measurements for any geographical location. Measurement values are interpolated by averaging measurements from nearby sensors (up to 1,5km away from the given point)
> Returns detailed measurements (current, historical and future) for a map point, which can be interpolated from nearby installations

@@ -172,4 +174,12 @@ **lat**

### 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)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc