Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Latest commit

 

History

History
440 lines (302 loc) · 17.9 KB

api.md

File metadata and controls

440 lines (302 loc) · 17.9 KB

Modules

OpenWeatherMap/api

The OpenWeatherMap/api module acts as an abstraction layer for accessing the various OpenWeatherMap APIs.

Typedefs

CityIDReqParams : Object

an object of parameters used to identify a location using a citys ID

CityNameReqParams : Object

an object of parameters used to identify a location using a citys name

LatLonReqParams : Object

an object of parameters used to identify a location using a citys name

ZipReqParams : Object

an object of parameters used to identify a location using a citys name

Coordinate : Object

a coordinate object containing a longitute and latitude for positioning

PartialDate : Object

an object containign partial date time data

PollutionParams : Object

an object of parameters used in the pollution apis

OpenWeatherMap/api

The OpenWeatherMap/api module acts as an abstraction layer for accessing the various OpenWeatherMap APIs.

See: https://openweathermap.org/api


OpenWeatherMap/api.OpenWeatherMap

Kind: static class of OpenWeatherMap/api


new OpenWeatherMap(options)

contains the core functionality between all of the APIs such as request functions and key storage. This class is intended to be extended or have mixins applied to add the functionality of the different APIs

Param Type Default Description
options Object
options.apiKey String the APPID supplied by openweathermap.org
[options.language] String an optional 2 letter language code e.g. 'en'
[options.host] String api.openweathermap.org an optional hostname for the api to connect to.
[options.port] String | Number 80 an optional port to use for the api

OpenWeatherMap/api.AirPollution ⇐ OpenWeatherMap

Kind: static class of OpenWeatherMap/api
Extends: OpenWeatherMap
See: https://openweathermap.org/


new AirPollution()

A collection of air pollution APIs provided by openweathermap.org. Additional constructor options can be found in the [GET] OpenWeatherMap class


AirPollution~carbonMonoxide(params) ⇒ Promise

gets the carbon monoxide polution levels at a location and datetime [GET]

Kind: inner method of AirPollution
Returns: Promise - the http request promise which will resolve with the carbon monoxide data or reject with an error
Access: public
See: https://openweathermap.org/api/pollution/co

Param Type
params PollutionParams

AirPollution~ozone(params) ⇒ Promise

gets the current ozone thickness at a location and datetime [GET]

Kind: inner method of AirPollution
Returns: Promise - the http request promise which will resolve with the carbon monoxide data or reject with an error
Access: public
See: https://openweathermap.org/api/pollution/o3

Param Type
params PollutionParams

AirPollution~sulfurDioxide(params) ⇒ Promise

gets the current sulfur dioxide polution at a location and datetime [GET]

Kind: inner method of AirPollution
Returns: Promise - the http request promise which will resolve with the sulfur dioxide data or reject with an error
Access: public
See: https://openweathermap.org/api/pollution/so2

Param Type
params PollutionParams

AirPollution~nitrogenDioxide(params) ⇒ Promise

gets the current nitrogen dioxide polution at a location and datetime [GET]

Kind: inner method of AirPollution
Returns: Promise - the http request promise which will resolve with the nitrogen dioxide data or reject with an error
Access: public
See: https://openweathermap.org/api/pollution/no2

Param Type
params PollutionParams

OpenWeatherMap/api.UVIndex ⇐ OpenWeatherMap

Kind: static class of OpenWeatherMap/api
Extends: OpenWeatherMap
See: https://openweathermap.org/


new UVIndex()

A collection of UV Index APIs provided by openweathermap.org. Additional constructor options can be found in the [GET] OpenWeatherMap class


UVIndex~UVIndex(params) ⇒ Promise

gets the current UV Index at a location at the current time [GET]

Kind: inner method of UVIndex
Returns: Promise - the http request promise which will resolve with the current weather or reject with an error
Access: public
See: https://openweathermap.org/current

Param Type
params CityIDReqParams | CityNameReqParams | LatLonReqParams | ZipReqParams

OpenWeatherMap/api.Weather ⇐ OpenWeatherMap

Kind: static class of OpenWeatherMap/api
Extends: OpenWeatherMap
See: https://openweathermap.org/


new Weather(options)

A collection of Weather APIs provided by openweathermap.org. Additional constructor options can be found in the OpenWeatherMap class

Param Type Description
options Object
[options.units] String default uses kelvin, can also specify 'metric' for centegrade and 'imprerial' for Fahrenheit.

Weather~now(params) ⇒ Promise

gets the current weather at a location at the current time [GET]

Kind: inner method of Weather
Returns: Promise - the http request promise which will resolve with the current weather or reject with an error
Access: public
See: https://openweathermap.org/current

Param Type
params CityIDReqParams | CityNameReqParams | LatLonReqParams | ZipReqParams

Weather~forecast(params) ⇒ Promise

gets a forecast for the next 5 days in 3 hour intervals [GET]

Kind: inner method of Weather
Returns: Promise - the http request promise which will resolve with the 5 day forecast weather or reject with an error
Access: public
See: https://openweathermap.org/forecast5

Param Type
params CityIDReqParams | CityNameReqParams | LatLonReqParams | ZipReqParams

Weather~dailyForecast(params) ⇒ Promise

gets a daily forecast for up to 16 days in the future (paid accounts only) [GET]

Kind: inner method of Weather
Returns: Promise - the http request promise which will resolve with the 16 day forecast weather or reject with an error
Access: public
See: https://openweathermap.org/forecast16

Param Type
params CityIDReqParams | CityNameReqParams | LatLonReqParams | ZipReqParams

CityIDReqParams : Object

an object of parameters used to identify a location using a citys ID

Kind: global typedef
Properties

Name Type Description
id String | Number the city ID to be used in the query
days String | Number optional number of days to return in the forecast (used in dailyForecast alias for cnt)
hours String | Number optional number of hours to return in the forecast (used in forecast alias for cnt)

CityNameReqParams : Object

an object of parameters used to identify a location using a citys name

Kind: global typedef
Properties

Name Type Description
city String the city name to use in the query e.g. 'london' (best used with country also set)
country String optional 2 letter country code to use in the query e.g. 'en'
days String | Number optional number of days to return in the forecast (used in dailyForecast alias for cnt)
hours String | Number optional number of hours to return in the forecast (used in forecast alias for cnt)

LatLonReqParams : Object

an object of parameters used to identify a location using a citys name

Kind: global typedef
Properties

Name Type Description
coordinates Coordinate a coordinate object used for searching based on latlon (use on its own)
days String | Number optional number of days to return in the forecast (used in dailyForecast alias for cnt)
hours String | Number optional number of hours to return in the forecast (used in forecast alias for cnt)

ZipReqParams : Object

an object of parameters used to identify a location using a citys name

Kind: global typedef
Properties

Name Type Description
zip String | Number the zip code to use within the query (US by default unless country is specified)
postcode String | Number an alias to zip (use either zip or postcode)
country String optional 2 letter country code to use in the query e.g. 'en'
days String | Number optional number of days to return in the forecast (used in dailyForecast alias for cnt)
hours String | Number optional number of hours to return in the forecast (used in forecast alias for cnt)

Coordinate : Object

a coordinate object containing a longitute and latitude for positioning

Kind: global typedef
Properties

Name Type Description
latitude String | Number the latitude of the position
longitude String | Number the longitude of the position

PartialDate : Object

an object containign partial date time data

Kind: global typedef
Properties

Name Type
hour String | Number
month String | Number
day String | Number
hour String | Number
minute String | Number
second String | Number

PollutionParams : Object

an object of parameters used in the pollution apis

Kind: global typedef
Properties

Name Type Description
coordinates Coordinate the position to check for poillutants
datetime Moment | Date | PartialDate | String accepts a Moment object, a native Date object, a custom PartialDate object which allows for date ranges to be defined (as per the documentation), or a manualy formatted ISO TZ time string (would recomend the other options though)