inpe-weather-api
Advanced tools
Comparing version 1.0.0 to 1.0.2
@@ -0,0 +0,0 @@ # Changelog |
module.exports = require('./lib/index.js') | ||
exports.default = module.exports |
@@ -0,0 +0,0 @@ const Path = require('path') |
@@ -0,0 +0,0 @@ const RequestHandler = require('./RequestHandler') |
@@ -0,0 +0,0 @@ const RequestHandler = require('./RequestHandler') |
@@ -0,0 +0,0 @@ const RequestHandler = require('./RequestHandler') |
@@ -0,0 +0,0 @@ const axios = require('axios') |
const FrontHandler = require('./handlers/FrontHandler.js') | ||
module.exports = { | ||
getCities: cityOrPrefix => FrontHandler.getHandler('getCities')(cityOrPrefix), | ||
getAirportStatus: airportCode => FrontHandler.getHandler('getAirportStatus')(airportCode), | ||
getCapitalsForecast: () => FrontHandler.getHandler('getCapitalsForecast')() | ||
getCities: FrontHandler.getHandler('getCities'), | ||
getAirportStatus: FrontHandler.getHandler('getAirportStatus'), | ||
getCapitalsForecast: FrontHandler.getHandler('getCapitalsForecast'), | ||
getForecast: FrontHandler.getHandler('getForecast'), | ||
getUVIncidence: FrontHandler.getHandler('getUVIncidence'), | ||
getWavesForecast: FrontHandler.getHandler('getWavesForecast') | ||
} |
{ | ||
"name": "inpe-weather-api", | ||
"version": "1.0.0", | ||
"version": "1.0.2", | ||
"description": "NodeJS interface to INPE Weather Forecast API", | ||
"main": "index.js", | ||
"author": "Luiz Fernando", | ||
"email": "lfernando-silva@hotmail.com", | ||
"scripts": { | ||
@@ -8,0 +9,0 @@ "start": "node index.js", |
100
README.md
# INPE Weather API | ||
# v.1.0.0 | ||
# v.1.0.2 | ||
@@ -38,3 +38,3 @@ A unofficial NodeJS interface to brazillian [INPE's](http://servicos.cptec.inpe.br/XML/) Weather Forecast Webservice. | ||
getCities(cityOrPrefix) | ||
getCities(cityOrPrefix*) | ||
@@ -48,3 +48,3 @@ * Params: (STRING) The city code, name or prefix. | ||
getAirportStatus(airportCode) | ||
getAirportStatus(airportCode*) | ||
* Params: (STRING) The [airport code ("sigla")](http://servicos.cptec.inpe.br/XML/#estacoes-metar) REQUIRED | ||
@@ -72,5 +72,99 @@ * Returns: JSON Object | ||
getForecast(cityCode*,nextSevenDays,isLatLongPrev, isExtended) | ||
* Params: (STRING) The city code or slash separated lat,long, (BOOLEAN) true to next seven days, default false, | ||
(BOOLEAN) true if use lat/long instead city code, (BOOLEAN) true if is a extended forecast. | ||
* Returns: JSON Object containing an array 'previsao' with the seven or four forecasts. | ||
* Lat/Long only works to a seven days forecast. | ||
* Extended query with lat/long is documented, but throws error as the web service response. | ||
```javascript | ||
//City code | ||
return getForecast('244',true) | ||
.then(response => /*...*/) | ||
//With lat,long | ||
return getForecast('-22.90/-47.06',true,true) | ||
.then(response => /*...*/) | ||
``` | ||
```json | ||
{ | ||
"nome": "São Paulo", | ||
"uf": "SP", | ||
"atualizacao": "2018-04-14", | ||
"previsao": [ | ||
{ | ||
"dia": "2018-04-14", | ||
"tempo": "pt", | ||
"maxima": "26", | ||
"minima": "18", | ||
"iuv": "9.0" | ||
}, | ||
{ | ||
"dia": "2018-04-15", | ||
"tempo": "ci", | ||
"maxima": "21", | ||
"minima": "17", | ||
"iuv": "9.0" | ||
}, | ||
{ | ||
"dia": "2018-04-16", | ||
"tempo": "ci", | ||
"maxima": "22", | ||
"minima": "17", | ||
"iuv": "10.0" | ||
}, | ||
{ | ||
"dia": "2018-04-17", | ||
"tempo": "n", | ||
"maxima": "24", | ||
"minima": "16", | ||
"iuv": "10.0" | ||
}, | ||
{ | ||
"dia": "2018-04-18", | ||
"tempo": "pn", | ||
"maxima": "25", | ||
"minima": "15", | ||
"iuv": "9.0" | ||
}, | ||
{ | ||
"dia": "2018-04-19", | ||
"tempo": "pn", | ||
"maxima": "26", | ||
"minima": "16", | ||
"iuv": "9.0" | ||
}, | ||
{ | ||
"dia": "2018-04-20", | ||
"tempo": "vn", | ||
"maxima": "26", | ||
"minima": "16", | ||
"iuv": "9.0" | ||
} | ||
] | ||
} | ||
``` | ||
getUVIncidence(cityCode*) | ||
* Params: (STRING) The city code | ||
* Returns a object containing the ultraviolet waves incidence to a city code. | ||
```json | ||
{ | ||
"nome": "São Paulo", | ||
"uf": "SP", | ||
"data": "14/04/2018", | ||
"hora": "12h45", | ||
"iuv": "4" | ||
} | ||
``` | ||
getWavesForecast(cityCode*, day) | ||
* Params: (STRING) The city code, (STRING) The day code | ||
* Day code: 0 = today, 1 = tomorrow, 2 = after tomorrow | ||
## About language | ||
* As the API cames from a brazilian governamental service, the default language of response is the brazilian portuguese. However, the code language is english, as the most known libraries. | ||
* The INPE's API documentation also is in brazilian portuguese. |
@@ -0,0 +0,0 @@ const chai = require('chai') |
@@ -0,0 +0,0 @@ const chai = require('chai') |
@@ -0,0 +0,0 @@ const chai = require('chai') |
15411
19
238
167