@windy/fetch
Basic HTTP requests for getting URLs of our backend services or fetching data from Windy API. Although it works as wrapper around our http module, it ensures standardized way of fetching data.
Table of contents
Interfaces
Functions
- getArticle
- getCapAlertsSummary
- getDetailPointForecastData
- getElevation
- getHurricanesCount
- getHurricanesList
- getLatestJson
- getLiveAlerts
- getMeteogramForecastData
- getNowPointForecastUrl
- getObservationPoiUrl
- getPointForecastData
- getPointForecastFragmentData
- getPromo
- getRadarArchiveInfo
- getRadarCoverage
- getRadarInfo
- getRadarSatImageUrl
- getReftimeIso
- getSatelliteArchiveRangeInfo
- getSatelliteCompositeInfo
- getStaticMapImageUrl
- getTimezoneInfo
- loadForecastArchive
Functions
getArticle
▸ getArticle(latLon): Promise<HttpPayload<ArticleStartupData>>
Parameters
| Name | Type |
|---|---|
latLon | LatLon |
Returns
Promise<HttpPayload<ArticleStartupData>>
getCapAlertsSummary
▸ getCapAlertsSummary(«destructured», source?): Promise<HttpPayload<CapAlertHeadline[]>>
Returns loading promise for cap alert headlines
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | LatLon | undefined |
source | "detail" | "hp" | 'hp' |
Returns
Promise<HttpPayload<CapAlertHeadline[]>>
getDetailPointForecastData
▸ getDetailPointForecastData(options): Promise<HttpPayload<WeatherDataPayload2<AllPossibleDataHashes2>>>
Gets point forecast data specifically for the detail plugin. Encapsulates the includes and days logic so it doesn't have to be duplicated in beforeLoad (preload) and MainTable (render).
Parameters
| Name | Type |
|---|---|
options | DetailPointForecastOptions |
Returns
Promise<HttpPayload<WeatherDataPayload2<AllPossibleDataHashes2>>>
getElevation
▸ getElevation(lat, lon, httpOptions?): Promise<HttpPayload<number>>
Loads elevation (AMSL meters) for given coordinates
Parameters
| Name | Type |
|---|---|
lat | number |
lon | number |
httpOptions? | HttpOptions |
Returns
Promise<HttpPayload<number>>
getHurricanesCount
▸ getHurricanesCount(): Promise<HttpPayload<ActiveStormCountPayload>>
Returns
Promise<HttpPayload<ActiveStormCountPayload>>
getHurricanesList
▸ getHurricanesList(): Promise<HttpPayload<StormListJSON>>
Returns
Promise<HttpPayload<StormListJSON>>
getLatestJson
▸ getLatestJson(): Promise<HttpPayload<NativeAppsReleaseInfo>>
Returns
Promise<HttpPayload<NativeAppsReleaseInfo>>
getLiveAlerts
▸ getLiveAlerts(«destructured»): Promise<HttpPayload<{ alerts: LiveAlertEvent[] }>>
Returns active live alert for given location (if any)
Parameters
| Name | Type |
|---|---|
«destructured» | LatLon |
Returns
Promise<HttpPayload<{ alerts: LiveAlertEvent[] }>>
getMeteogramForecastData
▸ getMeteogramForecastData(model, «destructured», pointForecastOptions?, httpOptions?): Promise<HttpPayload<any>>
Parameters
| Name | Type |
|---|---|
model | "drought" | "radar" | "satellite" | "capAlerts" | "avalancheDanger" | "topoMap" | "mblue" | "gfs" | "ecmwf" | "ecmwfAnalysis" | "ecmwfWaves" | "gfsWaves" | "icon" | "cams" | "efi" | "cmems" | "fireDanger" | "activeFires" | "nems" | "namConus" | "namHawaii" | "namAlaska" | "iconEu" | "iconD2" | "arome" | "aromeAntilles" | "aromeFrance" | "aromeReunion" | "canHrdps" | "canRdwpsWaves" | "camsEu" | "czeAladin" | "iconEuWaves" | "hrrrAlaska" | "hrrrConus" | "bomAccess" | "bomAccessAd" | "bomAccessBn" | "bomAccessDn" | "bomAccessNq" | "bomAccessPh" | "bomAccessSy" | "bomAccessVt" | "ukv" | "jmaMsm" | "jmaCwmWaves" |
«destructured» | LatLon & { step?: number } |
pointForecastOptions? | Record<string, string> |
httpOptions? | HttpOptions |
Returns
Promise<HttpPayload<any>>
Deprecated
Legacy forecast/meteogram v1.2 endpoint, superseded by the v3 meteogram include. Left untyped since nothing in this codebase consumes the response anymore.
Used in external plugin (Contrail Finder), remove after the plugin is migrated to v3 meteogram.
getNowPointForecastUrl
▸ getNowPointForecastUrl(model, «destructured»): Promise<string>
Gets point forecast for NOWcast data for given location
Parameters
| Name | Type | Description |
|---|---|---|
model | "mblue" | "gfs" | "ecmwf" | "ecmwfWaves" | "gfsWaves" | "icon" | "cams" | "namConus" | "namHawaii" | "namAlaska" | "iconEu" | "iconD2" | "arome" | "aromeAntilles" | "aromeFrance" | "aromeReunion" | "canHrdps" | "canRdwpsWaves" | "camsEu" | "czeAladin" | "iconEuWaves" | "hrrrAlaska" | "hrrrConus" | "bomAccess" | "bomAccessAd" | "bomAccessBn" | "bomAccessDn" | "bomAccessNq" | "bomAccessPh" | "bomAccessSy" | "bomAccessVt" | "ukv" | "jmaMsm" | "jmaCwmWaves" | Forecast model |
«destructured» | LatLon | - |
Returns
Promise<string>
Promise with HTTP payload
Deprecated
getObservationPoiUrl
▸ getObservationPoiUrl(type, id): string
Get URL for getting observations for a specific station in node-poi server
Parameters
| Name | Type |
|---|---|
type | "stations" | "metars" | StationOrPoiType |
id | string |
Returns
string
getPointForecastData
▸ getPointForecastData<K>(model, «destructured», includeInQueryString?, httpOptions?): Promise<HttpPayload<WeatherDataPayload2<K>>>
Gets point forecast data for given location
Type parameters
| Name | Type |
|---|---|
K | extends AirQDataHash2 | DataHash2 = DataHash2 |
Parameters
| Name | Type |
|---|---|
model | "mblue" | "gfs" | "ecmwf" | "ecmwfWaves" | "gfsWaves" | "icon" | "cams" | "namConus" | "namHawaii" | "namAlaska" | "iconEu" | "iconD2" | "arome" | "aromeAntilles" | "aromeFrance" | "aromeReunion" | "canHrdps" | "canRdwpsWaves" | "camsEu" | "czeAladin" | "iconEuWaves" | "hrrrAlaska" | "hrrrConus" | "bomAccess" | "bomAccessAd" | "bomAccessBn" | "bomAccessDn" | "bomAccessNq" | "bomAccessPh" | "bomAccessSy" | "bomAccessVt" | "ukv" | "jmaMsm" | "jmaCwmWaves" |
«destructured» | PointForecastOptions |
includeInQueryString | IncludeInQueryString |
httpOptions? | HttpOptions |
Returns
Promise<HttpPayload<WeatherDataPayload2<K>>>
getPointForecastFragmentData
▸ getPointForecastFragmentData(«destructured», includeInQueryString?, model?, httpOptions?): Promise<HttpPayload<FragmentDataPayload>>
Gets point forecast data for given location
Parameters
| Name | Type |
|---|---|
«destructured» | PointForecastOptions |
includeInQueryString | IncludeInFragmentQueryString |
model | "mblue" | "gfs" | "ecmwf" | "ecmwfWaves" | "gfsWaves" | "icon" | "cams" | "namConus" | "namHawaii" | "namAlaska" | "iconEu" | "iconD2" | "arome" | "aromeAntilles" | "aromeFrance" | "aromeReunion" | "canHrdps" | "canRdwpsWaves" | "camsEu" | "czeAladin" | "iconEuWaves" | "hrrrAlaska" | "hrrrConus" | "bomAccess" | "bomAccessAd" | "bomAccessBn" | "bomAccessDn" | "bomAccessNq" | "bomAccessPh" | "bomAccessSy" | "bomAccessVt" | "ukv" | "jmaMsm" | "jmaCwmWaves" |
httpOptions? | HttpOptions |
Returns
Promise<HttpPayload<FragmentDataPayload>>
getPromo
▸ getPromo(latlon, forcedPromoId?): Promise<HttpPayload<ArticlePromoData>>
Parameters
| Name | Type |
|---|---|
latlon | LatLon |
forcedPromoId? | string |
Returns
Promise<HttpPayload<ArticlePromoData>>
getRadarArchiveInfo
▸ getRadarArchiveInfo(): Promise<HttpPayload<RadarMinifest>>
Returns
Promise<HttpPayload<RadarMinifest>>
getRadarCoverage
▸ getRadarCoverage(): Promise<HttpPayload<number[]>>
Returns
Promise<HttpPayload<number[]>>
getRadarInfo
▸ getRadarInfo(): Promise<HttpPayload<RadarMinifest>>
Loads Radar Product info
Returns
Promise<HttpPayload<RadarMinifest>>
getRadarSatImageUrl
▸ getRadarSatImageUrl(type, «destructured»): string
Returns a URL for retrieving radar/sat image
Parameters
| Name | Type |
|---|---|
type | "radar" | "satellite" |
«destructured» | LatLon & { format?: "webp" | "jpg" ; h?: number ; radarMode?: "default" | "radarplus" ; satMode?: "infra" | "infraplus" | "blue" | "visible" | "grey" | "irbt" ; w?: number } |
Returns
string
getReftimeIso
▸ getReftimeIso(model): Promise<string>
Parameters
| Name | Type |
|---|---|
model | "drought" | "radar" | "satellite" | "capAlerts" | "avalancheDanger" | "topoMap" | "mblue" | "gfs" | "ecmwf" | "ecmwfAnalysis" | "ecmwfWaves" | "gfsWaves" | "icon" | "cams" | "efi" | "cmems" | "fireDanger" | "activeFires" | "nems" | "namConus" | "namHawaii" | "namAlaska" | "iconEu" | "iconD2" | "arome" | "aromeAntilles" | "aromeFrance" | "aromeReunion" | "canHrdps" | "canRdwpsWaves" | "camsEu" | "czeAladin" | "iconEuWaves" | "hrrrAlaska" | "hrrrConus" | "bomAccess" | "bomAccessAd" | "bomAccessBn" | "bomAccessDn" | "bomAccessNq" | "bomAccessPh" | "bomAccessSy" | "bomAccessVt" | "ukv" | "jmaMsm" | "jmaCwmWaves" |
Returns
Promise<string>
getSatelliteArchiveRangeInfo
▸ getSatelliteArchiveRangeInfo(): Promise<HttpPayload<SatelliteRangeJson>>
Returns
Promise<HttpPayload<SatelliteRangeJson>>
getSatelliteCompositeInfo
▸ getSatelliteCompositeInfo(): Promise<HttpPayload<SatelliteCompositeJson>>
Returns
Promise<HttpPayload<SatelliteCompositeJson>>
getStaticMapImageUrl
▸ getStaticMapImageUrl(params): string
Returns URL for static map image. Max zoom level is 13
Parameters
| Name | Type |
|---|---|
params | LatLon & { bounds?: `${number},${number},${number},$OSM{number}` ; size: number ; zoom: 4 | 5 | 3 | 11 | 6 | 7 | 8 | 9 | 10 | 12 | 13 } |
Returns
string
getTimezoneInfo
▸ getTimezoneInfo(location, datetime): Promise<HttpPayload<TZinfo>>
Parameters
| Name | Type |
|---|---|
location | LatLon |
datetime | string |
Returns
Promise<HttpPayload<TZinfo>>
loadForecastArchive
▸ loadForecastArchive(model, selRange, latLon, source?, abortSignal?): Promise<DataHash2>
Loads forecast archive and always resolves
Parameters
| Name | Type | Default value |
|---|---|---|
model | "mblue" | "gfs" | "ecmwf" | "ecmwfWaves" | "gfsWaves" | "icon" | "cams" | "namConus" | "namHawaii" | "namAlaska" | "iconEu" | "iconD2" | "arome" | "aromeAntilles" | "aromeFrance" | "aromeReunion" | "canHrdps" | "canRdwpsWaves" | "camsEu" | "czeAladin" | "iconEuWaves" | "hrrrAlaska" | "hrrrConus" | "bomAccess" | "bomAccessAd" | "bomAccessBn" | "bomAccessDn" | "bomAccessNq" | "bomAccessPh" | "bomAccessSy" | "bomAccessVt" | "ukv" | "jmaMsm" | "jmaCwmWaves" | undefined |
selRange | number | undefined |
latLon | LatLon | undefined |
source | string | 'station' |
abortSignal? | AbortSignal | undefined |
Returns
Promise<DataHash2>