@telemetryos/root-sdk 1.8.3 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/client.d.ts +7 -1
- package/dist/devices.d.ts +16 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +16 -3
- package/dist/index.js +405 -241
- package/dist/mqtt.d.ts +43 -0
- package/dist/weather.d.ts +324 -111
- package/package.json +1 -1
package/dist/mqtt.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Client, type MessageHandler } from './client.js';
|
|
2
|
+
export type MqttBrokerInfo = {
|
|
3
|
+
name: string;
|
|
4
|
+
address: string;
|
|
5
|
+
port: number;
|
|
6
|
+
protocol: 'mqtt' | 'mqtts' | 'ws' | 'wss';
|
|
7
|
+
};
|
|
8
|
+
export type MqttConnectOptions = {
|
|
9
|
+
username?: string;
|
|
10
|
+
password?: string;
|
|
11
|
+
clientId?: string;
|
|
12
|
+
keepalive?: number;
|
|
13
|
+
clean?: boolean;
|
|
14
|
+
reconnectPeriod?: number;
|
|
15
|
+
connectTimeout?: number;
|
|
16
|
+
};
|
|
17
|
+
export type MqttPublishOptions = {
|
|
18
|
+
qos?: 0 | 1 | 2;
|
|
19
|
+
retain?: boolean;
|
|
20
|
+
};
|
|
21
|
+
export type MqttSubscribeOptions = {
|
|
22
|
+
qos?: 0 | 1 | 2;
|
|
23
|
+
};
|
|
24
|
+
export type MqttConnectionStatus = 'connected' | 'disconnected' | 'connecting' | 'reconnecting' | 'error';
|
|
25
|
+
export type MqttMessage = {
|
|
26
|
+
topic: string;
|
|
27
|
+
payload: string;
|
|
28
|
+
qos: 0 | 1 | 2;
|
|
29
|
+
retain: boolean;
|
|
30
|
+
};
|
|
31
|
+
export declare class Mqtt {
|
|
32
|
+
_client: Client;
|
|
33
|
+
constructor(client: Client);
|
|
34
|
+
discover(): Promise<MqttBrokerInfo[]>;
|
|
35
|
+
connect(brokerUrl: string, options?: MqttConnectOptions): Promise<string>;
|
|
36
|
+
disconnect(clientId: string): Promise<void>;
|
|
37
|
+
publish(clientId: string, topic: string, payload: string, options?: MqttPublishOptions): Promise<void>;
|
|
38
|
+
subscribe(clientId: string, topic: string, handler: MessageHandler<MqttMessage>, options?: MqttSubscribeOptions): Promise<boolean>;
|
|
39
|
+
unsubscribe(clientId: string, topic: string, handler?: MessageHandler<MqttMessage>): Promise<boolean>;
|
|
40
|
+
getConnectionStatus(clientId: string): Promise<MqttConnectionStatus>;
|
|
41
|
+
subscribeConnectionStatus(clientId: string, handler: MessageHandler<MqttConnectionStatus>): Promise<boolean>;
|
|
42
|
+
unsubscribeConnectionStatus(clientId: string, handler?: MessageHandler<MqttConnectionStatus>): Promise<boolean>;
|
|
43
|
+
}
|
package/dist/weather.d.ts
CHANGED
|
@@ -1,165 +1,378 @@
|
|
|
1
1
|
import type { Client } from './client.js';
|
|
2
2
|
/**
|
|
3
|
-
* Weather
|
|
3
|
+
* Weather location information shared across all weather endpoints
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/** Timezone */
|
|
15
|
-
Timezone: string;
|
|
16
|
-
/** Weather description text */
|
|
17
|
-
WeatherText: string;
|
|
18
|
-
/** State/Province */
|
|
19
|
-
State: string;
|
|
20
|
-
/** Part of day (day/night indicator) */
|
|
21
|
-
Pod: string;
|
|
22
|
-
/** Weather code (internal mapping) */
|
|
23
|
-
WeatherCode: string;
|
|
24
|
-
/** Wind direction in degrees */
|
|
25
|
-
WindDirectionDegrees: string;
|
|
26
|
-
/** Wind direction (cardinal direction in English) */
|
|
27
|
-
WindDirectionEnglish: string;
|
|
28
|
-
/** Wind direction (localized) */
|
|
29
|
-
WindDirectionLocalized: string;
|
|
30
|
-
/** Relative humidity percentage */
|
|
31
|
-
RelativeHumidity: number;
|
|
32
|
-
/** Unix timestamp */
|
|
33
|
-
Timestamp: number;
|
|
34
|
-
/** Longitude */
|
|
35
|
-
Longitude: number;
|
|
36
|
-
/** Latitude */
|
|
37
|
-
Latitude: number;
|
|
38
|
-
/** Temperature */
|
|
39
|
-
Temp: number;
|
|
40
|
-
/** Atmospheric pressure */
|
|
41
|
-
Pressure: number;
|
|
42
|
-
/** Wind speed */
|
|
43
|
-
WindSpeed: number;
|
|
44
|
-
/** Visibility distance */
|
|
45
|
-
Visibility: number;
|
|
46
|
-
/** Precipitation amount */
|
|
47
|
-
Precip: number;
|
|
5
|
+
type WeatherLocation = {
|
|
6
|
+
latitude: number;
|
|
7
|
+
longitude: number;
|
|
8
|
+
cityName: string;
|
|
9
|
+
stateName?: string;
|
|
10
|
+
stateCode?: string;
|
|
11
|
+
countryName: string;
|
|
12
|
+
countryCode: string;
|
|
13
|
+
timezone: string;
|
|
48
14
|
};
|
|
49
15
|
/**
|
|
50
|
-
*
|
|
16
|
+
* Current weather conditions
|
|
51
17
|
*/
|
|
52
|
-
export type
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
18
|
+
export type WeatherPartOfDay = 'day' | 'night';
|
|
19
|
+
export type WeatherConditions = WeatherLocation & {
|
|
20
|
+
observedAtSec: number;
|
|
21
|
+
observedAtLocal: string;
|
|
22
|
+
sunrise: string;
|
|
23
|
+
sunset: string;
|
|
24
|
+
partOfDay: WeatherPartOfDay;
|
|
25
|
+
weatherCode: number;
|
|
26
|
+
weatherDescription: string;
|
|
27
|
+
weatherIcon: string;
|
|
28
|
+
temperatureC: number;
|
|
29
|
+
temperatureF: number;
|
|
30
|
+
temperatureFeelsLikeC: number;
|
|
31
|
+
temperatureFeelsLikeF: number;
|
|
32
|
+
dewPointC: number;
|
|
33
|
+
dewPointF: number;
|
|
34
|
+
windSpeedKph: number;
|
|
35
|
+
windSpeedMph: number;
|
|
36
|
+
gustSpeedKph: number;
|
|
37
|
+
gustSpeedMph: number;
|
|
38
|
+
windDirectionDeg: number;
|
|
39
|
+
windDirectionFull: string;
|
|
40
|
+
windDirectionShort: string;
|
|
41
|
+
pressureMb: number;
|
|
42
|
+
pressureInHg: number;
|
|
43
|
+
seaLevelPressureMb: number;
|
|
44
|
+
seaLevelPressureInHg: number;
|
|
45
|
+
visibilityKm: number;
|
|
46
|
+
visibilityMi: number;
|
|
47
|
+
humidity: number;
|
|
48
|
+
clouds: number;
|
|
49
|
+
precipitationRateMmph: number;
|
|
50
|
+
precipitationRateInph: number;
|
|
51
|
+
snowfallRateMmph: number;
|
|
52
|
+
snowfallRateInph: number;
|
|
53
|
+
uvIndex: number;
|
|
54
|
+
airQualityIndex: number;
|
|
69
55
|
};
|
|
70
56
|
/**
|
|
71
|
-
*
|
|
57
|
+
* Single day of forecast data
|
|
72
58
|
*/
|
|
73
|
-
export type
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
59
|
+
export type DailyForecastData = {
|
|
60
|
+
forecastDate: string;
|
|
61
|
+
forecastDateSec: number;
|
|
62
|
+
weatherCode: number;
|
|
63
|
+
weatherDescription: string;
|
|
64
|
+
weatherIcon: string;
|
|
65
|
+
precipitationProbability: number;
|
|
66
|
+
temperatureC: number;
|
|
67
|
+
temperatureF: number;
|
|
68
|
+
maxTemperatureC: number;
|
|
69
|
+
maxTemperatureF: number;
|
|
70
|
+
minTemperatureC: number;
|
|
71
|
+
minTemperatureF: number;
|
|
72
|
+
highTemperatureC: number;
|
|
73
|
+
highTemperatureF: number;
|
|
74
|
+
lowTemperatureC: number;
|
|
75
|
+
lowTemperatureF: number;
|
|
76
|
+
maxTemperatureFeelsLikeC: number;
|
|
77
|
+
maxTemperatureFeelsLikeF: number;
|
|
78
|
+
minTemperatureFeelsLikeC: number;
|
|
79
|
+
minTemperatureFeelsLikeF: number;
|
|
80
|
+
dewPointC: number;
|
|
81
|
+
dewPointF: number;
|
|
82
|
+
windSpeedKph: number;
|
|
83
|
+
windSpeedMph: number;
|
|
84
|
+
gustSpeedKph: number;
|
|
85
|
+
gustSpeedMph: number;
|
|
86
|
+
windDirectionDeg: number;
|
|
87
|
+
windDirectionFull: string;
|
|
88
|
+
windDirectionShort: string;
|
|
89
|
+
pressureMb: number;
|
|
90
|
+
pressureInHg: number;
|
|
91
|
+
seaLevelPressureMb: number;
|
|
92
|
+
seaLevelPressureInHg: number;
|
|
93
|
+
visibilityKm: number;
|
|
94
|
+
visibilityMi: number;
|
|
95
|
+
humidity: number;
|
|
96
|
+
clouds: number;
|
|
97
|
+
precipitationMm: number;
|
|
98
|
+
precipitationIn: number;
|
|
99
|
+
snowfallMm: number;
|
|
100
|
+
snowfallIn: number;
|
|
101
|
+
snowDepthMm: number;
|
|
102
|
+
snowDepthIn: number;
|
|
103
|
+
uvIndex: number;
|
|
104
|
+
sunrise: string;
|
|
105
|
+
sunset: string;
|
|
106
|
+
moonrise: string;
|
|
107
|
+
moonset: string;
|
|
108
|
+
moonIllumination: number;
|
|
109
|
+
moonLunationPhase: number;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Daily weather forecast with location
|
|
113
|
+
*/
|
|
114
|
+
export type DailyForecast = WeatherLocation & {
|
|
115
|
+
data: DailyForecastData[];
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Single hour of forecast data
|
|
119
|
+
*/
|
|
120
|
+
export type HourlyForecastData = {
|
|
121
|
+
forecastTimeSec: number;
|
|
122
|
+
forecastTimeLocal: string;
|
|
123
|
+
forecastTimeUtc: string;
|
|
124
|
+
partOfDay: WeatherPartOfDay;
|
|
125
|
+
weatherCode: number;
|
|
126
|
+
weatherDescription: string;
|
|
127
|
+
weatherIcon: string;
|
|
128
|
+
precipitationProbability: number;
|
|
129
|
+
temperatureC: number;
|
|
130
|
+
temperatureF: number;
|
|
131
|
+
temperatureFeelsLikeC: number;
|
|
132
|
+
temperatureFeelsLikeF: number;
|
|
133
|
+
dewPointC: number;
|
|
134
|
+
dewPointF: number;
|
|
135
|
+
windSpeedKph: number;
|
|
136
|
+
windSpeedMph: number;
|
|
137
|
+
gustSpeedKph: number;
|
|
138
|
+
gustSpeedMph: number;
|
|
139
|
+
windDirectionDeg: number;
|
|
140
|
+
windDirectionFull: string;
|
|
141
|
+
windDirectionShort: string;
|
|
142
|
+
pressureMb: number;
|
|
143
|
+
pressureInHg: number;
|
|
144
|
+
seaLevelPressureMb: number;
|
|
145
|
+
seaLevelPressureInHg: number;
|
|
146
|
+
visibilityKm: number;
|
|
147
|
+
visibilityMi: number;
|
|
148
|
+
humidity: number;
|
|
149
|
+
clouds: number;
|
|
150
|
+
precipitationMm: number;
|
|
151
|
+
precipitationIn: number;
|
|
152
|
+
snowfallMm: number;
|
|
153
|
+
snowfallIn: number;
|
|
154
|
+
snowDepthMm: number;
|
|
155
|
+
snowDepthIn: number;
|
|
156
|
+
uvIndex: number;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Hourly weather forecast with location
|
|
160
|
+
*/
|
|
161
|
+
export type HourlyForecast = WeatherLocation & {
|
|
162
|
+
data: HourlyForecastData[];
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Single weather alert/warning
|
|
166
|
+
*/
|
|
167
|
+
export type WeatherAlertSeverity = 'Advisory' | 'Watch' | 'Warning';
|
|
168
|
+
export type WeatherAlert = {
|
|
169
|
+
title: string;
|
|
170
|
+
description: string;
|
|
171
|
+
severity: WeatherAlertSeverity;
|
|
172
|
+
effectiveSec: number;
|
|
173
|
+
effectiveUtc: string;
|
|
174
|
+
effectiveLocal: string;
|
|
175
|
+
expiresSec: number;
|
|
176
|
+
expiresUtc: string;
|
|
177
|
+
expiresLocal: string;
|
|
178
|
+
onsetSec?: number;
|
|
179
|
+
onsetUtc?: string;
|
|
180
|
+
onsetLocal?: string;
|
|
181
|
+
endsSec?: number;
|
|
182
|
+
endsUtc?: string;
|
|
183
|
+
endsLocal?: string;
|
|
184
|
+
uri: string;
|
|
185
|
+
regions: string[];
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* Weather alerts with location
|
|
189
|
+
*/
|
|
190
|
+
export type WeatherAlerts = WeatherLocation & {
|
|
191
|
+
alerts: WeatherAlert[];
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* City information for location search
|
|
195
|
+
*/
|
|
196
|
+
export type WeatherCity = {
|
|
197
|
+
cityId: number;
|
|
198
|
+
cityName: string;
|
|
199
|
+
stateName?: string;
|
|
200
|
+
stateCode?: string;
|
|
201
|
+
countryName: string;
|
|
202
|
+
countryCode: string;
|
|
203
|
+
latitude: number;
|
|
204
|
+
longitude: number;
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* Parameters for getting current weather conditions
|
|
208
|
+
*/
|
|
209
|
+
export type WeatherConditionsParams = {
|
|
210
|
+
/** WeatherBit city ID (required) */
|
|
211
|
+
cityId: number;
|
|
212
|
+
/** Language code for localized responses (optional) */
|
|
85
213
|
language?: string;
|
|
86
214
|
};
|
|
87
215
|
/**
|
|
88
|
-
* Parameters for daily forecast
|
|
216
|
+
* Parameters for getting daily forecast
|
|
89
217
|
*/
|
|
90
|
-
export type DailyForecastParams =
|
|
91
|
-
/**
|
|
218
|
+
export type DailyForecastParams = {
|
|
219
|
+
/** WeatherBit city ID (required) */
|
|
220
|
+
cityId: number;
|
|
221
|
+
/** Language code for localized responses (optional) */
|
|
222
|
+
language?: string;
|
|
223
|
+
/** Number of days to forecast, max 16 (optional, default 5) */
|
|
92
224
|
days?: number;
|
|
93
225
|
};
|
|
94
226
|
/**
|
|
95
|
-
* Parameters for hourly forecast
|
|
227
|
+
* Parameters for getting hourly forecast
|
|
96
228
|
*/
|
|
97
|
-
export type HourlyForecastParams =
|
|
98
|
-
/**
|
|
229
|
+
export type HourlyForecastParams = {
|
|
230
|
+
/** WeatherBit city ID (required) */
|
|
231
|
+
cityId: number;
|
|
232
|
+
/** Language code for localized responses (optional) */
|
|
233
|
+
language?: string;
|
|
234
|
+
/** Number of hours to forecast, max 120 (optional, default 12) */
|
|
99
235
|
hours?: number;
|
|
100
236
|
};
|
|
237
|
+
/**
|
|
238
|
+
* Parameters for getting weather alerts
|
|
239
|
+
*/
|
|
240
|
+
export type WeatherAlertsParams = {
|
|
241
|
+
/** WeatherBit city ID (required) */
|
|
242
|
+
cityId: number;
|
|
243
|
+
/** Language code for localized responses (optional) */
|
|
244
|
+
language?: string;
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Parameters for searching cities
|
|
248
|
+
*/
|
|
249
|
+
export type CitiesSearchParams = {
|
|
250
|
+
/** ISO country code filter (optional) */
|
|
251
|
+
countryCode?: string;
|
|
252
|
+
/** City name search query (optional) */
|
|
253
|
+
search?: string;
|
|
254
|
+
};
|
|
101
255
|
/**
|
|
102
256
|
* Weather API for retrieving weather data
|
|
103
257
|
*
|
|
104
|
-
* Provides access to current conditions
|
|
258
|
+
* Provides access to current conditions, forecasts, alerts, and city search
|
|
259
|
+
* through the TelemetryOS weather API v2.
|
|
105
260
|
*/
|
|
106
261
|
export declare class Weather {
|
|
107
262
|
_client: Client;
|
|
108
263
|
constructor(client: Client);
|
|
109
264
|
/**
|
|
110
|
-
*
|
|
265
|
+
* Searches for cities by name or country
|
|
266
|
+
*
|
|
267
|
+
* @param params - Search parameters including optional country code and search query
|
|
268
|
+
* @returns A promise that resolves to an array of matching cities
|
|
269
|
+
* @throws {Error} If the request fails
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```typescript
|
|
273
|
+
* // Search for cities named "New York"
|
|
274
|
+
* const cities = await weather.getCities({ search: 'New York' })
|
|
275
|
+
*
|
|
276
|
+
* // Search for cities in the United States
|
|
277
|
+
* const cities = await weather.getCities({ countryCode: 'US' })
|
|
278
|
+
*
|
|
279
|
+
* // Get a cityId for use in other methods
|
|
280
|
+
* const cities = await weather.getCities({ search: 'London' })
|
|
281
|
+
* const cityId = cities[0].cityId
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
284
|
+
getCities(params: CitiesSearchParams): Promise<WeatherCity[]>;
|
|
285
|
+
/**
|
|
286
|
+
* Retrieves current weather conditions for a specified city
|
|
111
287
|
*
|
|
112
|
-
* @param params - Weather request parameters including
|
|
113
|
-
* @returns A promise that resolves to the current weather conditions
|
|
114
|
-
* @throws {Error} If the request fails or
|
|
288
|
+
* @param params - Weather request parameters including cityId and optional language
|
|
289
|
+
* @returns A promise that resolves to the current weather conditions with dual units (C/F, kph/mph, etc.)
|
|
290
|
+
* @throws {Error} If the request fails or cityId is invalid
|
|
115
291
|
*
|
|
116
292
|
* @example
|
|
117
293
|
* ```typescript
|
|
118
|
-
* // Get
|
|
119
|
-
* const
|
|
294
|
+
* // Get current conditions for a city
|
|
295
|
+
* const conditions = await weather.getConditions({ cityId: 12345 })
|
|
120
296
|
*
|
|
121
|
-
* //
|
|
122
|
-
* const
|
|
297
|
+
* // With localized language
|
|
298
|
+
* const conditions = await weather.getConditions({
|
|
299
|
+
* cityId: 12345,
|
|
300
|
+
* language: 'es'
|
|
301
|
+
* })
|
|
123
302
|
*
|
|
124
|
-
* //
|
|
125
|
-
*
|
|
303
|
+
* // Access both units
|
|
304
|
+
* console.log(`${conditions.temperatureC}°C / ${conditions.temperatureF}°F`)
|
|
305
|
+
* console.log(`${conditions.windSpeedKph} kph / ${conditions.windSpeedMph} mph`)
|
|
126
306
|
* ```
|
|
127
307
|
*/
|
|
128
|
-
getConditions(params:
|
|
308
|
+
getConditions(params: WeatherConditionsParams): Promise<WeatherConditions>;
|
|
129
309
|
/**
|
|
130
|
-
* Retrieves daily weather forecast for a specified
|
|
310
|
+
* Retrieves daily weather forecast for a specified city
|
|
131
311
|
*
|
|
132
|
-
* @param params - Forecast request parameters including
|
|
133
|
-
* @returns A promise that resolves to
|
|
134
|
-
* @throws {Error} If the request fails or
|
|
312
|
+
* @param params - Forecast request parameters including cityId, optional language and days
|
|
313
|
+
* @returns A promise that resolves to daily forecast data with location information
|
|
314
|
+
* @throws {Error} If the request fails or cityId is invalid
|
|
135
315
|
*
|
|
136
316
|
* @example
|
|
137
317
|
* ```typescript
|
|
138
318
|
* // Get 5-day forecast
|
|
139
|
-
* const forecast = await weather.getDailyForecast({
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
319
|
+
* const forecast = await weather.getDailyForecast({ cityId: 12345 })
|
|
320
|
+
*
|
|
321
|
+
* // Get 10-day forecast
|
|
322
|
+
* const forecast = await weather.getDailyForecast({ cityId: 12345, days: 10 })
|
|
323
|
+
*
|
|
324
|
+
* // Access forecast data
|
|
325
|
+
* forecast.data.forEach(day => {
|
|
326
|
+
* console.log(`${day.forecastDate}: ${day.weatherDescription}`)
|
|
327
|
+
* console.log(`High: ${day.maxTemperatureC}°C, Low: ${day.minTemperatureC}°C`)
|
|
143
328
|
* })
|
|
144
329
|
* ```
|
|
145
330
|
*/
|
|
146
|
-
getDailyForecast(params: DailyForecastParams): Promise<
|
|
331
|
+
getDailyForecast(params: DailyForecastParams): Promise<DailyForecast>;
|
|
147
332
|
/**
|
|
148
|
-
* Retrieves hourly weather forecast for a specified
|
|
333
|
+
* Retrieves hourly weather forecast for a specified city
|
|
149
334
|
*
|
|
150
|
-
* @param params - Forecast request parameters including
|
|
151
|
-
* @returns A promise that resolves to
|
|
152
|
-
* @throws {Error} If the request fails or
|
|
335
|
+
* @param params - Forecast request parameters including cityId, optional language and hours
|
|
336
|
+
* @returns A promise that resolves to hourly forecast data with location information
|
|
337
|
+
* @throws {Error} If the request fails or cityId is invalid
|
|
153
338
|
*
|
|
154
339
|
* @example
|
|
155
340
|
* ```typescript
|
|
156
341
|
* // Get 24-hour forecast
|
|
157
|
-
* const forecast = await weather.getHourlyForecast({
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
342
|
+
* const forecast = await weather.getHourlyForecast({ cityId: 12345, hours: 24 })
|
|
343
|
+
*
|
|
344
|
+
* // Get 48-hour forecast
|
|
345
|
+
* const forecast = await weather.getHourlyForecast({ cityId: 12345, hours: 48 })
|
|
346
|
+
*
|
|
347
|
+
* // Access forecast data
|
|
348
|
+
* forecast.data.forEach(hour => {
|
|
349
|
+
* console.log(`${hour.forecastTimeLocal}: ${hour.weatherDescription}`)
|
|
350
|
+
* console.log(`Temp: ${hour.temperatureC}°C`)
|
|
161
351
|
* })
|
|
162
352
|
* ```
|
|
163
353
|
*/
|
|
164
|
-
getHourlyForecast(params: HourlyForecastParams): Promise<
|
|
354
|
+
getHourlyForecast(params: HourlyForecastParams): Promise<HourlyForecast>;
|
|
355
|
+
/**
|
|
356
|
+
* Retrieves weather alerts and warnings for a specified city
|
|
357
|
+
*
|
|
358
|
+
* @param params - Alert request parameters including cityId and optional language
|
|
359
|
+
* @returns A promise that resolves to weather alerts with location information
|
|
360
|
+
* @throws {Error} If the request fails or cityId is invalid
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```typescript
|
|
364
|
+
* // Get weather alerts for a city
|
|
365
|
+
* const alerts = await weather.getAlerts({ cityId: 12345 })
|
|
366
|
+
*
|
|
367
|
+
* // Check if there are any active alerts
|
|
368
|
+
* if (alerts.alerts.length > 0) {
|
|
369
|
+
* alerts.alerts.forEach(alert => {
|
|
370
|
+
* console.log(`${alert.severity}: ${alert.title}`)
|
|
371
|
+
* console.log(alert.description)
|
|
372
|
+
* })
|
|
373
|
+
* }
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
getAlerts(params: WeatherAlertsParams): Promise<WeatherAlerts>;
|
|
165
377
|
}
|
|
378
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telemetryos/root-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "The official TelemetryOS root application sdk package. Provides types and apis for building root TelemetryOS applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|