From b4d891ef49d2434ea811abed682ab6c76fa83246 Mon Sep 17 00:00:00 2001 From: Jason Sanford Date: Tue, 15 Jun 2021 07:10:56 -0400 Subject: [PATCH 1/8] Start observations --- dist/client.d.ts | 4 +++- dist/client.js | 24 ++++++++++++++++++++---- dist/point_cache.d.ts | 8 ++++++++ dist/point_cache.js | 15 +++++++++++++++ dist/types.d.ts | 21 ++++++++++++++++++++- src/client.ts | 32 +++++++++++++++++++++++++++----- src/point_cache.ts | 21 +++++++++++++++++++++ src/types.ts | 26 +++++++++++++++++++++++++- 8 files changed, 139 insertions(+), 12 deletions(-) create mode 100644 dist/point_cache.d.ts create mode 100644 dist/point_cache.js create mode 100644 src/point_cache.ts diff --git a/dist/client.d.ts b/dist/client.d.ts index ff36d25..d810095 100644 --- a/dist/client.d.ts +++ b/dist/client.d.ts @@ -1,4 +1,4 @@ -import { ClientOptions, ForecastResponse, AlertsResponse, ForecastType, AlertOptions } from './types'; +import { ClientOptions, ForecastResponse, AlertsResponse, ForecastType, ObservationResponse, AlertOptions } from './types'; /** * The main client * @@ -8,6 +8,7 @@ import { ClientOptions, ForecastResponse, AlertsResponse, ForecastType, AlertOpt */ declare class Client { private options; + private pointCache; constructor(options?: ClientOptions); private getPath; private getUrl; @@ -36,5 +37,6 @@ declare class Client { * */ getForecast(latitude: number, longitude: number, forecastType: ForecastType): Promise; + getObservation(latitude: number, longitude: number): Promise; } export { Client }; diff --git a/dist/client.js b/dist/client.js index c0391cb..7c62d78 100644 --- a/dist/client.js +++ b/dist/client.js @@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); exports.Client = void 0; const cross_fetch_1 = __importDefault(require("cross-fetch")); +const point_cache_1 = __importDefault(require("./point_cache")); const defaultOptions = { userAgent: 'weathered package' }; @@ -33,6 +34,7 @@ const processOptions = (options) => { class Client { constructor(options) { this.options = { ...defaultOptions, ...options }; + this.pointCache = new point_cache_1.default(); } getPath(path) { return this.getUrl(API_ROOT + path); @@ -41,9 +43,15 @@ class Client { const resp = await cross_fetch_1.default(url); return await resp.json(); } - getPoint(latitude, longitude) { + async getPoint(latitude, longitude) { + const potentialPointResponse = this.pointCache.get(latitude, longitude); + if (potentialPointResponse) { + return potentialPointResponse; + } const path = `points/${latitude},${longitude}`; - return this.getPath(path); + const pointResponse = await this.getPath(path); + this.pointCache.set(latitude, longitude, pointResponse); + return pointResponse; } getOptions() { return { ...this.options }; @@ -77,10 +85,18 @@ class Client { * */ async getForecast(latitude, longitude, forecastType) { - const pointResp = await this.getPoint(latitude, longitude); + const pointResponse = await this.getPoint(latitude, longitude); const forecastKey = forecastType === 'hourly' ? 'forecastHourly' : 'forecast'; - const url = pointResp.properties[forecastKey]; + const url = pointResponse.properties[forecastKey]; return this.getUrl(url); } + async getObservation(latitude, longitude) { + const pointResponse = await this.getPoint(latitude, longitude); + const stationsUrl = pointResponse.properties.observationStations; + const stationsResponse = await this.getUrl(stationsUrl); + const observationsUrl = `${stationsResponse.features[0].id}/observations/latest`; + const observationResponse = await this.getUrl(observationsUrl); + return observationResponse; + } } exports.Client = Client; diff --git a/dist/point_cache.d.ts b/dist/point_cache.d.ts new file mode 100644 index 0000000..a15a753 --- /dev/null +++ b/dist/point_cache.d.ts @@ -0,0 +1,8 @@ +import { PointResponse } from './types'; +declare class PointCache { + private points; + constructor(); + get(latitude: number, longitude: number): PointResponse | undefined; + set(latitude: number, longitude: number, pointResponse: PointResponse): void; +} +export default PointCache; diff --git a/dist/point_cache.js b/dist/point_cache.js new file mode 100644 index 0000000..110cbd9 --- /dev/null +++ b/dist/point_cache.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cacheKey = (lat, lng) => `${lat},${lng}`; +class PointCache { + constructor() { + this.points = {}; + } + get(latitude, longitude) { + return this.points[cacheKey(latitude, longitude)]; + } + set(latitude, longitude, pointResponse) { + this.points[cacheKey(latitude, longitude)] = pointResponse; + } +} +exports.default = PointCache; diff --git a/dist/types.d.ts b/dist/types.d.ts index 3272a91..bf8466d 100644 --- a/dist/types.d.ts +++ b/dist/types.d.ts @@ -31,6 +31,25 @@ declare type PointResponse = { properties: { forecast: string; forecastHourly: string; + observationStations: string; + }; +}; +declare type Station = { + id: string; +}; +declare type StationsResponse = { + features: Station[]; +}; +declare type PresentWeather = { + [key: string]: string | null; +}; +declare type ObservationResponse = { + properties: { + presentWeather: PresentWeather[]; + temperature: { + value: number; + unitCode: string; + }; }; }; declare type ForecastPeriod = { @@ -81,4 +100,4 @@ declare type AlertsFeature = { declare type AlertsResponse = { features: AlertsFeature[]; }; -export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, AlertsResponse, AlertsFeature }; +export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, StationsResponse, ObservationResponse, AlertsResponse, AlertsFeature }; diff --git a/src/client.ts b/src/client.ts index 3a5dd27..216272c 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,6 +1,7 @@ import fetch from 'cross-fetch'; -import { ClientOptions, PointResponse, ForecastResponse, AlertsResponse, ForecastType, AlertOptions } from './types'; +import PointCache from './point_cache'; +import { ClientOptions, PointResponse, ForecastResponse, AlertsResponse, ForecastType, StationsResponse, ObservationResponse, AlertOptions } from './types'; const defaultOptions: ClientOptions = { userAgent: 'weathered package' @@ -36,9 +37,11 @@ const processOptions = (options: AlertOptions) => { */ class Client { private options: ClientOptions; + private pointCache: PointCache; constructor(options?: ClientOptions) { this.options = {...defaultOptions, ...options}; + this.pointCache = new PointCache(); } private getPath(path: string) { @@ -50,9 +53,19 @@ class Client { return await resp.json(); } - private getPoint(latitude: number, longitude: number) : Promise { + private async getPoint(latitude: number, longitude: number) : Promise { + const potentialPointResponse = this.pointCache.get(latitude, longitude); + + if (potentialPointResponse) { + return potentialPointResponse; + } + const path = `points/${latitude},${longitude}`; - return this.getPath(path); + + const pointResponse = await this.getPath(path); + this.pointCache.set(latitude, longitude, pointResponse); + + return pointResponse; } getOptions() : ClientOptions { @@ -90,11 +103,20 @@ class Client { * */ async getForecast(latitude: number, longitude: number, forecastType: ForecastType) : Promise { - const pointResp = await this.getPoint(latitude, longitude); + const pointResponse = await this.getPoint(latitude, longitude); const forecastKey = forecastType === 'hourly' ? 'forecastHourly' : 'forecast'; - const url = pointResp.properties[forecastKey]; + const url = pointResponse.properties[forecastKey]; return this.getUrl(url); } + + async getObservation(latitude: number, longitude: number): Promise { + const pointResponse = await this.getPoint(latitude, longitude); + const stationsUrl = pointResponse.properties.observationStations; + const stationsResponse: StationsResponse = await this.getUrl(stationsUrl); + const observationsUrl = `${stationsResponse.features[0].id}/observations/latest`; + const observationResponse: ObservationResponse = await this.getUrl(observationsUrl); + return observationResponse; + } } export { Client }; diff --git a/src/point_cache.ts b/src/point_cache.ts new file mode 100644 index 0000000..15e81af --- /dev/null +++ b/src/point_cache.ts @@ -0,0 +1,21 @@ +import { PointResponse } from './types'; + +const cacheKey = (lat: number, lng: number) => `${lat},${lng}`; + +class PointCache { + private points: { [key: string]: PointResponse; }; + + constructor() { + this.points = {}; + } + + get(latitude: number, longitude: number): PointResponse | undefined { + return this.points[cacheKey(latitude, longitude)]; + } + + set(latitude: number, longitude: number, pointResponse: PointResponse): void { + this.points[cacheKey(latitude, longitude)] = pointResponse; + } +} + +export default PointCache; diff --git a/src/types.ts b/src/types.ts index c0244f6..1a39707 100644 --- a/src/types.ts +++ b/src/types.ts @@ -52,6 +52,29 @@ type PointResponse = { properties: { forecast: string; forecastHourly: string; + observationStations: string; + } +} + +type Station = { + id: string; +} + +type StationsResponse = { + features: Station[]; +} + +type PresentWeather = { + [key: string]: string | null; +} + +type ObservationResponse = { + properties: { + presentWeather: PresentWeather[], + temperature: { + value: number; + unitCode: string; + } } } @@ -70,6 +93,7 @@ type ForecastPeriod = { shortForecast: string; detailedForecast: string; } + type ForecastProperties = { updated: string; units: string; @@ -104,4 +128,4 @@ type AlertsResponse = { features: AlertsFeature[]; } -export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, AlertsResponse, AlertsFeature }; +export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, StationsResponse, ObservationResponse, AlertsResponse, AlertsFeature }; From f946b53713b567bde63d1f1268854ba01d608f69 Mon Sep 17 00:00:00 2001 From: Jason Sanford Date: Tue, 15 Jun 2021 09:37:17 -0400 Subject: [PATCH 2/8] stations cache --- dist/cache.d.ts | 14 +++++++++++++ dist/cache.js | 27 ++++++++++++++++++++++++ dist/client.d.ts | 15 +++++++++++++- dist/client.js | 38 ++++++++++++++++++++++++++++------ src/cache.ts | 35 +++++++++++++++++++++++++++++++ src/client.ts | 51 ++++++++++++++++++++++++++++++++++++---------- src/point_cache.ts | 21 ------------------- 7 files changed, 162 insertions(+), 39 deletions(-) create mode 100644 dist/cache.d.ts create mode 100644 dist/cache.js create mode 100644 src/cache.ts delete mode 100644 src/point_cache.ts diff --git a/dist/cache.d.ts b/dist/cache.d.ts new file mode 100644 index 0000000..1d2045d --- /dev/null +++ b/dist/cache.d.ts @@ -0,0 +1,14 @@ +import { PointResponse, StationsResponse } from './types'; +declare class PointCache { + private points; + constructor(); + get(key: string): PointResponse | undefined; + set(key: string, pointResponse: PointResponse): void; +} +declare class StationsCache { + private items; + constructor(); + get(key: string): StationsResponse | undefined; + set(key: string, stationsResponse: StationsResponse): void; +} +export { PointCache, StationsCache }; diff --git a/dist/cache.js b/dist/cache.js new file mode 100644 index 0000000..b1d8a53 --- /dev/null +++ b/dist/cache.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StationsCache = exports.PointCache = void 0; +class PointCache { + constructor() { + this.points = {}; + } + get(key) { + return this.points[key]; + } + set(key, pointResponse) { + this.points[key] = pointResponse; + } +} +exports.PointCache = PointCache; +class StationsCache { + constructor() { + this.items = {}; + } + get(key) { + return this.items[key]; + } + set(key, stationsResponse) { + this.items[key] = stationsResponse; + } +} +exports.StationsCache = StationsCache; diff --git a/dist/client.d.ts b/dist/client.d.ts index d810095..d5fece1 100644 --- a/dist/client.d.ts +++ b/dist/client.d.ts @@ -9,10 +9,12 @@ import { ClientOptions, ForecastResponse, AlertsResponse, ForecastType, Observat declare class Client { private options; private pointCache; + private stationsCache; constructor(options?: ClientOptions); private getPath; private getUrl; private getPoint; + private getStations; getOptions(): ClientOptions; setOptions(newOptions: ClientOptions): void; /** @@ -37,6 +39,17 @@ declare class Client { * */ getForecast(latitude: number, longitude: number, forecastType: ForecastType): Promise; - getObservation(latitude: number, longitude: number): Promise; + /** + * Get the latest weather observations for a given latitude and longitude. + * This + * + * ```typescript + * const latitude = 35.6175667; + * const longitude = -80.7709911; + * const observations = await client.getLatestObservations(latitude, longitude); + * ``` + * + */ + getLatestObservations(latitude: number, longitude: number): Promise; } export { Client }; diff --git a/dist/client.js b/dist/client.js index 7c62d78..eceaaff 100644 --- a/dist/client.js +++ b/dist/client.js @@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); exports.Client = void 0; const cross_fetch_1 = __importDefault(require("cross-fetch")); -const point_cache_1 = __importDefault(require("./point_cache")); +const cache_1 = require("./cache"); const defaultOptions = { userAgent: 'weathered package' }; @@ -34,7 +34,8 @@ const processOptions = (options) => { class Client { constructor(options) { this.options = { ...defaultOptions, ...options }; - this.pointCache = new point_cache_1.default(); + this.pointCache = new cache_1.PointCache(); + this.stationsCache = new cache_1.StationsCache(); } getPath(path) { return this.getUrl(API_ROOT + path); @@ -44,15 +45,29 @@ class Client { return await resp.json(); } async getPoint(latitude, longitude) { - const potentialPointResponse = this.pointCache.get(latitude, longitude); + const cacheKey = `${latitude},${longitude}`; + const potentialPointResponse = this.pointCache.get(cacheKey); if (potentialPointResponse) { + console.log('point hit'); return potentialPointResponse; } + console.log('point miss'); const path = `points/${latitude},${longitude}`; const pointResponse = await this.getPath(path); - this.pointCache.set(latitude, longitude, pointResponse); + this.pointCache.set(cacheKey, pointResponse); return pointResponse; } + async getStations(url) { + const potentionalStationsResponse = this.stationsCache.get(url); + if (potentionalStationsResponse) { + console.log('stations hit'); + return potentionalStationsResponse; + } + console.log('stations miss'); + const stationsResponse = await this.getUrl(url); + this.stationsCache.set(url, stationsResponse); + return stationsResponse; + } getOptions() { return { ...this.options }; } @@ -90,10 +105,21 @@ class Client { const url = pointResponse.properties[forecastKey]; return this.getUrl(url); } - async getObservation(latitude, longitude) { + /** + * Get the latest weather observations for a given latitude and longitude. + * This + * + * ```typescript + * const latitude = 35.6175667; + * const longitude = -80.7709911; + * const observations = await client.getLatestObservations(latitude, longitude); + * ``` + * + */ + async getLatestObservations(latitude, longitude) { const pointResponse = await this.getPoint(latitude, longitude); const stationsUrl = pointResponse.properties.observationStations; - const stationsResponse = await this.getUrl(stationsUrl); + const stationsResponse = await this.getStations(stationsUrl); const observationsUrl = `${stationsResponse.features[0].id}/observations/latest`; const observationResponse = await this.getUrl(observationsUrl); return observationResponse; diff --git a/src/cache.ts b/src/cache.ts new file mode 100644 index 0000000..dea5589 --- /dev/null +++ b/src/cache.ts @@ -0,0 +1,35 @@ +import { PointResponse, StationsResponse } from './types'; + +class PointCache { + private points: { [key: string]: PointResponse; }; + + constructor() { + this.points = {}; + } + + get(key: string): PointResponse | undefined { + return this.points[key]; + } + + set(key: string, pointResponse: PointResponse): void { + this.points[key] = pointResponse; + } +} + +class StationsCache { + private items: { [key: string]: StationsResponse; }; + + constructor() { + this.items = {}; + } + + get(key: string): StationsResponse | undefined { + return this.items[key]; + } + + set(key: string, stationsResponse: StationsResponse): void { + this.items[key] = stationsResponse; + } +} + +export { PointCache, StationsCache }; diff --git a/src/client.ts b/src/client.ts index 216272c..9fcdfac 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,6 +1,6 @@ import fetch from 'cross-fetch'; -import PointCache from './point_cache'; +import { PointCache, StationsCache } from './cache'; import { ClientOptions, PointResponse, ForecastResponse, AlertsResponse, ForecastType, StationsResponse, ObservationResponse, AlertOptions } from './types'; const defaultOptions: ClientOptions = { @@ -38,10 +38,12 @@ const processOptions = (options: AlertOptions) => { class Client { private options: ClientOptions; private pointCache: PointCache; + private stationsCache: StationsCache; constructor(options?: ClientOptions) { this.options = {...defaultOptions, ...options}; this.pointCache = new PointCache(); + this.stationsCache = new StationsCache(); } private getPath(path: string) { @@ -53,26 +55,42 @@ class Client { return await resp.json(); } - private async getPoint(latitude: number, longitude: number) : Promise { - const potentialPointResponse = this.pointCache.get(latitude, longitude); + private async getPoint(latitude: number, longitude: number): Promise { + const cacheKey = `${latitude},${longitude}`; + const potentialPointResponse = this.pointCache.get(cacheKey); if (potentialPointResponse) { + console.log('point hit'); return potentialPointResponse; } - + console.log('point miss'); const path = `points/${latitude},${longitude}`; const pointResponse = await this.getPath(path); - this.pointCache.set(latitude, longitude, pointResponse); + this.pointCache.set(cacheKey, pointResponse); return pointResponse; } - getOptions() : ClientOptions { + private async getStations(url: string): Promise { + const potentionalStationsResponse = this.stationsCache.get(url); + + if (potentionalStationsResponse) { + console.log('stations hit'); + return potentionalStationsResponse; + } + console.log('stations miss'); + const stationsResponse = await this.getUrl(url); + this.stationsCache.set(url, stationsResponse); + + return stationsResponse; + } + + getOptions(): ClientOptions { return {...this.options}; } - setOptions(newOptions: ClientOptions) : void { + setOptions(newOptions: ClientOptions): void { this.options = {...this.options, ...newOptions}; } @@ -86,7 +104,7 @@ class Client { * const alerts = await client.getAlerts(active, { latitude, longitude }); * ``` */ - getAlerts(active: boolean, options: AlertOptions) : Promise { + getAlerts(active: boolean, options: AlertOptions): Promise { const params = processOptions(options); const path = `alerts${ active ? '/active' : ''}?${params}`; return this.getPath(path); @@ -102,17 +120,28 @@ class Client { * ``` * */ - async getForecast(latitude: number, longitude: number, forecastType: ForecastType) : Promise { + async getForecast(latitude: number, longitude: number, forecastType: ForecastType): Promise { const pointResponse = await this.getPoint(latitude, longitude); const forecastKey = forecastType === 'hourly' ? 'forecastHourly' : 'forecast'; const url = pointResponse.properties[forecastKey]; return this.getUrl(url); } - async getObservation(latitude: number, longitude: number): Promise { + /** + * Get the latest weather observations for a given latitude and longitude. + * This + * + * ```typescript + * const latitude = 35.6175667; + * const longitude = -80.7709911; + * const observations = await client.getLatestObservations(latitude, longitude); + * ``` + * + */ + async getLatestObservations(latitude: number, longitude: number): Promise { const pointResponse = await this.getPoint(latitude, longitude); const stationsUrl = pointResponse.properties.observationStations; - const stationsResponse: StationsResponse = await this.getUrl(stationsUrl); + const stationsResponse = await this.getStations(stationsUrl); const observationsUrl = `${stationsResponse.features[0].id}/observations/latest`; const observationResponse: ObservationResponse = await this.getUrl(observationsUrl); return observationResponse; diff --git a/src/point_cache.ts b/src/point_cache.ts deleted file mode 100644 index 15e81af..0000000 --- a/src/point_cache.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { PointResponse } from './types'; - -const cacheKey = (lat: number, lng: number) => `${lat},${lng}`; - -class PointCache { - private points: { [key: string]: PointResponse; }; - - constructor() { - this.points = {}; - } - - get(latitude: number, longitude: number): PointResponse | undefined { - return this.points[cacheKey(latitude, longitude)]; - } - - set(latitude: number, longitude: number, pointResponse: PointResponse): void { - this.points[cacheKey(latitude, longitude)] = pointResponse; - } -} - -export default PointCache; From 8fa1f02bd36e2fd658bc71e1080fce9050d6a489 Mon Sep 17 00:00:00 2001 From: Jason Sanford Date: Tue, 15 Jun 2021 10:05:14 -0400 Subject: [PATCH 3/8] docs --- docs/assets/js/search.js | 2 +- docs/classes/client.html | 57 ++++++++++++++++-- docs/index.html | 122 ++++++++++++++++++++++++++++++++++----- docs/modules.html | 122 ++++++++++++++++++++++++++++++++++----- src/client.ts | 3 +- src/index.ts | 2 +- src/types.ts | 2 +- 7 files changed, 271 insertions(+), 39 deletions(-) diff --git a/docs/assets/js/search.js b/docs/assets/js/search.js index 4671100..d5a2a79 100644 --- a/docs/assets/js/search.js +++ b/docs/assets/js/search.js @@ -1 +1 @@ -window.searchData = {"kinds":{"128":"Class","512":"Constructor","1024":"Property","2048":"Method","65536":"Type literal","4194304":"Type alias"},"rows":[{"id":0,"kind":128,"name":"Client","url":"classes/client.html","classes":"tsd-kind-class"},{"id":1,"kind":512,"name":"constructor","url":"classes/client.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"Client"},{"id":2,"kind":2048,"name":"getOptions","url":"classes/client.html#getoptions","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":3,"kind":2048,"name":"setOptions","url":"classes/client.html#setoptions","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":4,"kind":2048,"name":"getAlerts","url":"classes/client.html#getalerts","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":5,"kind":2048,"name":"getForecast","url":"classes/client.html#getforecast","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":6,"kind":4194304,"name":"ForecastType","url":"modules.html#forecasttype","classes":"tsd-kind-type-alias"},{"id":7,"kind":4194304,"name":"Area","url":"modules.html#area","classes":"tsd-kind-type-alias"},{"id":8,"kind":4194304,"name":"Region","url":"modules.html#region","classes":"tsd-kind-type-alias"},{"id":9,"kind":4194304,"name":"RegionType","url":"modules.html#regiontype","classes":"tsd-kind-type-alias"},{"id":10,"kind":4194304,"name":"Urgency","url":"modules.html#urgency","classes":"tsd-kind-type-alias"},{"id":11,"kind":4194304,"name":"AlertOptions","url":"modules.html#alertoptions","classes":"tsd-kind-type-alias"},{"id":12,"kind":4194304,"name":"ClientOptions","url":"modules.html#clientoptions","classes":"tsd-kind-type-alias"},{"id":13,"kind":65536,"name":"__type","url":"modules.html#clientoptions.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"ClientOptions"},{"id":14,"kind":1024,"name":"userAgent","url":"modules.html#clientoptions.__type.useragent","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ClientOptions.__type"},{"id":15,"kind":4194304,"name":"PointResponse","url":"modules.html#pointresponse","classes":"tsd-kind-type-alias"},{"id":16,"kind":65536,"name":"__type","url":"modules.html#pointresponse.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"PointResponse"},{"id":17,"kind":1024,"name":"properties","url":"modules.html#pointresponse.__type.properties","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"PointResponse.__type"},{"id":18,"kind":65536,"name":"__type","url":"modules.html#pointresponse.__type.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-type-literal","parent":"PointResponse.__type"},{"id":19,"kind":1024,"name":"forecast","url":"modules.html#pointresponse.__type.__type-1.forecast","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"PointResponse.__type.__type"},{"id":20,"kind":1024,"name":"forecastHourly","url":"modules.html#pointresponse.__type.__type-1.forecasthourly","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"PointResponse.__type.__type"},{"id":21,"kind":4194304,"name":"ForecastResponse","url":"modules.html#forecastresponse","classes":"tsd-kind-type-alias"},{"id":22,"kind":65536,"name":"__type","url":"modules.html#forecastresponse.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"ForecastResponse"},{"id":23,"kind":1024,"name":"properties","url":"modules.html#forecastresponse.__type.properties","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastResponse.__type"},{"id":24,"kind":4194304,"name":"AlertsResponse","url":"modules.html#alertsresponse","classes":"tsd-kind-type-alias"},{"id":25,"kind":65536,"name":"__type","url":"modules.html#alertsresponse.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"AlertsResponse"},{"id":26,"kind":1024,"name":"features","url":"modules.html#alertsresponse.__type.features","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsResponse.__type"},{"id":27,"kind":4194304,"name":"AlertsFeature","url":"modules.html#alertsfeature","classes":"tsd-kind-type-alias"},{"id":28,"kind":65536,"name":"__type","url":"modules.html#alertsfeature.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"AlertsFeature"},{"id":29,"kind":1024,"name":"id","url":"modules.html#alertsfeature.__type.id","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":30,"kind":1024,"name":"geometry","url":"modules.html#alertsfeature.__type.geometry","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":31,"kind":65536,"name":"__type","url":"modules.html#alertsfeature.__type.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":32,"kind":1024,"name":"type","url":"modules.html#alertsfeature.__type.__type-1.type","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":33,"kind":1024,"name":"coordinates","url":"modules.html#alertsfeature.__type.__type-1.coordinates","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":34,"kind":1024,"name":"properties","url":"modules.html#alertsfeature.__type.properties","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":35,"kind":65536,"name":"__type","url":"modules.html#alertsfeature.__type.__type-2","classes":"tsd-kind-type-literal tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":36,"kind":1024,"name":"areaDesc","url":"modules.html#alertsfeature.__type.__type-2.areadesc","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":37,"kind":1024,"name":"sent","url":"modules.html#alertsfeature.__type.__type-2.sent","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":38,"kind":1024,"name":"effective","url":"modules.html#alertsfeature.__type.__type-2.effective","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":39,"kind":1024,"name":"expries","url":"modules.html#alertsfeature.__type.__type-2.expries","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":40,"kind":1024,"name":"description","url":"modules.html#alertsfeature.__type.__type-2.description","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"}],"index":{"version":"2.3.9","fields":["name","parent"],"fieldVectors":[["name/0",[0,18.659]],["parent/0",[]],["name/1",[1,33.322]],["parent/1",[0,1.596]],["name/2",[2,33.322]],["parent/2",[0,1.596]],["name/3",[3,33.322]],["parent/3",[0,1.596]],["name/4",[4,33.322]],["parent/4",[0,1.596]],["name/5",[5,33.322]],["parent/5",[0,1.596]],["name/6",[6,33.322]],["parent/6",[]],["name/7",[7,33.322]],["parent/7",[]],["name/8",[8,33.322]],["parent/8",[]],["name/9",[9,33.322]],["parent/9",[]],["name/10",[10,33.322]],["parent/10",[]],["name/11",[11,33.322]],["parent/11",[]],["name/12",[12,28.214]],["parent/12",[]],["name/13",[13,15.976]],["parent/13",[12,2.413]],["name/14",[14,33.322]],["parent/14",[15,2.85]],["name/15",[16,28.214]],["parent/15",[]],["name/16",[13,15.976]],["parent/16",[16,2.413]],["name/17",[17,24.849]],["parent/17",[18,2.413]],["name/18",[13,15.976]],["parent/18",[18,2.413]],["name/19",[19,33.322]],["parent/19",[20,2.413]],["name/20",[21,33.322]],["parent/20",[20,2.413]],["name/21",[22,28.214]],["parent/21",[]],["name/22",[13,15.976]],["parent/22",[22,2.413]],["name/23",[17,24.849]],["parent/23",[23,2.85]],["name/24",[24,28.214]],["parent/24",[]],["name/25",[13,15.976]],["parent/25",[24,2.413]],["name/26",[25,33.322]],["parent/26",[26,2.85]],["name/27",[27,28.214]],["parent/27",[]],["name/28",[13,15.976]],["parent/28",[27,2.413]],["name/29",[28,33.322]],["parent/29",[29,1.739]],["name/30",[30,33.322]],["parent/30",[29,1.739]],["name/31",[13,15.976]],["parent/31",[29,1.739]],["name/32",[31,33.322]],["parent/32",[32,1.473]],["name/33",[33,33.322]],["parent/33",[32,1.473]],["name/34",[17,24.849]],["parent/34",[29,1.739]],["name/35",[13,15.976]],["parent/35",[29,1.739]],["name/36",[34,33.322]],["parent/36",[32,1.473]],["name/37",[35,33.322]],["parent/37",[32,1.473]],["name/38",[36,33.322]],["parent/38",[32,1.473]],["name/39",[37,33.322]],["parent/39",[32,1.473]],["name/40",[38,33.322]],["parent/40",[32,1.473]]],"invertedIndex":[["__type",{"_index":13,"name":{"13":{},"16":{},"18":{},"22":{},"25":{},"28":{},"31":{},"35":{}},"parent":{}}],["alertoptions",{"_index":11,"name":{"11":{}},"parent":{}}],["alertsfeature",{"_index":27,"name":{"27":{}},"parent":{"28":{}}}],["alertsfeature.__type",{"_index":29,"name":{},"parent":{"29":{},"30":{},"31":{},"34":{},"35":{}}}],["alertsfeature.__type.__type",{"_index":32,"name":{},"parent":{"32":{},"33":{},"36":{},"37":{},"38":{},"39":{},"40":{}}}],["alertsresponse",{"_index":24,"name":{"24":{}},"parent":{"25":{}}}],["alertsresponse.__type",{"_index":26,"name":{},"parent":{"26":{}}}],["area",{"_index":7,"name":{"7":{}},"parent":{}}],["areadesc",{"_index":34,"name":{"36":{}},"parent":{}}],["client",{"_index":0,"name":{"0":{}},"parent":{"1":{},"2":{},"3":{},"4":{},"5":{}}}],["clientoptions",{"_index":12,"name":{"12":{}},"parent":{"13":{}}}],["clientoptions.__type",{"_index":15,"name":{},"parent":{"14":{}}}],["constructor",{"_index":1,"name":{"1":{}},"parent":{}}],["coordinates",{"_index":33,"name":{"33":{}},"parent":{}}],["description",{"_index":38,"name":{"40":{}},"parent":{}}],["effective",{"_index":36,"name":{"38":{}},"parent":{}}],["expries",{"_index":37,"name":{"39":{}},"parent":{}}],["features",{"_index":25,"name":{"26":{}},"parent":{}}],["forecast",{"_index":19,"name":{"19":{}},"parent":{}}],["forecasthourly",{"_index":21,"name":{"20":{}},"parent":{}}],["forecastresponse",{"_index":22,"name":{"21":{}},"parent":{"22":{}}}],["forecastresponse.__type",{"_index":23,"name":{},"parent":{"23":{}}}],["forecasttype",{"_index":6,"name":{"6":{}},"parent":{}}],["geometry",{"_index":30,"name":{"30":{}},"parent":{}}],["getalerts",{"_index":4,"name":{"4":{}},"parent":{}}],["getforecast",{"_index":5,"name":{"5":{}},"parent":{}}],["getoptions",{"_index":2,"name":{"2":{}},"parent":{}}],["id",{"_index":28,"name":{"29":{}},"parent":{}}],["pointresponse",{"_index":16,"name":{"15":{}},"parent":{"16":{}}}],["pointresponse.__type",{"_index":18,"name":{},"parent":{"17":{},"18":{}}}],["pointresponse.__type.__type",{"_index":20,"name":{},"parent":{"19":{},"20":{}}}],["properties",{"_index":17,"name":{"17":{},"23":{},"34":{}},"parent":{}}],["region",{"_index":8,"name":{"8":{}},"parent":{}}],["regiontype",{"_index":9,"name":{"9":{}},"parent":{}}],["sent",{"_index":35,"name":{"37":{}},"parent":{}}],["setoptions",{"_index":3,"name":{"3":{}},"parent":{}}],["type",{"_index":31,"name":{"32":{}},"parent":{}}],["urgency",{"_index":10,"name":{"10":{}},"parent":{}}],["useragent",{"_index":14,"name":{"14":{}},"parent":{}}]],"pipeline":[]}} \ No newline at end of file +window.searchData = {"kinds":{"128":"Class","512":"Constructor","1024":"Property","2048":"Method","65536":"Type literal","4194304":"Type alias"},"rows":[{"id":0,"kind":128,"name":"Client","url":"classes/client.html","classes":"tsd-kind-class"},{"id":1,"kind":512,"name":"constructor","url":"classes/client.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"Client"},{"id":2,"kind":2048,"name":"getOptions","url":"classes/client.html#getoptions","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":3,"kind":2048,"name":"setOptions","url":"classes/client.html#setoptions","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":4,"kind":2048,"name":"getAlerts","url":"classes/client.html#getalerts","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":5,"kind":2048,"name":"getForecast","url":"classes/client.html#getforecast","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":6,"kind":2048,"name":"getLatestObservations","url":"classes/client.html#getlatestobservations","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":7,"kind":4194304,"name":"ForecastType","url":"modules.html#forecasttype","classes":"tsd-kind-type-alias"},{"id":8,"kind":4194304,"name":"Area","url":"modules.html#area","classes":"tsd-kind-type-alias"},{"id":9,"kind":4194304,"name":"Region","url":"modules.html#region","classes":"tsd-kind-type-alias"},{"id":10,"kind":4194304,"name":"RegionType","url":"modules.html#regiontype","classes":"tsd-kind-type-alias"},{"id":11,"kind":4194304,"name":"Urgency","url":"modules.html#urgency","classes":"tsd-kind-type-alias"},{"id":12,"kind":4194304,"name":"AlertOptions","url":"modules.html#alertoptions","classes":"tsd-kind-type-alias"},{"id":13,"kind":4194304,"name":"ClientOptions","url":"modules.html#clientoptions","classes":"tsd-kind-type-alias"},{"id":14,"kind":65536,"name":"__type","url":"modules.html#clientoptions.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"ClientOptions"},{"id":15,"kind":1024,"name":"userAgent","url":"modules.html#clientoptions.__type.useragent","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ClientOptions.__type"},{"id":16,"kind":4194304,"name":"PointResponse","url":"modules.html#pointresponse","classes":"tsd-kind-type-alias"},{"id":17,"kind":65536,"name":"__type","url":"modules.html#pointresponse.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"PointResponse"},{"id":18,"kind":1024,"name":"properties","url":"modules.html#pointresponse.__type.properties","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"PointResponse.__type"},{"id":19,"kind":65536,"name":"__type","url":"modules.html#pointresponse.__type.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-type-literal","parent":"PointResponse.__type"},{"id":20,"kind":1024,"name":"forecast","url":"modules.html#pointresponse.__type.__type-1.forecast","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"PointResponse.__type.__type"},{"id":21,"kind":1024,"name":"forecastHourly","url":"modules.html#pointresponse.__type.__type-1.forecasthourly","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"PointResponse.__type.__type"},{"id":22,"kind":1024,"name":"observationStations","url":"modules.html#pointresponse.__type.__type-1.observationstations","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"PointResponse.__type.__type"},{"id":23,"kind":4194304,"name":"ForecastResponse","url":"modules.html#forecastresponse","classes":"tsd-kind-type-alias"},{"id":24,"kind":65536,"name":"__type","url":"modules.html#forecastresponse.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"ForecastResponse"},{"id":25,"kind":1024,"name":"properties","url":"modules.html#forecastresponse.__type.properties","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastResponse.__type"},{"id":26,"kind":4194304,"name":"ForecastProperties","url":"modules.html#forecastproperties","classes":"tsd-kind-type-alias"},{"id":27,"kind":65536,"name":"__type","url":"modules.html#forecastproperties.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"ForecastProperties"},{"id":28,"kind":1024,"name":"updated","url":"modules.html#forecastproperties.__type.updated","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":29,"kind":1024,"name":"units","url":"modules.html#forecastproperties.__type.units","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":30,"kind":1024,"name":"forecastGenerator","url":"modules.html#forecastproperties.__type.forecastgenerator","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":31,"kind":1024,"name":"generatedAt","url":"modules.html#forecastproperties.__type.generatedat","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":32,"kind":1024,"name":"updateTime","url":"modules.html#forecastproperties.__type.updatetime","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":33,"kind":1024,"name":"validTimes","url":"modules.html#forecastproperties.__type.validtimes","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":34,"kind":1024,"name":"elevation","url":"modules.html#forecastproperties.__type.elevation","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":35,"kind":65536,"name":"__type","url":"modules.html#forecastproperties.__type.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":36,"kind":1024,"name":"value","url":"modules.html#forecastproperties.__type.__type-1.value","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type.__type"},{"id":37,"kind":1024,"name":"unitCode","url":"modules.html#forecastproperties.__type.__type-1.unitcode","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type.__type"},{"id":38,"kind":1024,"name":"periods","url":"modules.html#forecastproperties.__type.periods","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":39,"kind":4194304,"name":"AlertsResponse","url":"modules.html#alertsresponse","classes":"tsd-kind-type-alias"},{"id":40,"kind":65536,"name":"__type","url":"modules.html#alertsresponse.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"AlertsResponse"},{"id":41,"kind":1024,"name":"features","url":"modules.html#alertsresponse.__type.features","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsResponse.__type"},{"id":42,"kind":4194304,"name":"ObservationResponse","url":"modules.html#observationresponse","classes":"tsd-kind-type-alias"},{"id":43,"kind":65536,"name":"__type","url":"modules.html#observationresponse.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"ObservationResponse"},{"id":44,"kind":1024,"name":"properties","url":"modules.html#observationresponse.__type.properties","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ObservationResponse.__type"},{"id":45,"kind":65536,"name":"__type","url":"modules.html#observationresponse.__type.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-type-literal","parent":"ObservationResponse.__type"},{"id":46,"kind":1024,"name":"presentWeather","url":"modules.html#observationresponse.__type.__type-1.presentweather","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ObservationResponse.__type.__type"},{"id":47,"kind":1024,"name":"temperature","url":"modules.html#observationresponse.__type.__type-1.temperature","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ObservationResponse.__type.__type"},{"id":48,"kind":65536,"name":"__type","url":"modules.html#observationresponse.__type.__type-1.__type-2","classes":"tsd-kind-type-literal tsd-parent-kind-type-literal","parent":"ObservationResponse.__type.__type"},{"id":49,"kind":1024,"name":"value","url":"modules.html#observationresponse.__type.__type-1.__type-2.value","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ObservationResponse.__type.__type.__type"},{"id":50,"kind":1024,"name":"unitCode","url":"modules.html#observationresponse.__type.__type-1.__type-2.unitcode","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ObservationResponse.__type.__type.__type"},{"id":51,"kind":4194304,"name":"AlertsFeature","url":"modules.html#alertsfeature","classes":"tsd-kind-type-alias"},{"id":52,"kind":65536,"name":"__type","url":"modules.html#alertsfeature.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"AlertsFeature"},{"id":53,"kind":1024,"name":"id","url":"modules.html#alertsfeature.__type.id","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":54,"kind":1024,"name":"geometry","url":"modules.html#alertsfeature.__type.geometry","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":55,"kind":65536,"name":"__type","url":"modules.html#alertsfeature.__type.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":56,"kind":1024,"name":"type","url":"modules.html#alertsfeature.__type.__type-1.type","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":57,"kind":1024,"name":"coordinates","url":"modules.html#alertsfeature.__type.__type-1.coordinates","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":58,"kind":1024,"name":"properties","url":"modules.html#alertsfeature.__type.properties","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":59,"kind":65536,"name":"__type","url":"modules.html#alertsfeature.__type.__type-2","classes":"tsd-kind-type-literal tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":60,"kind":1024,"name":"areaDesc","url":"modules.html#alertsfeature.__type.__type-2.areadesc","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":61,"kind":1024,"name":"sent","url":"modules.html#alertsfeature.__type.__type-2.sent","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":62,"kind":1024,"name":"effective","url":"modules.html#alertsfeature.__type.__type-2.effective","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":63,"kind":1024,"name":"expries","url":"modules.html#alertsfeature.__type.__type-2.expries","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":64,"kind":1024,"name":"description","url":"modules.html#alertsfeature.__type.__type-2.description","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"}],"index":{"version":"2.3.9","fields":["name","parent"],"fieldVectors":[["name/0",[0,21.748]],["parent/0",[]],["name/1",[1,37.842]],["parent/1",[0,1.955]],["name/2",[2,37.842]],["parent/2",[0,1.955]],["name/3",[3,37.842]],["parent/3",[0,1.955]],["name/4",[4,37.842]],["parent/4",[0,1.955]],["name/5",[5,37.842]],["parent/5",[0,1.955]],["name/6",[6,37.842]],["parent/6",[0,1.955]],["name/7",[7,37.842]],["parent/7",[]],["name/8",[8,37.842]],["parent/8",[]],["name/9",[9,37.842]],["parent/9",[]],["name/10",[10,37.842]],["parent/10",[]],["name/11",[11,37.842]],["parent/11",[]],["name/12",[12,37.842]],["parent/12",[]],["name/13",[13,32.734]],["parent/13",[]],["name/14",[14,15.87]],["parent/14",[13,2.943]],["name/15",[15,37.842]],["parent/15",[16,3.402]],["name/16",[17,32.734]],["parent/16",[]],["name/17",[14,15.87]],["parent/17",[17,2.943]],["name/18",[18,26.856]],["parent/18",[19,2.943]],["name/19",[14,15.87]],["parent/19",[19,2.943]],["name/20",[20,37.842]],["parent/20",[21,2.64]],["name/21",[22,37.842]],["parent/21",[21,2.64]],["name/22",[23,37.842]],["parent/22",[21,2.64]],["name/23",[24,32.734]],["parent/23",[]],["name/24",[14,15.87]],["parent/24",[24,2.943]],["name/25",[18,26.856]],["parent/25",[25,3.402]],["name/26",[26,32.734]],["parent/26",[]],["name/27",[14,15.87]],["parent/27",[26,2.943]],["name/28",[27,37.842]],["parent/28",[28,1.743]],["name/29",[29,37.842]],["parent/29",[28,1.743]],["name/30",[30,37.842]],["parent/30",[28,1.743]],["name/31",[31,37.842]],["parent/31",[28,1.743]],["name/32",[32,37.842]],["parent/32",[28,1.743]],["name/33",[33,37.842]],["parent/33",[28,1.743]],["name/34",[34,37.842]],["parent/34",[28,1.743]],["name/35",[14,15.87]],["parent/35",[28,1.743]],["name/36",[35,32.734]],["parent/36",[36,2.943]],["name/37",[37,32.734]],["parent/37",[36,2.943]],["name/38",[38,37.842]],["parent/38",[28,1.743]],["name/39",[39,32.734]],["parent/39",[]],["name/40",[14,15.87]],["parent/40",[39,2.943]],["name/41",[40,37.842]],["parent/41",[41,3.402]],["name/42",[42,32.734]],["parent/42",[]],["name/43",[14,15.87]],["parent/43",[42,2.943]],["name/44",[18,26.856]],["parent/44",[43,2.943]],["name/45",[14,15.87]],["parent/45",[43,2.943]],["name/46",[44,37.842]],["parent/46",[45,2.64]],["name/47",[46,37.842]],["parent/47",[45,2.64]],["name/48",[14,15.87]],["parent/48",[45,2.64]],["name/49",[35,32.734]],["parent/49",[47,2.943]],["name/50",[37,32.734]],["parent/50",[47,2.943]],["name/51",[48,32.734]],["parent/51",[]],["name/52",[14,15.87]],["parent/52",[48,2.943]],["name/53",[49,37.842]],["parent/53",[50,2.234]],["name/54",[51,37.842]],["parent/54",[50,2.234]],["name/55",[14,15.87]],["parent/55",[50,2.234]],["name/56",[52,37.842]],["parent/56",[53,1.955]],["name/57",[54,37.842]],["parent/57",[53,1.955]],["name/58",[18,26.856]],["parent/58",[50,2.234]],["name/59",[14,15.87]],["parent/59",[50,2.234]],["name/60",[55,37.842]],["parent/60",[53,1.955]],["name/61",[56,37.842]],["parent/61",[53,1.955]],["name/62",[57,37.842]],["parent/62",[53,1.955]],["name/63",[58,37.842]],["parent/63",[53,1.955]],["name/64",[59,37.842]],["parent/64",[53,1.955]]],"invertedIndex":[["__type",{"_index":14,"name":{"14":{},"17":{},"19":{},"24":{},"27":{},"35":{},"40":{},"43":{},"45":{},"48":{},"52":{},"55":{},"59":{}},"parent":{}}],["alertoptions",{"_index":12,"name":{"12":{}},"parent":{}}],["alertsfeature",{"_index":48,"name":{"51":{}},"parent":{"52":{}}}],["alertsfeature.__type",{"_index":50,"name":{},"parent":{"53":{},"54":{},"55":{},"58":{},"59":{}}}],["alertsfeature.__type.__type",{"_index":53,"name":{},"parent":{"56":{},"57":{},"60":{},"61":{},"62":{},"63":{},"64":{}}}],["alertsresponse",{"_index":39,"name":{"39":{}},"parent":{"40":{}}}],["alertsresponse.__type",{"_index":41,"name":{},"parent":{"41":{}}}],["area",{"_index":8,"name":{"8":{}},"parent":{}}],["areadesc",{"_index":55,"name":{"60":{}},"parent":{}}],["client",{"_index":0,"name":{"0":{}},"parent":{"1":{},"2":{},"3":{},"4":{},"5":{},"6":{}}}],["clientoptions",{"_index":13,"name":{"13":{}},"parent":{"14":{}}}],["clientoptions.__type",{"_index":16,"name":{},"parent":{"15":{}}}],["constructor",{"_index":1,"name":{"1":{}},"parent":{}}],["coordinates",{"_index":54,"name":{"57":{}},"parent":{}}],["description",{"_index":59,"name":{"64":{}},"parent":{}}],["effective",{"_index":57,"name":{"62":{}},"parent":{}}],["elevation",{"_index":34,"name":{"34":{}},"parent":{}}],["expries",{"_index":58,"name":{"63":{}},"parent":{}}],["features",{"_index":40,"name":{"41":{}},"parent":{}}],["forecast",{"_index":20,"name":{"20":{}},"parent":{}}],["forecastgenerator",{"_index":30,"name":{"30":{}},"parent":{}}],["forecasthourly",{"_index":22,"name":{"21":{}},"parent":{}}],["forecastproperties",{"_index":26,"name":{"26":{}},"parent":{"27":{}}}],["forecastproperties.__type",{"_index":28,"name":{},"parent":{"28":{},"29":{},"30":{},"31":{},"32":{},"33":{},"34":{},"35":{},"38":{}}}],["forecastproperties.__type.__type",{"_index":36,"name":{},"parent":{"36":{},"37":{}}}],["forecastresponse",{"_index":24,"name":{"23":{}},"parent":{"24":{}}}],["forecastresponse.__type",{"_index":25,"name":{},"parent":{"25":{}}}],["forecasttype",{"_index":7,"name":{"7":{}},"parent":{}}],["generatedat",{"_index":31,"name":{"31":{}},"parent":{}}],["geometry",{"_index":51,"name":{"54":{}},"parent":{}}],["getalerts",{"_index":4,"name":{"4":{}},"parent":{}}],["getforecast",{"_index":5,"name":{"5":{}},"parent":{}}],["getlatestobservations",{"_index":6,"name":{"6":{}},"parent":{}}],["getoptions",{"_index":2,"name":{"2":{}},"parent":{}}],["id",{"_index":49,"name":{"53":{}},"parent":{}}],["observationresponse",{"_index":42,"name":{"42":{}},"parent":{"43":{}}}],["observationresponse.__type",{"_index":43,"name":{},"parent":{"44":{},"45":{}}}],["observationresponse.__type.__type",{"_index":45,"name":{},"parent":{"46":{},"47":{},"48":{}}}],["observationresponse.__type.__type.__type",{"_index":47,"name":{},"parent":{"49":{},"50":{}}}],["observationstations",{"_index":23,"name":{"22":{}},"parent":{}}],["periods",{"_index":38,"name":{"38":{}},"parent":{}}],["pointresponse",{"_index":17,"name":{"16":{}},"parent":{"17":{}}}],["pointresponse.__type",{"_index":19,"name":{},"parent":{"18":{},"19":{}}}],["pointresponse.__type.__type",{"_index":21,"name":{},"parent":{"20":{},"21":{},"22":{}}}],["presentweather",{"_index":44,"name":{"46":{}},"parent":{}}],["properties",{"_index":18,"name":{"18":{},"25":{},"44":{},"58":{}},"parent":{}}],["region",{"_index":9,"name":{"9":{}},"parent":{}}],["regiontype",{"_index":10,"name":{"10":{}},"parent":{}}],["sent",{"_index":56,"name":{"61":{}},"parent":{}}],["setoptions",{"_index":3,"name":{"3":{}},"parent":{}}],["temperature",{"_index":46,"name":{"47":{}},"parent":{}}],["type",{"_index":52,"name":{"56":{}},"parent":{}}],["unitcode",{"_index":37,"name":{"37":{},"50":{}},"parent":{}}],["units",{"_index":29,"name":{"29":{}},"parent":{}}],["updated",{"_index":27,"name":{"28":{}},"parent":{}}],["updatetime",{"_index":32,"name":{"32":{}},"parent":{}}],["urgency",{"_index":11,"name":{"11":{}},"parent":{}}],["useragent",{"_index":15,"name":{"15":{}},"parent":{}}],["validtimes",{"_index":33,"name":{"33":{}},"parent":{}}],["value",{"_index":35,"name":{"36":{},"49":{}},"parent":{}}]],"pipeline":[]}} \ No newline at end of file diff --git a/docs/classes/client.html b/docs/classes/client.html index cf5d468..78a57c9 100644 --- a/docs/classes/client.html +++ b/docs/classes/client.html @@ -2716,6 +2716,9 @@
  • getForecast
  • +
  • + getLatestObservations +
  • getOptions
  • @@ -2739,12 +2742,18 @@
  • ClientOptions
  • +
  • + ForecastProperties +
  • ForecastResponse
  • ForecastType
  • +
  • + ObservationResponse +
  • PointResponse
  • @@ -2793,6 +2802,7 @@

    Methods

    @@ -2812,7 +2822,7 @@

    constructor

  • Parameters

    @@ -2838,7 +2848,7 @@

    getAlerts

  • @@ -2874,7 +2884,7 @@

    getForecast

  • @@ -2902,6 +2912,43 @@

    Returns Promise +
    + +

    getLatestObservations

    + +
      +
    • + +
      +
      +

      Get the latest weather observations for a given latitude and longitude. + This method finds the nearest observation station, which could be near + or far, and returns its latest observation.

      +
      +
      const latitude = 35.6175667;
      +const longitude = -80.7709911;
      +const observations = await client.getLatestObservations(latitude, longitude);
      +
      +
      +

      Parameters

      +
        +
      • +
        latitude: number
        +
      • +
      • +
        longitude: number
        +
      • +
      +

      Returns Promise<ObservationResponse>

      +
    • +
    +

    getOptions

    @@ -2912,7 +2959,7 @@

    getOptions

  • Returns ClientOptions

    @@ -2929,7 +2976,7 @@

    setOptions

  • Parameters

    diff --git a/docs/index.html b/docs/index.html index c43a805..97437ab 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2722,12 +2722,18 @@
  • ClientOptions
  • +
  • + ForecastProperties +
  • ForecastResponse
  • ForecastType
  • +
  • + ObservationResponse +
  • PointResponse
  • @@ -2838,8 +2844,10 @@

    Type aliases

  • AlertsResponse
  • Area
  • ClientOptions
  • +
  • ForecastProperties
  • ForecastResponse
  • ForecastType
  • +
  • ObservationResponse
  • PointResponse
  • Region
  • RegionType
  • @@ -2857,7 +2865,7 @@

    AlertOptions

    AlertOptions: UrgencyOption & XOR<AreaOption, XOR<PointOption, XOR<RegionOption, RegionTypeOption>>>
    @@ -2867,7 +2875,7 @@

    AlertsFeature

    AlertsFeature: { geometry: { coordinates: number[][]; type: "Polygon" }; id: string; properties: { areaDesc: string; description: string; effective: string; expries: string; sent: string } }
    @@ -2916,7 +2924,7 @@

    AlertsResponse

    AlertsResponse: { features: AlertsFeature[] }
    @@ -2934,7 +2942,7 @@

    Area

    Area: "AL" | "AK" | "AS" | "AR" | "AZ" | "CA" | "CO" | "CT" | "DE" | "DC" | "FL" | "GA" | "GU" | "HI" | "ID" | "IL" | "IN" | "IA" | "KS" | "KY" | "LA" | "ME" | "MD" | "MA" | "MI" | "MN" | "MS" | "MO" | "MT" | "NE" | "NV" | "NH" | "NJ" | "NM" | "NY" | "NC" | "ND" | "OH" | "OK" | "OR" | "PA" | "PR" | "RI" | "SC" | "SD" | "TN" | "TX" | "UT" | "VT" | "VI" | "VA" | "WA" | "WV" | "WI" | "WY" | "PZ" | "PK" | "PH" | "PS" | "PM" | "AN" | "AM" | "GM" | "LS" | "LM" | "LH" | "LC" | "LE" | "LO"
    @@ -2944,7 +2952,7 @@

    ClientOptions

    ClientOptions: { userAgent?: string }
    @@ -2956,20 +2964,67 @@
    Optional userAgent
    +
    + +

    ForecastProperties

    +
    ForecastProperties: { elevation: { unitCode: string; value: number }; forecastGenerator: string; generatedAt: string; periods: ForecastPeriod[]; units: string; updateTime: string; updated: string; validTimes: string }
    + +
    +

    Type declaration

    +
      +
    • +
      elevation: { unitCode: string; value: number }
      +
        +
      • +
        unitCode: string
        +
      • +
      • +
        value: number
        +
      • +
      +
    • +
    • +
      forecastGenerator: string
      +
    • +
    • +
      generatedAt: string
      +
    • +
    • +
      periods: ForecastPeriod[]
      +
    • +
    • +
      units: string
      +
    • +
    • +
      updateTime: string
      +
    • +
    • +
      updated: string
      +
    • +
    • +
      validTimes: string
      +
    • +
    +
    +

    ForecastResponse

    -
    ForecastResponse: { properties: ForecastProperties }
    +
    ForecastResponse: { properties: ForecastProperties }

    Type declaration

    @@ -2980,24 +3035,58 @@

    ForecastType

    ForecastType: "hourly" | "baseline"
    +
    + +

    ObservationResponse

    +
    ObservationResponse: { properties: { presentWeather: PresentWeather[]; temperature: { unitCode: string; value: number } } }
    + +
    +

    Type declaration

    +
      +
    • +
      properties: { presentWeather: PresentWeather[]; temperature: { unitCode: string; value: number } }
      +
        +
      • +
        presentWeather: PresentWeather[]
        +
      • +
      • +
        temperature: { unitCode: string; value: number }
        +
          +
        • +
          unitCode: string
          +
        • +
        • +
          value: number
          +
        • +
        +
      • +
      +
    • +
    +
    +

    PointResponse

    -
    PointResponse: { properties: { forecast: string; forecastHourly: string } }
    +
    PointResponse: { properties: { forecast: string; forecastHourly: string; observationStations: string } }

    Type declaration

    • -
      properties: { forecast: string; forecastHourly: string }
      +
      properties: { forecast: string; forecastHourly: string; observationStations: string }
      • forecast: string
        @@ -3005,6 +3094,9 @@
        forecast:
        forecastHourly: string
      • +
      • +
        observationStations: string
        +
    @@ -3016,7 +3108,7 @@

    Region

    Region: "AL" | "AT" | "GL" | "GM" | "PA" | "PI"
    @@ -3026,7 +3118,7 @@

    RegionType

    RegionType: "land" | "marine"
    @@ -3036,7 +3128,7 @@

    Urgency

    Urgency: "immediate" | "expected" | "future" | "past" | "unknown"
    diff --git a/docs/modules.html b/docs/modules.html index 1ea7e41..0273c65 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -2722,12 +2722,18 @@
  • ClientOptions
  • +
  • + ForecastProperties +
  • ForecastResponse
  • ForecastType
  • +
  • + ObservationResponse +
  • PointResponse
  • @@ -2837,8 +2843,10 @@

    Type aliases

  • AlertsResponse
  • Area
  • ClientOptions
  • +
  • ForecastProperties
  • ForecastResponse
  • ForecastType
  • +
  • ObservationResponse
  • PointResponse
  • Region
  • RegionType
  • @@ -2856,7 +2864,7 @@

    AlertOptions

    AlertOptions: UrgencyOption & XOR<AreaOption, XOR<PointOption, XOR<RegionOption, RegionTypeOption>>>
    @@ -2866,7 +2874,7 @@

    AlertsFeature

    AlertsFeature: { geometry: { coordinates: number[][]; type: "Polygon" }; id: string; properties: { areaDesc: string; description: string; effective: string; expries: string; sent: string } }
    @@ -2915,7 +2923,7 @@

    AlertsResponse

    AlertsResponse: { features: AlertsFeature[] }
    @@ -2933,7 +2941,7 @@

    Area

    Area: "AL" | "AK" | "AS" | "AR" | "AZ" | "CA" | "CO" | "CT" | "DE" | "DC" | "FL" | "GA" | "GU" | "HI" | "ID" | "IL" | "IN" | "IA" | "KS" | "KY" | "LA" | "ME" | "MD" | "MA" | "MI" | "MN" | "MS" | "MO" | "MT" | "NE" | "NV" | "NH" | "NJ" | "NM" | "NY" | "NC" | "ND" | "OH" | "OK" | "OR" | "PA" | "PR" | "RI" | "SC" | "SD" | "TN" | "TX" | "UT" | "VT" | "VI" | "VA" | "WA" | "WV" | "WI" | "WY" | "PZ" | "PK" | "PH" | "PS" | "PM" | "AN" | "AM" | "GM" | "LS" | "LM" | "LH" | "LC" | "LE" | "LO"
    @@ -2943,7 +2951,7 @@

    ClientOptions

    ClientOptions: { userAgent?: string }
    @@ -2955,20 +2963,67 @@
    Optional userAgent
    +
    + +

    ForecastProperties

    +
    ForecastProperties: { elevation: { unitCode: string; value: number }; forecastGenerator: string; generatedAt: string; periods: ForecastPeriod[]; units: string; updateTime: string; updated: string; validTimes: string }
    + +
    +

    Type declaration

    +
      +
    • +
      elevation: { unitCode: string; value: number }
      +
        +
      • +
        unitCode: string
        +
      • +
      • +
        value: number
        +
      • +
      +
    • +
    • +
      forecastGenerator: string
      +
    • +
    • +
      generatedAt: string
      +
    • +
    • +
      periods: ForecastPeriod[]
      +
    • +
    • +
      units: string
      +
    • +
    • +
      updateTime: string
      +
    • +
    • +
      updated: string
      +
    • +
    • +
      validTimes: string
      +
    • +
    +
    +

    ForecastResponse

    -
    ForecastResponse: { properties: ForecastProperties }
    +
    ForecastResponse: { properties: ForecastProperties }

    Type declaration

    @@ -2979,24 +3034,58 @@

    ForecastType

    ForecastType: "hourly" | "baseline"
    +
    + +

    ObservationResponse

    +
    ObservationResponse: { properties: { presentWeather: PresentWeather[]; temperature: { unitCode: string; value: number } } }
    + +
    +

    Type declaration

    +
      +
    • +
      properties: { presentWeather: PresentWeather[]; temperature: { unitCode: string; value: number } }
      +
        +
      • +
        presentWeather: PresentWeather[]
        +
      • +
      • +
        temperature: { unitCode: string; value: number }
        +
          +
        • +
          unitCode: string
          +
        • +
        • +
          value: number
          +
        • +
        +
      • +
      +
    • +
    +
    +

    PointResponse

    -
    PointResponse: { properties: { forecast: string; forecastHourly: string } }
    +
    PointResponse: { properties: { forecast: string; forecastHourly: string; observationStations: string } }

    Type declaration

    • -
      properties: { forecast: string; forecastHourly: string }
      +
      properties: { forecast: string; forecastHourly: string; observationStations: string }
      • forecast: string
        @@ -3004,6 +3093,9 @@
        forecast:
        forecastHourly: string
      • +
      • +
        observationStations: string
        +
    @@ -3015,7 +3107,7 @@

    Region

    Region: "AL" | "AT" | "GL" | "GM" | "PA" | "PI"
    @@ -3025,7 +3117,7 @@

    RegionType

    RegionType: "land" | "marine"
    @@ -3035,7 +3127,7 @@

    Urgency

    Urgency: "immediate" | "expected" | "future" | "past" | "unknown"
    diff --git a/src/client.ts b/src/client.ts index 9fcdfac..44fb5e1 100644 --- a/src/client.ts +++ b/src/client.ts @@ -129,7 +129,8 @@ class Client { /** * Get the latest weather observations for a given latitude and longitude. - * This + * This method finds the nearest observation station, which could be near + * or far, and returns its latest observation. * * ```typescript * const latitude = 35.6175667; diff --git a/src/index.ts b/src/index.ts index b71aeac..c991c28 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,3 @@ export { Client } from './client'; -export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, AlertsResponse, AlertsFeature } from './types'; +export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, ForecastProperties, AlertsResponse, ObservationResponse, AlertsFeature } from './types'; diff --git a/src/types.ts b/src/types.ts index 1a39707..d2c77a4 100644 --- a/src/types.ts +++ b/src/types.ts @@ -128,4 +128,4 @@ type AlertsResponse = { features: AlertsFeature[]; } -export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, StationsResponse, ObservationResponse, AlertsResponse, AlertsFeature }; +export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, ForecastProperties, StationsResponse, ObservationResponse, AlertsResponse, AlertsFeature }; From 8f7ba87b66795d5297eac64c2d2809bcc45abe10 Mon Sep 17 00:00:00 2001 From: Jason Sanford Date: Tue, 15 Jun 2021 18:34:14 -0400 Subject: [PATCH 4/8] build --- dist/client.d.ts | 3 ++- dist/client.js | 3 ++- dist/index.d.ts | 2 +- dist/types.d.ts | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dist/client.d.ts b/dist/client.d.ts index d5fece1..5ea8445 100644 --- a/dist/client.d.ts +++ b/dist/client.d.ts @@ -41,7 +41,8 @@ declare class Client { getForecast(latitude: number, longitude: number, forecastType: ForecastType): Promise; /** * Get the latest weather observations for a given latitude and longitude. - * This + * This method finds the nearest observation station, which could be near + * or far, and returns its latest observation. * * ```typescript * const latitude = 35.6175667; diff --git a/dist/client.js b/dist/client.js index eceaaff..673a917 100644 --- a/dist/client.js +++ b/dist/client.js @@ -107,7 +107,8 @@ class Client { } /** * Get the latest weather observations for a given latitude and longitude. - * This + * This method finds the nearest observation station, which could be near + * or far, and returns its latest observation. * * ```typescript * const latitude = 35.6175667; diff --git a/dist/index.d.ts b/dist/index.d.ts index e70e441..ee88eee 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,2 +1,2 @@ export { Client } from './client'; -export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, AlertsResponse, AlertsFeature } from './types'; +export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, ForecastProperties, AlertsResponse, ObservationResponse, AlertsFeature } from './types'; diff --git a/dist/types.d.ts b/dist/types.d.ts index bf8466d..e6ee2a1 100644 --- a/dist/types.d.ts +++ b/dist/types.d.ts @@ -100,4 +100,4 @@ declare type AlertsFeature = { declare type AlertsResponse = { features: AlertsFeature[]; }; -export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, StationsResponse, ObservationResponse, AlertsResponse, AlertsFeature }; +export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, ForecastProperties, StationsResponse, ObservationResponse, AlertsResponse, AlertsFeature }; From feeba71e20c171c91ebccfc714e7f33f9b77d1cf Mon Sep 17 00:00:00 2001 From: Jason Sanford Date: Wed, 16 Jun 2021 15:12:19 -0400 Subject: [PATCH 5/8] Update docs --- dist/client.d.ts | 26 ++++++---- dist/client.js | 51 +++++++++++-------- dist/index.d.ts | 2 +- dist/types.d.ts | 14 +----- docs/assets/js/search.js | 2 +- docs/classes/client.html | 82 ++++++++++++++++++++++-------- docs/index.html | 106 +++++++++++++++++++++------------------ docs/modules.html | 106 +++++++++++++++++++++------------------ src/client.ts | 62 +++++++++++++---------- src/index.ts | 2 +- src/types.ts | 2 +- 11 files changed, 260 insertions(+), 195 deletions(-) diff --git a/dist/client.d.ts b/dist/client.d.ts index 5ea8445..c1ad3e9 100644 --- a/dist/client.d.ts +++ b/dist/client.d.ts @@ -1,4 +1,4 @@ -import { ClientOptions, ForecastResponse, AlertsResponse, ForecastType, ObservationResponse, AlertOptions } from './types'; +import { ClientOptions, ForecastResponse, AlertsResponse, ForecastType, StationsResponse, Station, AlertOptions } from './types'; /** * The main client * @@ -14,11 +14,10 @@ declare class Client { private getPath; private getUrl; private getPoint; - private getStations; getOptions(): ClientOptions; setOptions(newOptions: ClientOptions): void; /** - * Get weather alerts for a given area + * Get weather alerts for a given area. * * ```typescript * const active = true; @@ -29,7 +28,7 @@ declare class Client { */ getAlerts(active: boolean, options: AlertOptions): Promise; /** - * Get a weather forecast for a given latitude and longitude + * Get a weather forecast for a given latitude and longitude. * * ```typescript * const latitude = 35.6175667; @@ -40,17 +39,26 @@ declare class Client { */ getForecast(latitude: number, longitude: number, forecastType: ForecastType): Promise; /** - * Get the latest weather observations for a given latitude and longitude. - * This method finds the nearest observation station, which could be near - * or far, and returns its latest observation. + * Get the closest weather stations for a given latitude and longitude. * * ```typescript * const latitude = 35.6175667; * const longitude = -80.7709911; - * const observations = await client.getLatestObservations(latitude, longitude); + * const stations = await client.getStations(latitude, longitude); * ``` * */ - getLatestObservations(latitude: number, longitude: number): Promise; + getStations(latitude: number, longitude: number): Promise; + /** + * Get the closest weather station for a given latitude and longitude. + * + * ```typescript + * const latitude = 35.6175667; + * const longitude = -80.7709911; + * const stationOrNull = await client.getNearestStation(latitude, longitude); + * ``` + * + */ + getNearestStation(latitude: number, longitude: number): Promise; } export { Client }; diff --git a/dist/client.js b/dist/client.js index 673a917..a3f6054 100644 --- a/dist/client.js +++ b/dist/client.js @@ -57,17 +57,6 @@ class Client { this.pointCache.set(cacheKey, pointResponse); return pointResponse; } - async getStations(url) { - const potentionalStationsResponse = this.stationsCache.get(url); - if (potentionalStationsResponse) { - console.log('stations hit'); - return potentionalStationsResponse; - } - console.log('stations miss'); - const stationsResponse = await this.getUrl(url); - this.stationsCache.set(url, stationsResponse); - return stationsResponse; - } getOptions() { return { ...this.options }; } @@ -75,7 +64,7 @@ class Client { this.options = { ...this.options, ...newOptions }; } /** - * Get weather alerts for a given area + * Get weather alerts for a given area. * * ```typescript * const active = true; @@ -90,7 +79,7 @@ class Client { return this.getPath(path); } /** - * Get a weather forecast for a given latitude and longitude + * Get a weather forecast for a given latitude and longitude. * * ```typescript * const latitude = 35.6175667; @@ -106,24 +95,42 @@ class Client { return this.getUrl(url); } /** - * Get the latest weather observations for a given latitude and longitude. - * This method finds the nearest observation station, which could be near - * or far, and returns its latest observation. + * Get the closest weather stations for a given latitude and longitude. * * ```typescript * const latitude = 35.6175667; * const longitude = -80.7709911; - * const observations = await client.getLatestObservations(latitude, longitude); + * const stations = await client.getStations(latitude, longitude); * ``` * */ - async getLatestObservations(latitude, longitude) { + async getStations(latitude, longitude) { const pointResponse = await this.getPoint(latitude, longitude); const stationsUrl = pointResponse.properties.observationStations; - const stationsResponse = await this.getStations(stationsUrl); - const observationsUrl = `${stationsResponse.features[0].id}/observations/latest`; - const observationResponse = await this.getUrl(observationsUrl); - return observationResponse; + const potentionalStationsResponse = this.stationsCache.get(stationsUrl); + if (potentionalStationsResponse) { + return potentionalStationsResponse; + } + const stationsResponse = await this.getUrl(stationsUrl); + this.stationsCache.set(stationsUrl, stationsResponse); + return stationsResponse; + } + /** + * Get the closest weather station for a given latitude and longitude. + * + * ```typescript + * const latitude = 35.6175667; + * const longitude = -80.7709911; + * const stationOrNull = await client.getNearestStation(latitude, longitude); + * ``` + * + */ + async getNearestStation(latitude, longitude) { + const stationsResponse = await this.getStations(latitude, longitude); + if (stationsResponse.features.length > 0) { + return stationsResponse.features[0]; + } + return null; } } exports.Client = Client; diff --git a/dist/index.d.ts b/dist/index.d.ts index ee88eee..96668e2 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,2 +1,2 @@ export { Client } from './client'; -export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, ForecastProperties, AlertsResponse, ObservationResponse, AlertsFeature } from './types'; +export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, ForecastProperties, AlertsResponse, Station, StationsResponse, AlertsFeature } from './types'; diff --git a/dist/types.d.ts b/dist/types.d.ts index e6ee2a1..6fa268c 100644 --- a/dist/types.d.ts +++ b/dist/types.d.ts @@ -40,18 +40,6 @@ declare type Station = { declare type StationsResponse = { features: Station[]; }; -declare type PresentWeather = { - [key: string]: string | null; -}; -declare type ObservationResponse = { - properties: { - presentWeather: PresentWeather[]; - temperature: { - value: number; - unitCode: string; - }; - }; -}; declare type ForecastPeriod = { number: number; name: string; @@ -100,4 +88,4 @@ declare type AlertsFeature = { declare type AlertsResponse = { features: AlertsFeature[]; }; -export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, ForecastProperties, StationsResponse, ObservationResponse, AlertsResponse, AlertsFeature }; +export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, ForecastProperties, Station, StationsResponse, AlertsResponse, AlertsFeature }; diff --git a/docs/assets/js/search.js b/docs/assets/js/search.js index d5a2a79..e7727cc 100644 --- a/docs/assets/js/search.js +++ b/docs/assets/js/search.js @@ -1 +1 @@ -window.searchData = {"kinds":{"128":"Class","512":"Constructor","1024":"Property","2048":"Method","65536":"Type literal","4194304":"Type alias"},"rows":[{"id":0,"kind":128,"name":"Client","url":"classes/client.html","classes":"tsd-kind-class"},{"id":1,"kind":512,"name":"constructor","url":"classes/client.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"Client"},{"id":2,"kind":2048,"name":"getOptions","url":"classes/client.html#getoptions","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":3,"kind":2048,"name":"setOptions","url":"classes/client.html#setoptions","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":4,"kind":2048,"name":"getAlerts","url":"classes/client.html#getalerts","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":5,"kind":2048,"name":"getForecast","url":"classes/client.html#getforecast","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":6,"kind":2048,"name":"getLatestObservations","url":"classes/client.html#getlatestobservations","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":7,"kind":4194304,"name":"ForecastType","url":"modules.html#forecasttype","classes":"tsd-kind-type-alias"},{"id":8,"kind":4194304,"name":"Area","url":"modules.html#area","classes":"tsd-kind-type-alias"},{"id":9,"kind":4194304,"name":"Region","url":"modules.html#region","classes":"tsd-kind-type-alias"},{"id":10,"kind":4194304,"name":"RegionType","url":"modules.html#regiontype","classes":"tsd-kind-type-alias"},{"id":11,"kind":4194304,"name":"Urgency","url":"modules.html#urgency","classes":"tsd-kind-type-alias"},{"id":12,"kind":4194304,"name":"AlertOptions","url":"modules.html#alertoptions","classes":"tsd-kind-type-alias"},{"id":13,"kind":4194304,"name":"ClientOptions","url":"modules.html#clientoptions","classes":"tsd-kind-type-alias"},{"id":14,"kind":65536,"name":"__type","url":"modules.html#clientoptions.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"ClientOptions"},{"id":15,"kind":1024,"name":"userAgent","url":"modules.html#clientoptions.__type.useragent","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ClientOptions.__type"},{"id":16,"kind":4194304,"name":"PointResponse","url":"modules.html#pointresponse","classes":"tsd-kind-type-alias"},{"id":17,"kind":65536,"name":"__type","url":"modules.html#pointresponse.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"PointResponse"},{"id":18,"kind":1024,"name":"properties","url":"modules.html#pointresponse.__type.properties","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"PointResponse.__type"},{"id":19,"kind":65536,"name":"__type","url":"modules.html#pointresponse.__type.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-type-literal","parent":"PointResponse.__type"},{"id":20,"kind":1024,"name":"forecast","url":"modules.html#pointresponse.__type.__type-1.forecast","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"PointResponse.__type.__type"},{"id":21,"kind":1024,"name":"forecastHourly","url":"modules.html#pointresponse.__type.__type-1.forecasthourly","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"PointResponse.__type.__type"},{"id":22,"kind":1024,"name":"observationStations","url":"modules.html#pointresponse.__type.__type-1.observationstations","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"PointResponse.__type.__type"},{"id":23,"kind":4194304,"name":"ForecastResponse","url":"modules.html#forecastresponse","classes":"tsd-kind-type-alias"},{"id":24,"kind":65536,"name":"__type","url":"modules.html#forecastresponse.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"ForecastResponse"},{"id":25,"kind":1024,"name":"properties","url":"modules.html#forecastresponse.__type.properties","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastResponse.__type"},{"id":26,"kind":4194304,"name":"ForecastProperties","url":"modules.html#forecastproperties","classes":"tsd-kind-type-alias"},{"id":27,"kind":65536,"name":"__type","url":"modules.html#forecastproperties.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"ForecastProperties"},{"id":28,"kind":1024,"name":"updated","url":"modules.html#forecastproperties.__type.updated","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":29,"kind":1024,"name":"units","url":"modules.html#forecastproperties.__type.units","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":30,"kind":1024,"name":"forecastGenerator","url":"modules.html#forecastproperties.__type.forecastgenerator","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":31,"kind":1024,"name":"generatedAt","url":"modules.html#forecastproperties.__type.generatedat","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":32,"kind":1024,"name":"updateTime","url":"modules.html#forecastproperties.__type.updatetime","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":33,"kind":1024,"name":"validTimes","url":"modules.html#forecastproperties.__type.validtimes","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":34,"kind":1024,"name":"elevation","url":"modules.html#forecastproperties.__type.elevation","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":35,"kind":65536,"name":"__type","url":"modules.html#forecastproperties.__type.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":36,"kind":1024,"name":"value","url":"modules.html#forecastproperties.__type.__type-1.value","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type.__type"},{"id":37,"kind":1024,"name":"unitCode","url":"modules.html#forecastproperties.__type.__type-1.unitcode","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type.__type"},{"id":38,"kind":1024,"name":"periods","url":"modules.html#forecastproperties.__type.periods","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":39,"kind":4194304,"name":"AlertsResponse","url":"modules.html#alertsresponse","classes":"tsd-kind-type-alias"},{"id":40,"kind":65536,"name":"__type","url":"modules.html#alertsresponse.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"AlertsResponse"},{"id":41,"kind":1024,"name":"features","url":"modules.html#alertsresponse.__type.features","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsResponse.__type"},{"id":42,"kind":4194304,"name":"ObservationResponse","url":"modules.html#observationresponse","classes":"tsd-kind-type-alias"},{"id":43,"kind":65536,"name":"__type","url":"modules.html#observationresponse.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"ObservationResponse"},{"id":44,"kind":1024,"name":"properties","url":"modules.html#observationresponse.__type.properties","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ObservationResponse.__type"},{"id":45,"kind":65536,"name":"__type","url":"modules.html#observationresponse.__type.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-type-literal","parent":"ObservationResponse.__type"},{"id":46,"kind":1024,"name":"presentWeather","url":"modules.html#observationresponse.__type.__type-1.presentweather","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ObservationResponse.__type.__type"},{"id":47,"kind":1024,"name":"temperature","url":"modules.html#observationresponse.__type.__type-1.temperature","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ObservationResponse.__type.__type"},{"id":48,"kind":65536,"name":"__type","url":"modules.html#observationresponse.__type.__type-1.__type-2","classes":"tsd-kind-type-literal tsd-parent-kind-type-literal","parent":"ObservationResponse.__type.__type"},{"id":49,"kind":1024,"name":"value","url":"modules.html#observationresponse.__type.__type-1.__type-2.value","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ObservationResponse.__type.__type.__type"},{"id":50,"kind":1024,"name":"unitCode","url":"modules.html#observationresponse.__type.__type-1.__type-2.unitcode","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ObservationResponse.__type.__type.__type"},{"id":51,"kind":4194304,"name":"AlertsFeature","url":"modules.html#alertsfeature","classes":"tsd-kind-type-alias"},{"id":52,"kind":65536,"name":"__type","url":"modules.html#alertsfeature.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"AlertsFeature"},{"id":53,"kind":1024,"name":"id","url":"modules.html#alertsfeature.__type.id","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":54,"kind":1024,"name":"geometry","url":"modules.html#alertsfeature.__type.geometry","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":55,"kind":65536,"name":"__type","url":"modules.html#alertsfeature.__type.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":56,"kind":1024,"name":"type","url":"modules.html#alertsfeature.__type.__type-1.type","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":57,"kind":1024,"name":"coordinates","url":"modules.html#alertsfeature.__type.__type-1.coordinates","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":58,"kind":1024,"name":"properties","url":"modules.html#alertsfeature.__type.properties","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":59,"kind":65536,"name":"__type","url":"modules.html#alertsfeature.__type.__type-2","classes":"tsd-kind-type-literal tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":60,"kind":1024,"name":"areaDesc","url":"modules.html#alertsfeature.__type.__type-2.areadesc","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":61,"kind":1024,"name":"sent","url":"modules.html#alertsfeature.__type.__type-2.sent","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":62,"kind":1024,"name":"effective","url":"modules.html#alertsfeature.__type.__type-2.effective","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":63,"kind":1024,"name":"expries","url":"modules.html#alertsfeature.__type.__type-2.expries","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":64,"kind":1024,"name":"description","url":"modules.html#alertsfeature.__type.__type-2.description","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"}],"index":{"version":"2.3.9","fields":["name","parent"],"fieldVectors":[["name/0",[0,21.748]],["parent/0",[]],["name/1",[1,37.842]],["parent/1",[0,1.955]],["name/2",[2,37.842]],["parent/2",[0,1.955]],["name/3",[3,37.842]],["parent/3",[0,1.955]],["name/4",[4,37.842]],["parent/4",[0,1.955]],["name/5",[5,37.842]],["parent/5",[0,1.955]],["name/6",[6,37.842]],["parent/6",[0,1.955]],["name/7",[7,37.842]],["parent/7",[]],["name/8",[8,37.842]],["parent/8",[]],["name/9",[9,37.842]],["parent/9",[]],["name/10",[10,37.842]],["parent/10",[]],["name/11",[11,37.842]],["parent/11",[]],["name/12",[12,37.842]],["parent/12",[]],["name/13",[13,32.734]],["parent/13",[]],["name/14",[14,15.87]],["parent/14",[13,2.943]],["name/15",[15,37.842]],["parent/15",[16,3.402]],["name/16",[17,32.734]],["parent/16",[]],["name/17",[14,15.87]],["parent/17",[17,2.943]],["name/18",[18,26.856]],["parent/18",[19,2.943]],["name/19",[14,15.87]],["parent/19",[19,2.943]],["name/20",[20,37.842]],["parent/20",[21,2.64]],["name/21",[22,37.842]],["parent/21",[21,2.64]],["name/22",[23,37.842]],["parent/22",[21,2.64]],["name/23",[24,32.734]],["parent/23",[]],["name/24",[14,15.87]],["parent/24",[24,2.943]],["name/25",[18,26.856]],["parent/25",[25,3.402]],["name/26",[26,32.734]],["parent/26",[]],["name/27",[14,15.87]],["parent/27",[26,2.943]],["name/28",[27,37.842]],["parent/28",[28,1.743]],["name/29",[29,37.842]],["parent/29",[28,1.743]],["name/30",[30,37.842]],["parent/30",[28,1.743]],["name/31",[31,37.842]],["parent/31",[28,1.743]],["name/32",[32,37.842]],["parent/32",[28,1.743]],["name/33",[33,37.842]],["parent/33",[28,1.743]],["name/34",[34,37.842]],["parent/34",[28,1.743]],["name/35",[14,15.87]],["parent/35",[28,1.743]],["name/36",[35,32.734]],["parent/36",[36,2.943]],["name/37",[37,32.734]],["parent/37",[36,2.943]],["name/38",[38,37.842]],["parent/38",[28,1.743]],["name/39",[39,32.734]],["parent/39",[]],["name/40",[14,15.87]],["parent/40",[39,2.943]],["name/41",[40,37.842]],["parent/41",[41,3.402]],["name/42",[42,32.734]],["parent/42",[]],["name/43",[14,15.87]],["parent/43",[42,2.943]],["name/44",[18,26.856]],["parent/44",[43,2.943]],["name/45",[14,15.87]],["parent/45",[43,2.943]],["name/46",[44,37.842]],["parent/46",[45,2.64]],["name/47",[46,37.842]],["parent/47",[45,2.64]],["name/48",[14,15.87]],["parent/48",[45,2.64]],["name/49",[35,32.734]],["parent/49",[47,2.943]],["name/50",[37,32.734]],["parent/50",[47,2.943]],["name/51",[48,32.734]],["parent/51",[]],["name/52",[14,15.87]],["parent/52",[48,2.943]],["name/53",[49,37.842]],["parent/53",[50,2.234]],["name/54",[51,37.842]],["parent/54",[50,2.234]],["name/55",[14,15.87]],["parent/55",[50,2.234]],["name/56",[52,37.842]],["parent/56",[53,1.955]],["name/57",[54,37.842]],["parent/57",[53,1.955]],["name/58",[18,26.856]],["parent/58",[50,2.234]],["name/59",[14,15.87]],["parent/59",[50,2.234]],["name/60",[55,37.842]],["parent/60",[53,1.955]],["name/61",[56,37.842]],["parent/61",[53,1.955]],["name/62",[57,37.842]],["parent/62",[53,1.955]],["name/63",[58,37.842]],["parent/63",[53,1.955]],["name/64",[59,37.842]],["parent/64",[53,1.955]]],"invertedIndex":[["__type",{"_index":14,"name":{"14":{},"17":{},"19":{},"24":{},"27":{},"35":{},"40":{},"43":{},"45":{},"48":{},"52":{},"55":{},"59":{}},"parent":{}}],["alertoptions",{"_index":12,"name":{"12":{}},"parent":{}}],["alertsfeature",{"_index":48,"name":{"51":{}},"parent":{"52":{}}}],["alertsfeature.__type",{"_index":50,"name":{},"parent":{"53":{},"54":{},"55":{},"58":{},"59":{}}}],["alertsfeature.__type.__type",{"_index":53,"name":{},"parent":{"56":{},"57":{},"60":{},"61":{},"62":{},"63":{},"64":{}}}],["alertsresponse",{"_index":39,"name":{"39":{}},"parent":{"40":{}}}],["alertsresponse.__type",{"_index":41,"name":{},"parent":{"41":{}}}],["area",{"_index":8,"name":{"8":{}},"parent":{}}],["areadesc",{"_index":55,"name":{"60":{}},"parent":{}}],["client",{"_index":0,"name":{"0":{}},"parent":{"1":{},"2":{},"3":{},"4":{},"5":{},"6":{}}}],["clientoptions",{"_index":13,"name":{"13":{}},"parent":{"14":{}}}],["clientoptions.__type",{"_index":16,"name":{},"parent":{"15":{}}}],["constructor",{"_index":1,"name":{"1":{}},"parent":{}}],["coordinates",{"_index":54,"name":{"57":{}},"parent":{}}],["description",{"_index":59,"name":{"64":{}},"parent":{}}],["effective",{"_index":57,"name":{"62":{}},"parent":{}}],["elevation",{"_index":34,"name":{"34":{}},"parent":{}}],["expries",{"_index":58,"name":{"63":{}},"parent":{}}],["features",{"_index":40,"name":{"41":{}},"parent":{}}],["forecast",{"_index":20,"name":{"20":{}},"parent":{}}],["forecastgenerator",{"_index":30,"name":{"30":{}},"parent":{}}],["forecasthourly",{"_index":22,"name":{"21":{}},"parent":{}}],["forecastproperties",{"_index":26,"name":{"26":{}},"parent":{"27":{}}}],["forecastproperties.__type",{"_index":28,"name":{},"parent":{"28":{},"29":{},"30":{},"31":{},"32":{},"33":{},"34":{},"35":{},"38":{}}}],["forecastproperties.__type.__type",{"_index":36,"name":{},"parent":{"36":{},"37":{}}}],["forecastresponse",{"_index":24,"name":{"23":{}},"parent":{"24":{}}}],["forecastresponse.__type",{"_index":25,"name":{},"parent":{"25":{}}}],["forecasttype",{"_index":7,"name":{"7":{}},"parent":{}}],["generatedat",{"_index":31,"name":{"31":{}},"parent":{}}],["geometry",{"_index":51,"name":{"54":{}},"parent":{}}],["getalerts",{"_index":4,"name":{"4":{}},"parent":{}}],["getforecast",{"_index":5,"name":{"5":{}},"parent":{}}],["getlatestobservations",{"_index":6,"name":{"6":{}},"parent":{}}],["getoptions",{"_index":2,"name":{"2":{}},"parent":{}}],["id",{"_index":49,"name":{"53":{}},"parent":{}}],["observationresponse",{"_index":42,"name":{"42":{}},"parent":{"43":{}}}],["observationresponse.__type",{"_index":43,"name":{},"parent":{"44":{},"45":{}}}],["observationresponse.__type.__type",{"_index":45,"name":{},"parent":{"46":{},"47":{},"48":{}}}],["observationresponse.__type.__type.__type",{"_index":47,"name":{},"parent":{"49":{},"50":{}}}],["observationstations",{"_index":23,"name":{"22":{}},"parent":{}}],["periods",{"_index":38,"name":{"38":{}},"parent":{}}],["pointresponse",{"_index":17,"name":{"16":{}},"parent":{"17":{}}}],["pointresponse.__type",{"_index":19,"name":{},"parent":{"18":{},"19":{}}}],["pointresponse.__type.__type",{"_index":21,"name":{},"parent":{"20":{},"21":{},"22":{}}}],["presentweather",{"_index":44,"name":{"46":{}},"parent":{}}],["properties",{"_index":18,"name":{"18":{},"25":{},"44":{},"58":{}},"parent":{}}],["region",{"_index":9,"name":{"9":{}},"parent":{}}],["regiontype",{"_index":10,"name":{"10":{}},"parent":{}}],["sent",{"_index":56,"name":{"61":{}},"parent":{}}],["setoptions",{"_index":3,"name":{"3":{}},"parent":{}}],["temperature",{"_index":46,"name":{"47":{}},"parent":{}}],["type",{"_index":52,"name":{"56":{}},"parent":{}}],["unitcode",{"_index":37,"name":{"37":{},"50":{}},"parent":{}}],["units",{"_index":29,"name":{"29":{}},"parent":{}}],["updated",{"_index":27,"name":{"28":{}},"parent":{}}],["updatetime",{"_index":32,"name":{"32":{}},"parent":{}}],["urgency",{"_index":11,"name":{"11":{}},"parent":{}}],["useragent",{"_index":15,"name":{"15":{}},"parent":{}}],["validtimes",{"_index":33,"name":{"33":{}},"parent":{}}],["value",{"_index":35,"name":{"36":{},"49":{}},"parent":{}}]],"pipeline":[]}} \ No newline at end of file +window.searchData = {"kinds":{"128":"Class","512":"Constructor","1024":"Property","2048":"Method","65536":"Type literal","4194304":"Type alias"},"rows":[{"id":0,"kind":128,"name":"Client","url":"classes/client.html","classes":"tsd-kind-class"},{"id":1,"kind":512,"name":"constructor","url":"classes/client.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"Client"},{"id":2,"kind":2048,"name":"getOptions","url":"classes/client.html#getoptions","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":3,"kind":2048,"name":"setOptions","url":"classes/client.html#setoptions","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":4,"kind":2048,"name":"getAlerts","url":"classes/client.html#getalerts","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":5,"kind":2048,"name":"getForecast","url":"classes/client.html#getforecast","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":6,"kind":2048,"name":"getStations","url":"classes/client.html#getstations","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":7,"kind":2048,"name":"getNearestStation","url":"classes/client.html#getneareststation","classes":"tsd-kind-method tsd-parent-kind-class","parent":"Client"},{"id":8,"kind":4194304,"name":"ForecastType","url":"modules.html#forecasttype","classes":"tsd-kind-type-alias"},{"id":9,"kind":4194304,"name":"Area","url":"modules.html#area","classes":"tsd-kind-type-alias"},{"id":10,"kind":4194304,"name":"Region","url":"modules.html#region","classes":"tsd-kind-type-alias"},{"id":11,"kind":4194304,"name":"RegionType","url":"modules.html#regiontype","classes":"tsd-kind-type-alias"},{"id":12,"kind":4194304,"name":"Urgency","url":"modules.html#urgency","classes":"tsd-kind-type-alias"},{"id":13,"kind":4194304,"name":"AlertOptions","url":"modules.html#alertoptions","classes":"tsd-kind-type-alias"},{"id":14,"kind":4194304,"name":"ClientOptions","url":"modules.html#clientoptions","classes":"tsd-kind-type-alias"},{"id":15,"kind":65536,"name":"__type","url":"modules.html#clientoptions.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"ClientOptions"},{"id":16,"kind":1024,"name":"userAgent","url":"modules.html#clientoptions.__type.useragent","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ClientOptions.__type"},{"id":17,"kind":4194304,"name":"PointResponse","url":"modules.html#pointresponse","classes":"tsd-kind-type-alias"},{"id":18,"kind":65536,"name":"__type","url":"modules.html#pointresponse.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"PointResponse"},{"id":19,"kind":1024,"name":"properties","url":"modules.html#pointresponse.__type.properties","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"PointResponse.__type"},{"id":20,"kind":65536,"name":"__type","url":"modules.html#pointresponse.__type.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-type-literal","parent":"PointResponse.__type"},{"id":21,"kind":1024,"name":"forecast","url":"modules.html#pointresponse.__type.__type-1.forecast","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"PointResponse.__type.__type"},{"id":22,"kind":1024,"name":"forecastHourly","url":"modules.html#pointresponse.__type.__type-1.forecasthourly","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"PointResponse.__type.__type"},{"id":23,"kind":1024,"name":"observationStations","url":"modules.html#pointresponse.__type.__type-1.observationstations","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"PointResponse.__type.__type"},{"id":24,"kind":4194304,"name":"ForecastResponse","url":"modules.html#forecastresponse","classes":"tsd-kind-type-alias"},{"id":25,"kind":65536,"name":"__type","url":"modules.html#forecastresponse.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"ForecastResponse"},{"id":26,"kind":1024,"name":"properties","url":"modules.html#forecastresponse.__type.properties","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastResponse.__type"},{"id":27,"kind":4194304,"name":"ForecastProperties","url":"modules.html#forecastproperties","classes":"tsd-kind-type-alias"},{"id":28,"kind":65536,"name":"__type","url":"modules.html#forecastproperties.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"ForecastProperties"},{"id":29,"kind":1024,"name":"updated","url":"modules.html#forecastproperties.__type.updated","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":30,"kind":1024,"name":"units","url":"modules.html#forecastproperties.__type.units","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":31,"kind":1024,"name":"forecastGenerator","url":"modules.html#forecastproperties.__type.forecastgenerator","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":32,"kind":1024,"name":"generatedAt","url":"modules.html#forecastproperties.__type.generatedat","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":33,"kind":1024,"name":"updateTime","url":"modules.html#forecastproperties.__type.updatetime","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":34,"kind":1024,"name":"validTimes","url":"modules.html#forecastproperties.__type.validtimes","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":35,"kind":1024,"name":"elevation","url":"modules.html#forecastproperties.__type.elevation","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":36,"kind":65536,"name":"__type","url":"modules.html#forecastproperties.__type.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":37,"kind":1024,"name":"value","url":"modules.html#forecastproperties.__type.__type-1.value","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type.__type"},{"id":38,"kind":1024,"name":"unitCode","url":"modules.html#forecastproperties.__type.__type-1.unitcode","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type.__type"},{"id":39,"kind":1024,"name":"periods","url":"modules.html#forecastproperties.__type.periods","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"ForecastProperties.__type"},{"id":40,"kind":4194304,"name":"AlertsResponse","url":"modules.html#alertsresponse","classes":"tsd-kind-type-alias"},{"id":41,"kind":65536,"name":"__type","url":"modules.html#alertsresponse.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"AlertsResponse"},{"id":42,"kind":1024,"name":"features","url":"modules.html#alertsresponse.__type.features","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsResponse.__type"},{"id":43,"kind":4194304,"name":"Station","url":"modules.html#station","classes":"tsd-kind-type-alias"},{"id":44,"kind":65536,"name":"__type","url":"modules.html#station.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"Station"},{"id":45,"kind":1024,"name":"id","url":"modules.html#station.__type.id","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"Station.__type"},{"id":46,"kind":4194304,"name":"StationsResponse","url":"modules.html#stationsresponse","classes":"tsd-kind-type-alias"},{"id":47,"kind":65536,"name":"__type","url":"modules.html#stationsresponse.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"StationsResponse"},{"id":48,"kind":1024,"name":"features","url":"modules.html#stationsresponse.__type.features","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"StationsResponse.__type"},{"id":49,"kind":4194304,"name":"AlertsFeature","url":"modules.html#alertsfeature","classes":"tsd-kind-type-alias"},{"id":50,"kind":65536,"name":"__type","url":"modules.html#alertsfeature.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias","parent":"AlertsFeature"},{"id":51,"kind":1024,"name":"id","url":"modules.html#alertsfeature.__type.id","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":52,"kind":1024,"name":"geometry","url":"modules.html#alertsfeature.__type.geometry","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":53,"kind":65536,"name":"__type","url":"modules.html#alertsfeature.__type.__type-1","classes":"tsd-kind-type-literal tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":54,"kind":1024,"name":"type","url":"modules.html#alertsfeature.__type.__type-1.type","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":55,"kind":1024,"name":"coordinates","url":"modules.html#alertsfeature.__type.__type-1.coordinates","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":56,"kind":1024,"name":"properties","url":"modules.html#alertsfeature.__type.properties","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":57,"kind":65536,"name":"__type","url":"modules.html#alertsfeature.__type.__type-2","classes":"tsd-kind-type-literal tsd-parent-kind-type-literal","parent":"AlertsFeature.__type"},{"id":58,"kind":1024,"name":"areaDesc","url":"modules.html#alertsfeature.__type.__type-2.areadesc","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":59,"kind":1024,"name":"sent","url":"modules.html#alertsfeature.__type.__type-2.sent","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":60,"kind":1024,"name":"effective","url":"modules.html#alertsfeature.__type.__type-2.effective","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":61,"kind":1024,"name":"expries","url":"modules.html#alertsfeature.__type.__type-2.expries","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"},{"id":62,"kind":1024,"name":"description","url":"modules.html#alertsfeature.__type.__type-2.description","classes":"tsd-kind-property tsd-parent-kind-type-literal","parent":"AlertsFeature.__type.__type"}],"index":{"version":"2.3.9","fields":["name","parent"],"fieldVectors":[["name/0",[0,20.188]],["parent/0",[]],["name/1",[1,37.534]],["parent/1",[0,1.79]],["name/2",[2,37.534]],["parent/2",[0,1.79]],["name/3",[3,37.534]],["parent/3",[0,1.79]],["name/4",[4,37.534]],["parent/4",[0,1.79]],["name/5",[5,37.534]],["parent/5",[0,1.79]],["name/6",[6,37.534]],["parent/6",[0,1.79]],["name/7",[7,37.534]],["parent/7",[0,1.79]],["name/8",[8,37.534]],["parent/8",[]],["name/9",[9,37.534]],["parent/9",[]],["name/10",[10,37.534]],["parent/10",[]],["name/11",[11,37.534]],["parent/11",[]],["name/12",[12,37.534]],["parent/12",[]],["name/13",[13,37.534]],["parent/13",[]],["name/14",[14,32.426]],["parent/14",[]],["name/15",[15,16.332]],["parent/15",[14,2.875]],["name/16",[16,37.534]],["parent/16",[17,3.328]],["name/17",[18,32.426]],["parent/17",[]],["name/18",[15,16.332]],["parent/18",[18,2.875]],["name/19",[19,29.061]],["parent/19",[20,2.875]],["name/20",[15,16.332]],["parent/20",[20,2.875]],["name/21",[21,37.534]],["parent/21",[22,2.577]],["name/22",[23,37.534]],["parent/22",[22,2.577]],["name/23",[24,37.534]],["parent/23",[22,2.577]],["name/24",[25,32.426]],["parent/24",[]],["name/25",[15,16.332]],["parent/25",[25,2.875]],["name/26",[19,29.061]],["parent/26",[26,3.328]],["name/27",[27,32.426]],["parent/27",[]],["name/28",[15,16.332]],["parent/28",[27,2.875]],["name/29",[28,37.534]],["parent/29",[29,1.691]],["name/30",[30,37.534]],["parent/30",[29,1.691]],["name/31",[31,37.534]],["parent/31",[29,1.691]],["name/32",[32,37.534]],["parent/32",[29,1.691]],["name/33",[33,37.534]],["parent/33",[29,1.691]],["name/34",[34,37.534]],["parent/34",[29,1.691]],["name/35",[35,37.534]],["parent/35",[29,1.691]],["name/36",[15,16.332]],["parent/36",[29,1.691]],["name/37",[36,37.534]],["parent/37",[37,2.875]],["name/38",[38,37.534]],["parent/38",[37,2.875]],["name/39",[39,37.534]],["parent/39",[29,1.691]],["name/40",[40,32.426]],["parent/40",[]],["name/41",[15,16.332]],["parent/41",[40,2.875]],["name/42",[41,32.426]],["parent/42",[42,3.328]],["name/43",[43,32.426]],["parent/43",[]],["name/44",[15,16.332]],["parent/44",[43,2.875]],["name/45",[44,32.426]],["parent/45",[45,3.328]],["name/46",[46,32.426]],["parent/46",[]],["name/47",[15,16.332]],["parent/47",[46,2.875]],["name/48",[41,32.426]],["parent/48",[47,3.328]],["name/49",[48,32.426]],["parent/49",[]],["name/50",[15,16.332]],["parent/50",[48,2.875]],["name/51",[44,32.426]],["parent/51",[49,2.176]],["name/52",[50,37.534]],["parent/52",[49,2.176]],["name/53",[15,16.332]],["parent/53",[49,2.176]],["name/54",[51,37.534]],["parent/54",[52,1.901]],["name/55",[53,37.534]],["parent/55",[52,1.901]],["name/56",[19,29.061]],["parent/56",[49,2.176]],["name/57",[15,16.332]],["parent/57",[49,2.176]],["name/58",[54,37.534]],["parent/58",[52,1.901]],["name/59",[55,37.534]],["parent/59",[52,1.901]],["name/60",[56,37.534]],["parent/60",[52,1.901]],["name/61",[57,37.534]],["parent/61",[52,1.901]],["name/62",[58,37.534]],["parent/62",[52,1.901]]],"invertedIndex":[["__type",{"_index":15,"name":{"15":{},"18":{},"20":{},"25":{},"28":{},"36":{},"41":{},"44":{},"47":{},"50":{},"53":{},"57":{}},"parent":{}}],["alertoptions",{"_index":13,"name":{"13":{}},"parent":{}}],["alertsfeature",{"_index":48,"name":{"49":{}},"parent":{"50":{}}}],["alertsfeature.__type",{"_index":49,"name":{},"parent":{"51":{},"52":{},"53":{},"56":{},"57":{}}}],["alertsfeature.__type.__type",{"_index":52,"name":{},"parent":{"54":{},"55":{},"58":{},"59":{},"60":{},"61":{},"62":{}}}],["alertsresponse",{"_index":40,"name":{"40":{}},"parent":{"41":{}}}],["alertsresponse.__type",{"_index":42,"name":{},"parent":{"42":{}}}],["area",{"_index":9,"name":{"9":{}},"parent":{}}],["areadesc",{"_index":54,"name":{"58":{}},"parent":{}}],["client",{"_index":0,"name":{"0":{}},"parent":{"1":{},"2":{},"3":{},"4":{},"5":{},"6":{},"7":{}}}],["clientoptions",{"_index":14,"name":{"14":{}},"parent":{"15":{}}}],["clientoptions.__type",{"_index":17,"name":{},"parent":{"16":{}}}],["constructor",{"_index":1,"name":{"1":{}},"parent":{}}],["coordinates",{"_index":53,"name":{"55":{}},"parent":{}}],["description",{"_index":58,"name":{"62":{}},"parent":{}}],["effective",{"_index":56,"name":{"60":{}},"parent":{}}],["elevation",{"_index":35,"name":{"35":{}},"parent":{}}],["expries",{"_index":57,"name":{"61":{}},"parent":{}}],["features",{"_index":41,"name":{"42":{},"48":{}},"parent":{}}],["forecast",{"_index":21,"name":{"21":{}},"parent":{}}],["forecastgenerator",{"_index":31,"name":{"31":{}},"parent":{}}],["forecasthourly",{"_index":23,"name":{"22":{}},"parent":{}}],["forecastproperties",{"_index":27,"name":{"27":{}},"parent":{"28":{}}}],["forecastproperties.__type",{"_index":29,"name":{},"parent":{"29":{},"30":{},"31":{},"32":{},"33":{},"34":{},"35":{},"36":{},"39":{}}}],["forecastproperties.__type.__type",{"_index":37,"name":{},"parent":{"37":{},"38":{}}}],["forecastresponse",{"_index":25,"name":{"24":{}},"parent":{"25":{}}}],["forecastresponse.__type",{"_index":26,"name":{},"parent":{"26":{}}}],["forecasttype",{"_index":8,"name":{"8":{}},"parent":{}}],["generatedat",{"_index":32,"name":{"32":{}},"parent":{}}],["geometry",{"_index":50,"name":{"52":{}},"parent":{}}],["getalerts",{"_index":4,"name":{"4":{}},"parent":{}}],["getforecast",{"_index":5,"name":{"5":{}},"parent":{}}],["getneareststation",{"_index":7,"name":{"7":{}},"parent":{}}],["getoptions",{"_index":2,"name":{"2":{}},"parent":{}}],["getstations",{"_index":6,"name":{"6":{}},"parent":{}}],["id",{"_index":44,"name":{"45":{},"51":{}},"parent":{}}],["observationstations",{"_index":24,"name":{"23":{}},"parent":{}}],["periods",{"_index":39,"name":{"39":{}},"parent":{}}],["pointresponse",{"_index":18,"name":{"17":{}},"parent":{"18":{}}}],["pointresponse.__type",{"_index":20,"name":{},"parent":{"19":{},"20":{}}}],["pointresponse.__type.__type",{"_index":22,"name":{},"parent":{"21":{},"22":{},"23":{}}}],["properties",{"_index":19,"name":{"19":{},"26":{},"56":{}},"parent":{}}],["region",{"_index":10,"name":{"10":{}},"parent":{}}],["regiontype",{"_index":11,"name":{"11":{}},"parent":{}}],["sent",{"_index":55,"name":{"59":{}},"parent":{}}],["setoptions",{"_index":3,"name":{"3":{}},"parent":{}}],["station",{"_index":43,"name":{"43":{}},"parent":{"44":{}}}],["station.__type",{"_index":45,"name":{},"parent":{"45":{}}}],["stationsresponse",{"_index":46,"name":{"46":{}},"parent":{"47":{}}}],["stationsresponse.__type",{"_index":47,"name":{},"parent":{"48":{}}}],["type",{"_index":51,"name":{"54":{}},"parent":{}}],["unitcode",{"_index":38,"name":{"38":{}},"parent":{}}],["units",{"_index":30,"name":{"30":{}},"parent":{}}],["updated",{"_index":28,"name":{"29":{}},"parent":{}}],["updatetime",{"_index":33,"name":{"33":{}},"parent":{}}],["urgency",{"_index":12,"name":{"12":{}},"parent":{}}],["useragent",{"_index":16,"name":{"16":{}},"parent":{}}],["validtimes",{"_index":34,"name":{"34":{}},"parent":{}}],["value",{"_index":36,"name":{"37":{}},"parent":{}}]],"pipeline":[]}} \ No newline at end of file diff --git a/docs/classes/client.html b/docs/classes/client.html index 78a57c9..0ca4e97 100644 --- a/docs/classes/client.html +++ b/docs/classes/client.html @@ -2717,11 +2717,14 @@ getForecast

  • - getLatestObservations + getNearestStation
  • getOptions
  • +
  • + getStations +
  • setOptions
  • @@ -2751,9 +2754,6 @@
  • ForecastType
  • -
  • - ObservationResponse -
  • PointResponse
  • @@ -2763,6 +2763,12 @@
  • RegionType
  • +
  • + Station +
  • +
  • + StationsResponse +
  • Urgency
  • @@ -2802,8 +2808,9 @@

    Methods

    @@ -2822,7 +2829,7 @@

    constructor

  • Parameters

    @@ -2848,12 +2855,12 @@

    getAlerts

  • -

    Get weather alerts for a given area

    +

    Get weather alerts for a given area.

    const active = true;
     const latitude = 35.6175667;
    @@ -2884,12 +2891,12 @@ 

    getForecast

  • -

    Get a weather forecast for a given latitude and longitude

    +

    Get a weather forecast for a given latitude and longitude.

    const latitude = 35.6175667;
     const longitude = -80.7709911;
    @@ -2913,27 +2920,25 @@ 

    Returns Promise
    - -

    getLatestObservations

    + +

    getNearestStation

      -
    • getLatestObservations(latitude: number, longitude: number): Promise<ObservationResponse>
    • +
    • getNearestStation(latitude: number, longitude: number): Promise<null | Station>
    • -

      Get the latest weather observations for a given latitude and longitude. - This method finds the nearest observation station, which could be near - or far, and returns its latest observation.

      +

      Get the closest weather station for a given latitude and longitude.

      const latitude = 35.6175667;
       const longitude = -80.7709911;
      -const observations = await client.getLatestObservations(latitude, longitude);
      +const stationOrNull = await client.getNearestStation(latitude, longitude);
       

      Parameters

      @@ -2945,7 +2950,7 @@
      latitude: number
      longitude: number
    -

    Returns Promise<ObservationResponse>

    +

    Returns Promise<null | Station>

  • @@ -2959,13 +2964,48 @@

    getOptions

  • Returns ClientOptions

  • +
    + +

    getStations

    +
      +
    • getStations(latitude: number, longitude: number): Promise<StationsResponse>
    • +
    +
      +
    • + +
      +
      +

      Get the closest weather stations for a given latitude and longitude.

      +
      +
      const latitude = 35.6175667;
      +const longitude = -80.7709911;
      +const stations = await client.getStations(latitude, longitude);
      +
      +
      +

      Parameters

      +
        +
      • +
        latitude: number
        +
      • +
      • +
        longitude: number
        +
      • +
      +

      Returns Promise<StationsResponse>

      +
    • +
    +

    setOptions

    @@ -2976,7 +3016,7 @@

    setOptions

  • Parameters

    diff --git a/docs/index.html b/docs/index.html index 97437ab..e9af8e5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2731,9 +2731,6 @@
  • ForecastType
  • -
  • - ObservationResponse -
  • PointResponse
  • @@ -2743,6 +2740,12 @@
  • RegionType
  • +
  • + Station +
  • +
  • + StationsResponse +
  • Urgency
  • @@ -2847,10 +2850,11 @@

    Type aliases

  • ForecastProperties
  • ForecastResponse
  • ForecastType
  • -
  • ObservationResponse
  • PointResponse
  • Region
  • RegionType
  • +
  • Station
  • +
  • StationsResponse
  • Urgency
  • @@ -2865,7 +2869,7 @@

    AlertOptions

    AlertOptions: UrgencyOption & XOR<AreaOption, XOR<PointOption, XOR<RegionOption, RegionTypeOption>>>
    @@ -2875,7 +2879,7 @@

    AlertsFeature

    AlertsFeature: { geometry: { coordinates: number[][]; type: "Polygon" }; id: string; properties: { areaDesc: string; description: string; effective: string; expries: string; sent: string } }
    @@ -2924,7 +2928,7 @@

    AlertsResponse

    AlertsResponse: { features: AlertsFeature[] }
    @@ -2942,7 +2946,7 @@

    Area

    Area: "AL" | "AK" | "AS" | "AR" | "AZ" | "CA" | "CO" | "CT" | "DE" | "DC" | "FL" | "GA" | "GU" | "HI" | "ID" | "IL" | "IN" | "IA" | "KS" | "KY" | "LA" | "ME" | "MD" | "MA" | "MI" | "MN" | "MS" | "MO" | "MT" | "NE" | "NV" | "NH" | "NJ" | "NM" | "NY" | "NC" | "ND" | "OH" | "OK" | "OR" | "PA" | "PR" | "RI" | "SC" | "SD" | "TN" | "TX" | "UT" | "VT" | "VI" | "VA" | "WA" | "WV" | "WI" | "WY" | "PZ" | "PK" | "PH" | "PS" | "PM" | "AN" | "AM" | "GM" | "LS" | "LM" | "LH" | "LC" | "LE" | "LO"
    @@ -2952,7 +2956,7 @@

    ClientOptions

    ClientOptions: { userAgent?: string }
    @@ -2970,7 +2974,7 @@

    ForecastProperties

    ForecastProperties: { elevation: { unitCode: string; value: number }; forecastGenerator: string; generatedAt: string; periods: ForecastPeriod[]; units: string; updateTime: string; updated: string; validTimes: string }
    @@ -3017,7 +3021,7 @@

    ForecastResponse

    ForecastResponse: { properties: ForecastProperties }
    @@ -3035,51 +3039,17 @@

    ForecastType

    ForecastType: "hourly" | "baseline"
    -
    - -

    ObservationResponse

    -
    ObservationResponse: { properties: { presentWeather: PresentWeather[]; temperature: { unitCode: string; value: number } } }
    - -
    -

    Type declaration

    -
      -
    • -
      properties: { presentWeather: PresentWeather[]; temperature: { unitCode: string; value: number } }
      -
        -
      • -
        presentWeather: PresentWeather[]
        -
      • -
      • -
        temperature: { unitCode: string; value: number }
        -
          -
        • -
          unitCode: string
          -
        • -
        • -
          value: number
          -
        • -
        -
      • -
      -
    • -
    -
    -

    PointResponse

    PointResponse: { properties: { forecast: string; forecastHourly: string; observationStations: string } }
    @@ -3108,7 +3078,7 @@

    Region

    Region: "AL" | "AT" | "GL" | "GM" | "PA" | "PI"
    @@ -3118,9 +3088,45 @@

    RegionType

    RegionType: "land" | "marine"
    + +
    + +

    Station

    +
    Station: { id: string }
    + +
    +

    Type declaration

    +
      +
    • +
      id: string
      +
    • +
    +
    +
    +
    + +

    StationsResponse

    +
    StationsResponse: { features: Station[] }
    + +
    +

    Type declaration

    + +
    @@ -3128,7 +3134,7 @@

    Urgency

    Urgency: "immediate" | "expected" | "future" | "past" | "unknown"
    diff --git a/docs/modules.html b/docs/modules.html index 0273c65..478e925 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -2731,9 +2731,6 @@
  • ForecastType
  • -
  • - ObservationResponse -
  • PointResponse
  • @@ -2743,6 +2740,12 @@
  • RegionType
  • +
  • + Station +
  • +
  • + StationsResponse +
  • Urgency
  • @@ -2846,10 +2849,11 @@

    Type aliases

  • ForecastProperties
  • ForecastResponse
  • ForecastType
  • -
  • ObservationResponse
  • PointResponse
  • Region
  • RegionType
  • +
  • Station
  • +
  • StationsResponse
  • Urgency
  • @@ -2864,7 +2868,7 @@

    AlertOptions

    AlertOptions: UrgencyOption & XOR<AreaOption, XOR<PointOption, XOR<RegionOption, RegionTypeOption>>>
    @@ -2874,7 +2878,7 @@

    AlertsFeature

    AlertsFeature: { geometry: { coordinates: number[][]; type: "Polygon" }; id: string; properties: { areaDesc: string; description: string; effective: string; expries: string; sent: string } }
    @@ -2923,7 +2927,7 @@

    AlertsResponse

    AlertsResponse: { features: AlertsFeature[] }
    @@ -2941,7 +2945,7 @@

    Area

    Area: "AL" | "AK" | "AS" | "AR" | "AZ" | "CA" | "CO" | "CT" | "DE" | "DC" | "FL" | "GA" | "GU" | "HI" | "ID" | "IL" | "IN" | "IA" | "KS" | "KY" | "LA" | "ME" | "MD" | "MA" | "MI" | "MN" | "MS" | "MO" | "MT" | "NE" | "NV" | "NH" | "NJ" | "NM" | "NY" | "NC" | "ND" | "OH" | "OK" | "OR" | "PA" | "PR" | "RI" | "SC" | "SD" | "TN" | "TX" | "UT" | "VT" | "VI" | "VA" | "WA" | "WV" | "WI" | "WY" | "PZ" | "PK" | "PH" | "PS" | "PM" | "AN" | "AM" | "GM" | "LS" | "LM" | "LH" | "LC" | "LE" | "LO"
    @@ -2951,7 +2955,7 @@

    ClientOptions

    ClientOptions: { userAgent?: string }
    @@ -2969,7 +2973,7 @@

    ForecastProperties

    ForecastProperties: { elevation: { unitCode: string; value: number }; forecastGenerator: string; generatedAt: string; periods: ForecastPeriod[]; units: string; updateTime: string; updated: string; validTimes: string }
    @@ -3016,7 +3020,7 @@

    ForecastResponse

    ForecastResponse: { properties: ForecastProperties }
    @@ -3034,51 +3038,17 @@

    ForecastType

    ForecastType: "hourly" | "baseline"
    -
    - -

    ObservationResponse

    -
    ObservationResponse: { properties: { presentWeather: PresentWeather[]; temperature: { unitCode: string; value: number } } }
    - -
    -

    Type declaration

    -
      -
    • -
      properties: { presentWeather: PresentWeather[]; temperature: { unitCode: string; value: number } }
      -
        -
      • -
        presentWeather: PresentWeather[]
        -
      • -
      • -
        temperature: { unitCode: string; value: number }
        -
          -
        • -
          unitCode: string
          -
        • -
        • -
          value: number
          -
        • -
        -
      • -
      -
    • -
    -
    -

    PointResponse

    PointResponse: { properties: { forecast: string; forecastHourly: string; observationStations: string } }
    @@ -3107,7 +3077,7 @@

    Region

    Region: "AL" | "AT" | "GL" | "GM" | "PA" | "PI"
    @@ -3117,9 +3087,45 @@

    RegionType

    RegionType: "land" | "marine"
    + +
    + +

    Station

    +
    Station: { id: string }
    + +
    +

    Type declaration

    +
      +
    • +
      id: string
      +
    • +
    +
    +
    +
    + +

    StationsResponse

    +
    StationsResponse: { features: Station[] }
    + +
    +

    Type declaration

    + +
    @@ -3127,7 +3133,7 @@

    Urgency

    Urgency: "immediate" | "expected" | "future" | "past" | "unknown"
    diff --git a/src/client.ts b/src/client.ts index 44fb5e1..909cfa6 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,7 +1,7 @@ import fetch from 'cross-fetch'; import { PointCache, StationsCache } from './cache'; -import { ClientOptions, PointResponse, ForecastResponse, AlertsResponse, ForecastType, StationsResponse, ObservationResponse, AlertOptions } from './types'; +import { ClientOptions, PointResponse, ForecastResponse, AlertsResponse, ForecastType, StationsResponse, Station, AlertOptions } from './types'; const defaultOptions: ClientOptions = { userAgent: 'weathered package' @@ -72,20 +72,6 @@ class Client { return pointResponse; } - private async getStations(url: string): Promise { - const potentionalStationsResponse = this.stationsCache.get(url); - - if (potentionalStationsResponse) { - console.log('stations hit'); - return potentionalStationsResponse; - } - console.log('stations miss'); - const stationsResponse = await this.getUrl(url); - this.stationsCache.set(url, stationsResponse); - - return stationsResponse; - } - getOptions(): ClientOptions { return {...this.options}; } @@ -95,7 +81,7 @@ class Client { } /** - * Get weather alerts for a given area + * Get weather alerts for a given area. * * ```typescript * const active = true; @@ -111,7 +97,7 @@ class Client { } /** - * Get a weather forecast for a given latitude and longitude + * Get a weather forecast for a given latitude and longitude. * * ```typescript * const latitude = 35.6175667; @@ -128,24 +114,48 @@ class Client { } /** - * Get the latest weather observations for a given latitude and longitude. - * This method finds the nearest observation station, which could be near - * or far, and returns its latest observation. + * Get the closest weather stations for a given latitude and longitude. * * ```typescript * const latitude = 35.6175667; * const longitude = -80.7709911; - * const observations = await client.getLatestObservations(latitude, longitude); + * const stations = await client.getStations(latitude, longitude); * ``` * */ - async getLatestObservations(latitude: number, longitude: number): Promise { + async getStations(latitude: number, longitude: number): Promise { const pointResponse = await this.getPoint(latitude, longitude); const stationsUrl = pointResponse.properties.observationStations; - const stationsResponse = await this.getStations(stationsUrl); - const observationsUrl = `${stationsResponse.features[0].id}/observations/latest`; - const observationResponse: ObservationResponse = await this.getUrl(observationsUrl); - return observationResponse; + + const potentionalStationsResponse = this.stationsCache.get(stationsUrl); + + if (potentionalStationsResponse) { + return potentionalStationsResponse; + } + + const stationsResponse = await this.getUrl(stationsUrl); + this.stationsCache.set(stationsUrl, stationsResponse); + + return stationsResponse; + } + + /** + * Get the closest weather station for a given latitude and longitude. + * + * ```typescript + * const latitude = 35.6175667; + * const longitude = -80.7709911; + * const stationOrNull = await client.getNearestStation(latitude, longitude); + * ``` + * + */ + async getNearestStation(latitude: number, longitude: number): Promise { + const stationsResponse = await this.getStations(latitude, longitude); + if (stationsResponse.features.length > 0) { + return stationsResponse.features[0]; + } + + return null; } } diff --git a/src/index.ts b/src/index.ts index c991c28..998a7cf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,3 @@ export { Client } from './client'; -export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, ForecastProperties, AlertsResponse, ObservationResponse, AlertsFeature } from './types'; +export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, ForecastProperties, AlertsResponse, Station, StationsResponse, AlertsFeature } from './types'; diff --git a/src/types.ts b/src/types.ts index d2c77a4..721326f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -128,4 +128,4 @@ type AlertsResponse = { features: AlertsFeature[]; } -export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, ForecastProperties, StationsResponse, ObservationResponse, AlertsResponse, AlertsFeature }; +export { ForecastType, Area, Region, RegionType, Urgency, AlertOptions, ClientOptions, PointResponse, ForecastResponse, ForecastProperties, Station, StationsResponse, AlertsResponse, AlertsFeature }; From 5eb80c5f3e5ce6856fabc9ad6626d6e7ce578356 Mon Sep 17 00:00:00 2001 From: Jason Sanford Date: Wed, 16 Jun 2021 15:16:32 -0400 Subject: [PATCH 6/8] Remove logging --- dist/client.js | 2 -- src/client.ts | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/dist/client.js b/dist/client.js index a3f6054..2faab59 100644 --- a/dist/client.js +++ b/dist/client.js @@ -48,10 +48,8 @@ class Client { const cacheKey = `${latitude},${longitude}`; const potentialPointResponse = this.pointCache.get(cacheKey); if (potentialPointResponse) { - console.log('point hit'); return potentialPointResponse; } - console.log('point miss'); const path = `points/${latitude},${longitude}`; const pointResponse = await this.getPath(path); this.pointCache.set(cacheKey, pointResponse); diff --git a/src/client.ts b/src/client.ts index 909cfa6..abebd17 100644 --- a/src/client.ts +++ b/src/client.ts @@ -60,12 +60,10 @@ class Client { const potentialPointResponse = this.pointCache.get(cacheKey); if (potentialPointResponse) { - console.log('point hit'); return potentialPointResponse; } - console.log('point miss'); - const path = `points/${latitude},${longitude}`; + const path = `points/${latitude},${longitude}`; const pointResponse = await this.getPath(path); this.pointCache.set(cacheKey, pointResponse); From 56b813d1f32e73ac2b5bb4612239c8409112b7e4 Mon Sep 17 00:00:00 2001 From: Jason Sanford Date: Wed, 16 Jun 2021 21:19:42 -0400 Subject: [PATCH 7/8] abstract class --- dist/cache.d.ts | 15 ++++----------- dist/cache.js | 21 ++++----------------- dist/client.js | 10 +++++++--- src/cache.ts | 30 ++++++------------------------ src/client.ts | 5 ++++- 5 files changed, 25 insertions(+), 56 deletions(-) diff --git a/dist/cache.d.ts b/dist/cache.d.ts index 1d2045d..fd35d7c 100644 --- a/dist/cache.d.ts +++ b/dist/cache.d.ts @@ -1,14 +1,7 @@ -import { PointResponse, StationsResponse } from './types'; -declare class PointCache { - private points; - constructor(); - get(key: string): PointResponse | undefined; - set(key: string, pointResponse: PointResponse): void; -} -declare class StationsCache { +declare abstract class Cache { private items; constructor(); - get(key: string): StationsResponse | undefined; - set(key: string, stationsResponse: StationsResponse): void; + get(key: string): T | undefined; + set(key: string, value: T): void; } -export { PointCache, StationsCache }; +export default Cache; diff --git a/dist/cache.js b/dist/cache.js index b1d8a53..e71b391 100644 --- a/dist/cache.js +++ b/dist/cache.js @@ -1,27 +1,14 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.StationsCache = exports.PointCache = void 0; -class PointCache { - constructor() { - this.points = {}; - } - get(key) { - return this.points[key]; - } - set(key, pointResponse) { - this.points[key] = pointResponse; - } -} -exports.PointCache = PointCache; -class StationsCache { +class Cache { constructor() { this.items = {}; } get(key) { return this.items[key]; } - set(key, stationsResponse) { - this.items[key] = stationsResponse; + set(key, value) { + this.items[key] = value; } } -exports.StationsCache = StationsCache; +exports.default = Cache; diff --git a/dist/client.js b/dist/client.js index 2faab59..2b852bb 100644 --- a/dist/client.js +++ b/dist/client.js @@ -5,7 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); exports.Client = void 0; const cross_fetch_1 = __importDefault(require("cross-fetch")); -const cache_1 = require("./cache"); +const cache_1 = __importDefault(require("./cache")); +class PointCache extends cache_1.default { +} +class StationsCache extends cache_1.default { +} const defaultOptions = { userAgent: 'weathered package' }; @@ -34,8 +38,8 @@ const processOptions = (options) => { class Client { constructor(options) { this.options = { ...defaultOptions, ...options }; - this.pointCache = new cache_1.PointCache(); - this.stationsCache = new cache_1.StationsCache(); + this.pointCache = new PointCache(); + this.stationsCache = new StationsCache(); } getPath(path) { return this.getUrl(API_ROOT + path); diff --git a/src/cache.ts b/src/cache.ts index dea5589..fb0a795 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -1,35 +1,17 @@ -import { PointResponse, StationsResponse } from './types'; - -class PointCache { - private points: { [key: string]: PointResponse; }; - - constructor() { - this.points = {}; - } - - get(key: string): PointResponse | undefined { - return this.points[key]; - } - - set(key: string, pointResponse: PointResponse): void { - this.points[key] = pointResponse; - } -} - -class StationsCache { - private items: { [key: string]: StationsResponse; }; +abstract class Cache { + private items: { [key: string]: T; }; constructor() { this.items = {}; } - get(key: string): StationsResponse | undefined { + get(key: string): T | undefined { return this.items[key]; } - set(key: string, stationsResponse: StationsResponse): void { - this.items[key] = stationsResponse; + set(key: string, value: T): void { + this.items[key] = value; } } -export { PointCache, StationsCache }; +export default Cache; diff --git a/src/client.ts b/src/client.ts index abebd17..cddd488 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,8 +1,11 @@ import fetch from 'cross-fetch'; -import { PointCache, StationsCache } from './cache'; +import Cache from './cache'; import { ClientOptions, PointResponse, ForecastResponse, AlertsResponse, ForecastType, StationsResponse, Station, AlertOptions } from './types'; +class PointCache extends Cache{} +class StationsCache extends Cache{} + const defaultOptions: ClientOptions = { userAgent: 'weathered package' }; From e5f4a98657b549b629f6e9e04e5fdf491b26ab8a Mon Sep 17 00:00:00 2001 From: Jason Sanford Date: Thu, 17 Jun 2021 09:13:42 -0400 Subject: [PATCH 8/8] Fix up cache --- dist/cache.d.ts | 2 +- dist/client.js | 8 ++------ src/cache.ts | 2 +- src/client.ts | 11 ++++------- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/dist/cache.d.ts b/dist/cache.d.ts index fd35d7c..14fc118 100644 --- a/dist/cache.d.ts +++ b/dist/cache.d.ts @@ -1,4 +1,4 @@ -declare abstract class Cache { +declare class Cache { private items; constructor(); get(key: string): T | undefined; diff --git a/dist/client.js b/dist/client.js index 2b852bb..6ef5857 100644 --- a/dist/client.js +++ b/dist/client.js @@ -6,10 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.Client = void 0; const cross_fetch_1 = __importDefault(require("cross-fetch")); const cache_1 = __importDefault(require("./cache")); -class PointCache extends cache_1.default { -} -class StationsCache extends cache_1.default { -} const defaultOptions = { userAgent: 'weathered package' }; @@ -38,8 +34,8 @@ const processOptions = (options) => { class Client { constructor(options) { this.options = { ...defaultOptions, ...options }; - this.pointCache = new PointCache(); - this.stationsCache = new StationsCache(); + this.pointCache = new cache_1.default(); + this.stationsCache = new cache_1.default(); } getPath(path) { return this.getUrl(API_ROOT + path); diff --git a/src/cache.ts b/src/cache.ts index fb0a795..f0d701c 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -1,4 +1,4 @@ -abstract class Cache { +class Cache { private items: { [key: string]: T; }; constructor() { diff --git a/src/client.ts b/src/client.ts index cddd488..8400ee4 100644 --- a/src/client.ts +++ b/src/client.ts @@ -3,9 +3,6 @@ import fetch from 'cross-fetch'; import Cache from './cache'; import { ClientOptions, PointResponse, ForecastResponse, AlertsResponse, ForecastType, StationsResponse, Station, AlertOptions } from './types'; -class PointCache extends Cache{} -class StationsCache extends Cache{} - const defaultOptions: ClientOptions = { userAgent: 'weathered package' }; @@ -40,13 +37,13 @@ const processOptions = (options: AlertOptions) => { */ class Client { private options: ClientOptions; - private pointCache: PointCache; - private stationsCache: StationsCache; + private pointCache: Cache; + private stationsCache: Cache; constructor(options?: ClientOptions) { this.options = {...defaultOptions, ...options}; - this.pointCache = new PointCache(); - this.stationsCache = new StationsCache(); + this.pointCache = new Cache(); + this.stationsCache = new Cache(); } private getPath(path: string) {