@curium.rocks/openweathermap-client
Advanced tools
Comparing version 0.1.1-alpha.1 to 0.1.1-alpha.2
@@ -5,2 +5,5 @@ import { CityWeather } from "./models/cityWeather"; | ||
import { MultiCityResponse } from "./responses/multiCityResponse"; | ||
export { CurrentRequest, CityWeather, CurrentWeatherApi, MultiCityResponse }; | ||
import { PollutionApi } from "./pollutionApi"; | ||
import { AirPollutionRequest } from "./requests/airPollutionRequest"; | ||
import { AirPollutionResponse } from "./responses/airPollutionResponse"; | ||
export { CurrentRequest, CityWeather, CurrentWeatherApi, MultiCityResponse, PollutionApi, AirPollutionResponse, AirPollutionRequest }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CurrentWeatherApi = void 0; | ||
exports.PollutionApi = exports.CurrentWeatherApi = void 0; | ||
var currentWeatherApi_1 = require("./currentWeatherApi"); | ||
Object.defineProperty(exports, "CurrentWeatherApi", { enumerable: true, get: function () { return currentWeatherApi_1.CurrentWeatherApi; } }); | ||
var pollutionApi_1 = require("./pollutionApi"); | ||
Object.defineProperty(exports, "PollutionApi", { enumerable: true, get: function () { return pollutionApi_1.PollutionApi; } }); | ||
//# sourceMappingURL=lib.js.map |
{ | ||
"name": "@curium.rocks/openweathermap-client", | ||
"version": "0.1.1-alpha.1", | ||
"version": "0.1.1-alpha.2", | ||
"description": "A typescript client for the openweather map APIs", | ||
@@ -5,0 +5,0 @@ "main": "build/src/lib.js", |
@@ -0,1 +1,2 @@ | ||
import {PollutionApi} from "./pollutionApi"; | ||
# openweathermap-client | ||
@@ -8,4 +9,4 @@ | ||
```typescript | ||
import 'axios'; | ||
import {CurrentWeatherApi} from '@curium.rocks/openweathermap-client'; | ||
import axios from "axios"; | ||
import {CurrentWeatherApi, PollutionApi} from '@curium.rocks/openweathermap-client'; | ||
@@ -22,6 +23,6 @@ const apiToken = process.env.OWM_TOKEN; | ||
const currentWeatherNearArea = currentApi.getCurrentWeatherNearby({ | ||
const currentWeatherNearArea = await currentApi.getCurrentWeatherNearby({ | ||
appid: apiToken, | ||
lat:29.422789, | ||
lon:-98.507065, | ||
lat: 29.422789, | ||
lon: -98.507065, | ||
cnt: 50 | ||
@@ -32,12 +33,12 @@ }); | ||
const currentWeatherInRegion = urrentApi.getCurrentWeatherForArea({ | ||
const currentWeatherInRegion = await currentApi.getCurrentWeatherForArea({ | ||
appid: apiToken, | ||
bbox: [ | ||
{ | ||
lat: 41.76106872528616, | ||
lon: -89.4561767578125, | ||
lat: 41.76106, | ||
lon: -89.45617, | ||
}, | ||
{ | ||
lat: 42.69252994883861, | ||
lon: -85.9405517578125 | ||
lat: 42.69255, | ||
lon: -85.94055 | ||
} | ||
@@ -48,2 +49,27 @@ ] | ||
console.log('The current weather data for the bounding area: ', currentWeatherInRegion); | ||
const pollutionApi = new PollutionApi(axios); | ||
const currentPollution = pollutionApi.getCurrentAirPollution({ | ||
appid: apiToken, | ||
lat: 41.76106, | ||
lon: -85.94055 | ||
}); | ||
console.log('The current pollution levels: ', currentPollution); | ||
const forecastedPollution = await pollutionApi.getForecastedAirPollution({ | ||
appid: apiToken, | ||
lat: 41.76106, | ||
lon: -85.94055 | ||
}); | ||
console.log('The forecasted air pollution levels: ', forecastedPollution); | ||
const historicalPollution = await pollutionApi({ | ||
lat: 41.76106, | ||
lon: -85.94055, | ||
start: new Date(new Date().getDate()-1), | ||
end: new Date(), | ||
appid: apiToken | ||
}); | ||
console.log('The pollution levels for the past day: ', historicalPollution); | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31319
48
584
71