Client for interacting with the API.
Optional request paramaters.
DarkSky developer API token.
Create a DarkSky request using method chaining.
The latitude of a location (in decimal degrees).
The longitude of a location (in decimal degrees).
Optional query params for the request.
Gets the current weather conditions, excluding all other datablocks.
Helper function for setting exclude=minutely,daily,hourly
currently
data block for the request.The latitude of a location (in decimal degrees).
The longitude of a location (in decimal degrees).
Optional query params for the request.
Current forecast conditions.
Get the forecast for day, excluding all other datablocks.
Helper function for setting exclude=currently,daily,minutely
hourly
data block for the request.The latitude of a location (in decimal degrees).
The longitude of a location (in decimal degrees).
Optional query params for the request.
Forecast for the day.
Gets the current forecast.
The latitude of a location (in decimal degrees).
The longitude of a location (in decimal degrees).
Optional query params for the request.
Current forecast.
Get the forecast for hour, excluding all other datablocks.
Helper function for setting exclude=currently,daily,hourly
Minutely
data block for the request.The latitude of a location (in decimal degrees).
The longitude of a location (in decimal degrees).
Optional query params for the request.
Forecast for the hour.
Gets the forecast for a specified date.
The latitude of a location (in decimal degrees).
The longitude of a location (in decimal degrees).
Specific time to get the weather for.
Optional query params for the request.
Forecast for the specified date.
Get the forecast for week, excluding all other datablocks.
Helper function for setting exclude=currently,minutely,hourly
daily
data block for the request.The latitude of a location (in decimal degrees).
The longitude of a location (in decimal degrees).
Optional query params for the request.
Forecast for the week.
Generated using TypeDoc
A
class
based wrapper for aDarkSkyClient
Example usage:
const darkSky = new DarkSky("api-token") const current = async () => { const result = await darkSky.currentConditions(42, -42, { units: Units.CA }) // ... Handle result }
Example chaining usage:
const darkSky = new DarkSky("api-token") const hourlyForecast = darkSky.chain(42, -42).extendHourly().onlyHourly() async function getHourlyForecast(lat: number, long: number): HourlyDataBlock { const result = await hourlyForecast.execute() if (!result.hourly) { throw Error("Hourly can still be undefined if DarkSky doesn't return it") } return result.hourly }