@robinpath/weather
0.1.1Node.jsPublicWeather module for RobinPath.
Weather
Weather module for RobinPath.
Package: @robinpath/weather | Category: Other | Type: Utility
Authentication
weather.setCredentials "your-credentials"
Call this once at the start of your script before using any other function. Credentials persist for the duration of the script execution.
Use Cases
Use the weather module when you need to:
- getCurrentWeather -- Use
weather.getCurrentWeatherto perform this operation - getForecast -- Use
weather.getForecastto perform this operation - get5DayForecast -- Use
weather.get5DayForecastto perform this operation - getHourlyForecast -- Use
weather.getHourlyForecastto perform this operation - getAirQuality -- Use
weather.getAirQualityto perform this operation
Quick Reference
| Function | Description | Returns |
|---|---|---|
setCredentials | Configure weather credentials. | object |
getCurrentWeather | getCurrentWeather | object |
getForecast | getForecast | object |
get5DayForecast | get5DayForecast | object |
getHourlyForecast | getHourlyForecast | object |
getAirQuality | getAirQuality | object |
getUVIndex | getUVIndex | object |
getWeatherByZip | getWeatherByZip | object |
getHistoricalWeather | getHistoricalWeather | object |
getWeatherAlerts | getWeatherAlerts | object |
geocodeCity | geocodeCity | object |
reverseGeocode | reverseGeocode | object |
getWeatherMap | getWeatherMap | object |
Functions
setCredentials
Configure weather credentials.
Module: weather | Returns: object -- API response.
weather.setCredentials
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | apiKey |
getCurrentWeather
getCurrentWeather
Module: weather | Returns: object -- API response.
weather.getCurrentWeather
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getForecast
getForecast
Module: weather | Returns: object -- API response.
weather.getForecast
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
get5DayForecast
get5DayForecast
Module: weather | Returns: object -- API response.
weather.get5DayForecast
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getHourlyForecast
getHourlyForecast
Module: weather | Returns: object -- API response.
weather.getHourlyForecast
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getAirQuality
getAirQuality
Module: weather | Returns: object -- API response.
weather.getAirQuality
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getUVIndex
getUVIndex
Module: weather | Returns: object -- API response.
weather.getUVIndex
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getWeatherByZip
getWeatherByZip
Module: weather | Returns: object -- API response.
weather.getWeatherByZip
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getHistoricalWeather
getHistoricalWeather
Module: weather | Returns: object -- API response.
weather.getHistoricalWeather
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getWeatherAlerts
getWeatherAlerts
Module: weather | Returns: object -- API response.
weather.getWeatherAlerts
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
geocodeCity
geocodeCity
Module: weather | Returns: object -- API response.
weather.geocodeCity
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
reverseGeocode
reverseGeocode
Module: weather | Returns: object -- API response.
weather.reverseGeocode
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getWeatherMap
getWeatherMap
Module: weather | Returns: object -- API response.
weather.getWeatherMap
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
Error Handling
All functions throw on failure. Common errors:
| Error | Cause |
|---|---|
Weather API error (${res.status}): ${t} | Check the error message for details |
weather.setCredentials requires apiKey. | Check the error message for details |
Weather: "..." not configured. Call weather.setCredentials first. | Check the error message for details |
@desc "Get current weather and validate result"
do
set $result as weather.getCurrentWeather
if $result != null
print "Success"
else
print "No result"
end
enddo
Recipes
1. List and iterate CurrentWeather
Retrieve all items and loop through them.
@desc "Setup authentication"
do
weather.setCredentials $token
enddo
@desc "Get current weather and iterate results"
do
set $result as weather.getCurrentWeather
each $item in $result
print $item
end
enddo
2. Multi-step Weather workflow
Chain multiple weather operations together.
@desc "Setup authentication"
do
weather.setCredentials $token
enddo
@desc "Get current weather, get forecast, and more"
do
set $r_getCurrentWeather as weather.getCurrentWeather
set $r_getForecast as weather.getForecast
set $r_get5DayForecast as weather.get5DayForecast
print "All operations complete"
enddo
3. Safe getCurrentWeather with validation
Check results before proceeding.
@desc "Setup authentication"
do
weather.setCredentials $token
enddo
@desc "Get current weather and validate result"
do
set $result as weather.getCurrentWeather
if $result != null
print "Success: " + $result
else
print "Operation returned no data"
end
enddo
Related Modules
- json -- JSON module for complementary functionality
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.1 | latest | 1 months ago |
Related Modules
@robinpathv0.1.4
SMTP email sending and address parsing for RobinPath
hash
JS@robinpathv0.1.3
Cryptographic hashing utilities: MD5, SHA family, HMAC, CRC32, file hashing, UUID v5 generation, secure random bytes, and content fingerprinting
csv
JS@robinpathv0.1.2
Parse and stringify CSV data
apollo
JS@robinpathv0.1.2
Apollo module for RobinPath.
$ robinpath add @robinpath/weather
