Skip to content

@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

Functions

getArticle

getArticle(latLon): Promise<HttpPayload<ArticleStartupData>>

Parameters

NameType
latLonLatLon

Returns

Promise<HttpPayload<ArticleStartupData>>


getCapAlertsSummary

getCapAlertsSummary(«destructured», source?): Promise<HttpPayload<CapAlertHeadline[]>>

Returns loading promise for cap alert headlines

Parameters

NameTypeDefault value
«destructured»LatLonundefined
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

NameType
optionsDetailPointForecastOptions

Returns

Promise<HttpPayload<WeatherDataPayload2<AllPossibleDataHashes2>>>


getElevation

getElevation(lat, lon, httpOptions?): Promise<HttpPayload<number>>

Loads elevation (AMSL meters) for given coordinates

Parameters

NameType
latnumber
lonnumber
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

NameType
«destructured»LatLon

Returns

Promise<HttpPayload<{ alerts: LiveAlertEvent[] }>>


getMeteogramForecastData

getMeteogramForecastData(model, «destructured», pointForecastOptions?, httpOptions?): Promise<HttpPayload<any>>

Parameters

NameType
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

NameTypeDescription
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

NameType
type"stations" | "metars" | StationOrPoiType
idstring

Returns

string


getPointForecastData

getPointForecastData<K>(model, «destructured», includeInQueryString?, httpOptions?): Promise<HttpPayload<WeatherDataPayload2<K>>>

Gets point forecast data for given location

Type parameters

NameType
Kextends AirQDataHash2 | DataHash2 = DataHash2

Parameters

NameType
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
includeInQueryStringIncludeInQueryString
httpOptions?HttpOptions

Returns

Promise<HttpPayload<WeatherDataPayload2<K>>>


getPointForecastFragmentData

getPointForecastFragmentData(«destructured», includeInQueryString?, model?, httpOptions?): Promise<HttpPayload<FragmentDataPayload>>

Gets point forecast data for given location

Parameters

NameType
«destructured»PointForecastOptions
includeInQueryStringIncludeInFragmentQueryString
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

NameType
latlonLatLon
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

NameType
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

NameType
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

NameType
paramsLatLon & { 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

NameType
locationLatLon
datetimestring

Returns

Promise<HttpPayload<TZinfo>>


loadForecastArchive

loadForecastArchive(model, selRange, latLon, source?, abortSignal?): Promise<DataHash2>

Loads forecast archive and always resolves

Parameters

NameTypeDefault 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
selRangenumberundefined
latLonLatLonundefined
sourcestring'station'
abortSignal?AbortSignalundefined

Returns

Promise<DataHash2>