@mharj/openweathermap 0.1.1 → 0.1.2
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/dist/index.cjs +967 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +650 -0
- package/dist/index.d.mts +476 -467
- package/dist/index.mjs +911 -860
- package/dist/index.mjs.map +1 -1
- package/package.json +52 -46
- package/dist/index.d.ts +0 -641
- package/dist/index.js +0 -942
- package/dist/index.js.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { IOption, IResult } from "@luolapeikko/result-option";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { IAsyncCache } from "@luolapeikko/cache-types";
|
|
4
|
+
import { Loadable } from "@luolapeikko/ts-common";
|
|
5
5
|
|
|
6
|
+
//#region src/types/v2/Icon.d.ts
|
|
6
7
|
/**
|
|
7
8
|
* @internal
|
|
8
9
|
*/
|
|
@@ -18,234 +19,236 @@ type NightIcon = z.infer<typeof nightIconListSchema>;
|
|
|
18
19
|
*/
|
|
19
20
|
declare const iconSchema: z.ZodUnion<[z.ZodEnum<["01d", "02d", "03d", "04d", "09d", "10d", "11d", "13d", "50d"]>, z.ZodEnum<["01n", "02n", "03n", "04n", "09n", "10n", "11n", "13n", "50n"]>]>;
|
|
20
21
|
type Icon = z.infer<typeof iconSchema>;
|
|
21
|
-
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/types/v2/Language.d.ts
|
|
22
24
|
declare const langCodes: readonly ["af", "al", "ar", "az", "bg", "ca", "cz", "da", "de", "el", "en", "eu", "fa", "fi", "fr", "gl", "he", "hi", "hr", "hu", "id", "it", "ja", "kr", "la", "lt", "mk", "no", "nl", "pl", "pt", "pt", "ro", "ru", "sv", "sk", "sl", "sp", "sr", "th", "tr", "ua", "vi", "zh_cn", "zh_tw", "zu"];
|
|
23
25
|
declare const langCodeSchema: z.ZodEnum<["af", "al", "ar", "az", "bg", "ca", "cz", "da", "de", "el", "en", "eu", "fa", "fi", "fr", "gl", "he", "hi", "hr", "hu", "id", "it", "ja", "kr", "la", "lt", "mk", "no", "nl", "pl", "pt", "pt", "ro", "ru", "sv", "sk", "sl", "sp", "sr", "th", "tr", "ua", "vi", "zh_cn", "zh_tw", "zu"]>;
|
|
24
26
|
type LangCode = z.infer<typeof langCodeSchema>;
|
|
25
|
-
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/types/v2/weatherIdGroup.d.ts
|
|
26
29
|
/**
|
|
27
30
|
* This is a list of weather ids, groups and descriptions from OpenWeatherMap API
|
|
28
31
|
*/
|
|
29
32
|
declare const weatherIdGroup: readonly [{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
readonly id: 200;
|
|
34
|
+
readonly group: "thunderstorm";
|
|
35
|
+
readonly description: "thunderstorm_with_light_rain";
|
|
33
36
|
}, {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
readonly id: 201;
|
|
38
|
+
readonly group: "thunderstorm";
|
|
39
|
+
readonly description: "thunderstorm_with_rain";
|
|
37
40
|
}, {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
readonly id: 202;
|
|
42
|
+
readonly group: "thunderstorm";
|
|
43
|
+
readonly description: "thunderstorm_with_heavy_rain";
|
|
41
44
|
}, {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
readonly id: 210;
|
|
46
|
+
readonly group: "thunderstorm";
|
|
47
|
+
readonly description: "light_thunderstorm";
|
|
45
48
|
}, {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
readonly id: 211;
|
|
50
|
+
readonly group: "thunderstorm";
|
|
51
|
+
readonly description: "thunderstorm";
|
|
49
52
|
}, {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
readonly id: 212;
|
|
54
|
+
readonly group: "thunderstorm";
|
|
55
|
+
readonly description: "heavy_thunderstorm";
|
|
53
56
|
}, {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
readonly id: 221;
|
|
58
|
+
readonly group: "thunderstorm";
|
|
59
|
+
readonly description: "ragged_thunderstorm";
|
|
57
60
|
}, {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
readonly id: 230;
|
|
62
|
+
readonly group: "thunderstorm";
|
|
63
|
+
readonly description: "thunderstorm_with_light_drizzle";
|
|
61
64
|
}, {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
readonly id: 231;
|
|
66
|
+
readonly group: "thunderstorm";
|
|
67
|
+
readonly description: "thunderstorm_with_drizzle";
|
|
65
68
|
}, {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
readonly id: 232;
|
|
70
|
+
readonly group: "thunderstorm";
|
|
71
|
+
readonly description: "thunderstorm_with_heavy_drizzle";
|
|
69
72
|
}, {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
readonly id: 300;
|
|
74
|
+
readonly group: "drizzle";
|
|
75
|
+
readonly description: "light_intensity_drizzle";
|
|
73
76
|
}, {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
readonly id: 301;
|
|
78
|
+
readonly group: "drizzle";
|
|
79
|
+
readonly description: "drizzle";
|
|
77
80
|
}, {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
readonly id: 302;
|
|
82
|
+
readonly group: "drizzle";
|
|
83
|
+
readonly description: "heavy_intensity_drizzle";
|
|
81
84
|
}, {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
readonly id: 310;
|
|
86
|
+
readonly group: "drizzle";
|
|
87
|
+
readonly description: "light_intensity_drizzle_rain";
|
|
85
88
|
}, {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
readonly id: 311;
|
|
90
|
+
readonly group: "drizzle";
|
|
91
|
+
readonly description: "drizzle_rain";
|
|
89
92
|
}, {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
+
readonly id: 312;
|
|
94
|
+
readonly group: "drizzle";
|
|
95
|
+
readonly description: "heavy_intensity_drizzle_rain";
|
|
93
96
|
}, {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
readonly id: 313;
|
|
98
|
+
readonly group: "drizzle";
|
|
99
|
+
readonly description: "shower_rain_and_drizzle";
|
|
97
100
|
}, {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
readonly id: 314;
|
|
102
|
+
readonly group: "drizzle";
|
|
103
|
+
readonly description: "heavy_shower_rain_and_drizzle";
|
|
101
104
|
}, {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
readonly id: 321;
|
|
106
|
+
readonly group: "drizzle";
|
|
107
|
+
readonly description: "shower_drizzle";
|
|
105
108
|
}, {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
+
readonly id: 500;
|
|
110
|
+
readonly group: "rain";
|
|
111
|
+
readonly description: "light_rain";
|
|
109
112
|
}, {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
readonly id: 501;
|
|
114
|
+
readonly group: "rain";
|
|
115
|
+
readonly description: "moderate_rain";
|
|
113
116
|
}, {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
readonly id: 502;
|
|
118
|
+
readonly group: "rain";
|
|
119
|
+
readonly description: "heavy_intensity_rain";
|
|
117
120
|
}, {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
+
readonly id: 503;
|
|
122
|
+
readonly group: "rain";
|
|
123
|
+
readonly description: "very_heavy_rain";
|
|
121
124
|
}, {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
readonly id: 504;
|
|
126
|
+
readonly group: "rain";
|
|
127
|
+
readonly description: "extreme_rain";
|
|
125
128
|
}, {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
+
readonly id: 511;
|
|
130
|
+
readonly group: "rain";
|
|
131
|
+
readonly description: "freezing_rain";
|
|
129
132
|
}, {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
readonly id: 520;
|
|
134
|
+
readonly group: "rain";
|
|
135
|
+
readonly description: "light_intensity_shower_rain";
|
|
133
136
|
}, {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
readonly id: 521;
|
|
138
|
+
readonly group: "rain";
|
|
139
|
+
readonly description: "shower_rain";
|
|
137
140
|
}, {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
readonly id: 522;
|
|
142
|
+
readonly group: "rain";
|
|
143
|
+
readonly description: "heavy_intensity_shower_rain";
|
|
141
144
|
}, {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
+
readonly id: 531;
|
|
146
|
+
readonly group: "rain";
|
|
147
|
+
readonly description: "ragged_shower_rain";
|
|
145
148
|
}, {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
readonly id: 600;
|
|
150
|
+
readonly group: "snow";
|
|
151
|
+
readonly description: "light_snow";
|
|
149
152
|
}, {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
+
readonly id: 601;
|
|
154
|
+
readonly group: "snow";
|
|
155
|
+
readonly description: "snow";
|
|
153
156
|
}, {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
+
readonly id: 602;
|
|
158
|
+
readonly group: "snow";
|
|
159
|
+
readonly description: "heavy_snow";
|
|
157
160
|
}, {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
+
readonly id: 611;
|
|
162
|
+
readonly group: "snow";
|
|
163
|
+
readonly description: "sleet";
|
|
161
164
|
}, {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
+
readonly id: 612;
|
|
166
|
+
readonly group: "snow";
|
|
167
|
+
readonly description: "light_shower_sleet";
|
|
165
168
|
}, {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
+
readonly id: 613;
|
|
170
|
+
readonly group: "snow";
|
|
171
|
+
readonly description: "shower_sleet";
|
|
169
172
|
}, {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
+
readonly id: 615;
|
|
174
|
+
readonly group: "snow";
|
|
175
|
+
readonly description: "light_rain_and_snow";
|
|
173
176
|
}, {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
+
readonly id: 616;
|
|
178
|
+
readonly group: "snow";
|
|
179
|
+
readonly description: "rain_and_snow";
|
|
177
180
|
}, {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
+
readonly id: 620;
|
|
182
|
+
readonly group: "snow";
|
|
183
|
+
readonly description: "light_shower_snow";
|
|
181
184
|
}, {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
+
readonly id: 621;
|
|
186
|
+
readonly group: "snow";
|
|
187
|
+
readonly description: "shower_snow";
|
|
185
188
|
}, {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
+
readonly id: 622;
|
|
190
|
+
readonly group: "snow";
|
|
191
|
+
readonly description: "heavy_shower_snow";
|
|
189
192
|
}, {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
+
readonly id: 701;
|
|
194
|
+
readonly group: "atmosphere";
|
|
195
|
+
readonly description: "mist";
|
|
193
196
|
}, {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
+
readonly id: 711;
|
|
198
|
+
readonly group: "atmosphere";
|
|
199
|
+
readonly description: "smoke";
|
|
197
200
|
}, {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
+
readonly id: 721;
|
|
202
|
+
readonly group: "atmosphere";
|
|
203
|
+
readonly description: "haze";
|
|
201
204
|
}, {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
+
readonly id: 731;
|
|
206
|
+
readonly group: "atmosphere";
|
|
207
|
+
readonly description: "sand_dust_whirls";
|
|
205
208
|
}, {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
+
readonly id: 741;
|
|
210
|
+
readonly group: "atmosphere";
|
|
211
|
+
readonly description: "fog";
|
|
209
212
|
}, {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
+
readonly id: 751;
|
|
214
|
+
readonly group: "atmosphere";
|
|
215
|
+
readonly description: "sand";
|
|
213
216
|
}, {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
+
readonly id: 761;
|
|
218
|
+
readonly group: "atmosphere";
|
|
219
|
+
readonly description: "dust";
|
|
217
220
|
}, {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
+
readonly id: 762;
|
|
222
|
+
readonly group: "atmosphere";
|
|
223
|
+
readonly description: "volcanic_ash";
|
|
221
224
|
}, {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
+
readonly id: 771;
|
|
226
|
+
readonly group: "atmosphere";
|
|
227
|
+
readonly description: "squalls";
|
|
225
228
|
}, {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
+
readonly id: 781;
|
|
230
|
+
readonly group: "atmosphere";
|
|
231
|
+
readonly description: "tornado";
|
|
229
232
|
}, {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
+
readonly id: 800;
|
|
234
|
+
readonly group: "clear";
|
|
235
|
+
readonly description: "clear_sky";
|
|
233
236
|
}, {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
+
readonly id: 801;
|
|
238
|
+
readonly group: "clouds";
|
|
239
|
+
readonly description: "few_clouds_11-25_percent";
|
|
237
240
|
}, {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
+
readonly id: 802;
|
|
242
|
+
readonly group: "clouds";
|
|
243
|
+
readonly description: "scattered_clouds_25-50_percent";
|
|
241
244
|
}, {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
+
readonly id: 803;
|
|
246
|
+
readonly group: "clouds";
|
|
247
|
+
readonly description: "broken_clouds_51-84_percent";
|
|
245
248
|
}, {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
+
readonly id: 804;
|
|
250
|
+
readonly group: "clouds";
|
|
251
|
+
readonly description: "overcast_clouds_85-100_percent";
|
|
249
252
|
}];
|
|
250
253
|
type WeatherID = (typeof weatherIdGroup)[number]['id'];
|
|
251
254
|
/**
|
|
@@ -283,247 +286,251 @@ declare const weatherIdSchema: z.ZodType<200 | 201 | 202 | 210 | 211 | 212 | 221
|
|
|
283
286
|
* }
|
|
284
287
|
*/
|
|
285
288
|
declare function getWeatherV2Description(id: WeatherID | undefined): IOption<WeatherDescription>;
|
|
286
|
-
|
|
289
|
+
//#endregion
|
|
290
|
+
//#region src/types/v2/index.d.ts
|
|
287
291
|
/**
|
|
288
292
|
* @internal
|
|
289
293
|
*/
|
|
290
294
|
declare const weatherDataV2Schema: z.ZodObject<{
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
295
|
+
base: z.ZodString;
|
|
296
|
+
clouds: z.ZodObject<{
|
|
297
|
+
all: z.ZodNumber;
|
|
298
|
+
}, "strip", z.ZodTypeAny, {
|
|
299
|
+
all: number;
|
|
300
|
+
}, {
|
|
301
|
+
all: number;
|
|
302
|
+
}>;
|
|
303
|
+
cod: z.ZodNumber;
|
|
304
|
+
coord: z.ZodObject<{
|
|
305
|
+
lon: z.ZodNumber;
|
|
306
|
+
lat: z.ZodNumber;
|
|
307
|
+
}, "strip", z.ZodTypeAny, {
|
|
308
|
+
lon: number;
|
|
309
|
+
lat: number;
|
|
310
|
+
}, {
|
|
311
|
+
lon: number;
|
|
312
|
+
lat: number;
|
|
313
|
+
}>;
|
|
314
|
+
dt: z.ZodNumber;
|
|
315
|
+
id: z.ZodNumber;
|
|
316
|
+
main: z.ZodObject<{
|
|
317
|
+
grnd_level: z.ZodOptional<z.ZodNumber>;
|
|
318
|
+
humidity: z.ZodNumber;
|
|
319
|
+
pressure: z.ZodNumber;
|
|
320
|
+
sea_level: z.ZodOptional<z.ZodNumber>;
|
|
321
|
+
temp: z.ZodNumber;
|
|
322
|
+
temp_max: z.ZodNumber;
|
|
323
|
+
temp_min: z.ZodNumber;
|
|
324
|
+
}, "strip", z.ZodTypeAny, {
|
|
325
|
+
humidity: number;
|
|
326
|
+
pressure: number;
|
|
327
|
+
temp: number;
|
|
328
|
+
temp_max: number;
|
|
329
|
+
temp_min: number;
|
|
330
|
+
grnd_level?: number | undefined;
|
|
331
|
+
sea_level?: number | undefined;
|
|
332
|
+
}, {
|
|
333
|
+
humidity: number;
|
|
334
|
+
pressure: number;
|
|
335
|
+
temp: number;
|
|
336
|
+
temp_max: number;
|
|
337
|
+
temp_min: number;
|
|
338
|
+
grnd_level?: number | undefined;
|
|
339
|
+
sea_level?: number | undefined;
|
|
340
|
+
}>;
|
|
341
|
+
name: z.ZodString;
|
|
342
|
+
rain: z.ZodOptional<z.ZodObject<{
|
|
343
|
+
'1h': z.ZodOptional<z.ZodNumber>;
|
|
344
|
+
'3h': z.ZodOptional<z.ZodNumber>;
|
|
345
|
+
}, "strip", z.ZodTypeAny, {
|
|
346
|
+
'1h'?: number | undefined;
|
|
347
|
+
'3h'?: number | undefined;
|
|
348
|
+
}, {
|
|
349
|
+
'1h'?: number | undefined;
|
|
350
|
+
'3h'?: number | undefined;
|
|
351
|
+
}>>;
|
|
352
|
+
snow: z.ZodOptional<z.ZodObject<{
|
|
353
|
+
'1h': z.ZodOptional<z.ZodNumber>;
|
|
354
|
+
'3h': z.ZodOptional<z.ZodNumber>;
|
|
355
|
+
}, "strip", z.ZodTypeAny, {
|
|
356
|
+
'1h'?: number | undefined;
|
|
357
|
+
'3h'?: number | undefined;
|
|
358
|
+
}, {
|
|
359
|
+
'1h'?: number | undefined;
|
|
360
|
+
'3h'?: number | undefined;
|
|
361
|
+
}>>;
|
|
362
|
+
sys: z.ZodObject<{
|
|
363
|
+
country: z.ZodString;
|
|
364
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
365
|
+
message: z.ZodOptional<z.ZodNumber>;
|
|
366
|
+
sunrise: z.ZodNumber;
|
|
367
|
+
sunset: z.ZodNumber;
|
|
368
|
+
type: z.ZodOptional<z.ZodNumber>;
|
|
369
|
+
}, "strip", z.ZodTypeAny, {
|
|
370
|
+
country: string;
|
|
371
|
+
sunrise: number;
|
|
372
|
+
sunset: number;
|
|
373
|
+
id?: number | undefined;
|
|
374
|
+
message?: number | undefined;
|
|
375
|
+
type?: number | undefined;
|
|
376
|
+
}, {
|
|
377
|
+
country: string;
|
|
378
|
+
sunrise: number;
|
|
379
|
+
sunset: number;
|
|
380
|
+
id?: number | undefined;
|
|
381
|
+
message?: number | undefined;
|
|
382
|
+
type?: number | undefined;
|
|
383
|
+
}>;
|
|
384
|
+
timezone: z.ZodNumber;
|
|
385
|
+
visibility: z.ZodNumber;
|
|
386
|
+
weather: z.ZodArray<z.ZodObject<{
|
|
387
|
+
description: z.ZodString;
|
|
388
|
+
icon: z.ZodUnion<[z.ZodEnum<["01d", "02d", "03d", "04d", "09d", "10d", "11d", "13d", "50d"]>, z.ZodEnum<["01n", "02n", "03n", "04n", "09n", "10n", "11n", "13n", "50n"]>]>;
|
|
389
|
+
id: z.ZodType<200 | 201 | 202 | 210 | 211 | 212 | 221 | 230 | 231 | 232 | 300 | 301 | 302 | 310 | 311 | 312 | 313 | 314 | 321 | 500 | 501 | 502 | 503 | 504 | 511 | 520 | 521 | 522 | 531 | 600 | 601 | 602 | 611 | 612 | 613 | 615 | 616 | 620 | 621 | 622 | 701 | 711 | 721 | 731 | 741 | 751 | 761 | 762 | 771 | 781 | 800 | 801 | 802 | 803 | 804, z.ZodTypeDef, 200 | 201 | 202 | 210 | 211 | 212 | 221 | 230 | 231 | 232 | 300 | 301 | 302 | 310 | 311 | 312 | 313 | 314 | 321 | 500 | 501 | 502 | 503 | 504 | 511 | 520 | 521 | 522 | 531 | 600 | 601 | 602 | 611 | 612 | 613 | 615 | 616 | 620 | 621 | 622 | 701 | 711 | 721 | 731 | 741 | 751 | 761 | 762 | 771 | 781 | 800 | 801 | 802 | 803 | 804>;
|
|
390
|
+
main: z.ZodString;
|
|
391
|
+
}, "strip", z.ZodTypeAny, {
|
|
392
|
+
id: 200 | 201 | 202 | 210 | 211 | 212 | 221 | 230 | 231 | 232 | 300 | 301 | 302 | 310 | 311 | 312 | 313 | 314 | 321 | 500 | 501 | 502 | 503 | 504 | 511 | 520 | 521 | 522 | 531 | 600 | 601 | 602 | 611 | 612 | 613 | 615 | 616 | 620 | 621 | 622 | 701 | 711 | 721 | 731 | 741 | 751 | 761 | 762 | 771 | 781 | 800 | 801 | 802 | 803 | 804;
|
|
393
|
+
main: string;
|
|
394
|
+
description: string;
|
|
395
|
+
icon: "01d" | "02d" | "03d" | "04d" | "09d" | "10d" | "11d" | "13d" | "50d" | "01n" | "02n" | "03n" | "04n" | "09n" | "10n" | "11n" | "13n" | "50n";
|
|
396
|
+
}, {
|
|
397
|
+
id: 200 | 201 | 202 | 210 | 211 | 212 | 221 | 230 | 231 | 232 | 300 | 301 | 302 | 310 | 311 | 312 | 313 | 314 | 321 | 500 | 501 | 502 | 503 | 504 | 511 | 520 | 521 | 522 | 531 | 600 | 601 | 602 | 611 | 612 | 613 | 615 | 616 | 620 | 621 | 622 | 701 | 711 | 721 | 731 | 741 | 751 | 761 | 762 | 771 | 781 | 800 | 801 | 802 | 803 | 804;
|
|
398
|
+
main: string;
|
|
399
|
+
description: string;
|
|
400
|
+
icon: "01d" | "02d" | "03d" | "04d" | "09d" | "10d" | "11d" | "13d" | "50d" | "01n" | "02n" | "03n" | "04n" | "09n" | "10n" | "11n" | "13n" | "50n";
|
|
401
|
+
}>, "many">;
|
|
402
|
+
wind: z.ZodObject<{
|
|
403
|
+
speed: z.ZodNumber;
|
|
404
|
+
deg: z.ZodNumber;
|
|
405
|
+
}, "strip", z.ZodTypeAny, {
|
|
406
|
+
speed: number;
|
|
407
|
+
deg: number;
|
|
408
|
+
}, {
|
|
409
|
+
speed: number;
|
|
410
|
+
deg: number;
|
|
411
|
+
}>;
|
|
408
412
|
}, "strip", z.ZodTypeAny, {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
}, {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
413
|
+
id: number;
|
|
414
|
+
base: string;
|
|
415
|
+
clouds: {
|
|
416
|
+
all: number;
|
|
417
|
+
};
|
|
418
|
+
cod: number;
|
|
419
|
+
coord: {
|
|
420
|
+
lon: number;
|
|
421
|
+
lat: number;
|
|
422
|
+
};
|
|
423
|
+
dt: number;
|
|
424
|
+
main: {
|
|
425
|
+
humidity: number;
|
|
426
|
+
pressure: number;
|
|
427
|
+
temp: number;
|
|
428
|
+
temp_max: number;
|
|
429
|
+
temp_min: number;
|
|
430
|
+
grnd_level?: number | undefined;
|
|
431
|
+
sea_level?: number | undefined;
|
|
432
|
+
};
|
|
433
|
+
name: string;
|
|
434
|
+
sys: {
|
|
435
|
+
country: string;
|
|
436
|
+
sunrise: number;
|
|
437
|
+
sunset: number;
|
|
438
|
+
id?: number | undefined;
|
|
439
|
+
message?: number | undefined;
|
|
440
|
+
type?: number | undefined;
|
|
441
|
+
};
|
|
442
|
+
timezone: number;
|
|
443
|
+
visibility: number;
|
|
444
|
+
weather: {
|
|
445
|
+
id: 200 | 201 | 202 | 210 | 211 | 212 | 221 | 230 | 231 | 232 | 300 | 301 | 302 | 310 | 311 | 312 | 313 | 314 | 321 | 500 | 501 | 502 | 503 | 504 | 511 | 520 | 521 | 522 | 531 | 600 | 601 | 602 | 611 | 612 | 613 | 615 | 616 | 620 | 621 | 622 | 701 | 711 | 721 | 731 | 741 | 751 | 761 | 762 | 771 | 781 | 800 | 801 | 802 | 803 | 804;
|
|
446
|
+
main: string;
|
|
447
|
+
description: string;
|
|
448
|
+
icon: "01d" | "02d" | "03d" | "04d" | "09d" | "10d" | "11d" | "13d" | "50d" | "01n" | "02n" | "03n" | "04n" | "09n" | "10n" | "11n" | "13n" | "50n";
|
|
449
|
+
}[];
|
|
450
|
+
wind: {
|
|
451
|
+
speed: number;
|
|
452
|
+
deg: number;
|
|
453
|
+
};
|
|
454
|
+
rain?: {
|
|
455
|
+
'1h'?: number | undefined;
|
|
456
|
+
'3h'?: number | undefined;
|
|
457
|
+
} | undefined;
|
|
458
|
+
snow?: {
|
|
459
|
+
'1h'?: number | undefined;
|
|
460
|
+
'3h'?: number | undefined;
|
|
461
|
+
} | undefined;
|
|
462
|
+
}, {
|
|
463
|
+
id: number;
|
|
464
|
+
base: string;
|
|
465
|
+
clouds: {
|
|
466
|
+
all: number;
|
|
467
|
+
};
|
|
468
|
+
cod: number;
|
|
469
|
+
coord: {
|
|
470
|
+
lon: number;
|
|
471
|
+
lat: number;
|
|
472
|
+
};
|
|
473
|
+
dt: number;
|
|
474
|
+
main: {
|
|
475
|
+
humidity: number;
|
|
476
|
+
pressure: number;
|
|
477
|
+
temp: number;
|
|
478
|
+
temp_max: number;
|
|
479
|
+
temp_min: number;
|
|
480
|
+
grnd_level?: number | undefined;
|
|
481
|
+
sea_level?: number | undefined;
|
|
482
|
+
};
|
|
483
|
+
name: string;
|
|
484
|
+
sys: {
|
|
485
|
+
country: string;
|
|
486
|
+
sunrise: number;
|
|
487
|
+
sunset: number;
|
|
488
|
+
id?: number | undefined;
|
|
489
|
+
message?: number | undefined;
|
|
490
|
+
type?: number | undefined;
|
|
491
|
+
};
|
|
492
|
+
timezone: number;
|
|
493
|
+
visibility: number;
|
|
494
|
+
weather: {
|
|
495
|
+
id: 200 | 201 | 202 | 210 | 211 | 212 | 221 | 230 | 231 | 232 | 300 | 301 | 302 | 310 | 311 | 312 | 313 | 314 | 321 | 500 | 501 | 502 | 503 | 504 | 511 | 520 | 521 | 522 | 531 | 600 | 601 | 602 | 611 | 612 | 613 | 615 | 616 | 620 | 621 | 622 | 701 | 711 | 721 | 731 | 741 | 751 | 761 | 762 | 771 | 781 | 800 | 801 | 802 | 803 | 804;
|
|
496
|
+
main: string;
|
|
497
|
+
description: string;
|
|
498
|
+
icon: "01d" | "02d" | "03d" | "04d" | "09d" | "10d" | "11d" | "13d" | "50d" | "01n" | "02n" | "03n" | "04n" | "09n" | "10n" | "11n" | "13n" | "50n";
|
|
499
|
+
}[];
|
|
500
|
+
wind: {
|
|
501
|
+
speed: number;
|
|
502
|
+
deg: number;
|
|
503
|
+
};
|
|
504
|
+
rain?: {
|
|
505
|
+
'1h'?: number | undefined;
|
|
506
|
+
'3h'?: number | undefined;
|
|
507
|
+
} | undefined;
|
|
508
|
+
snow?: {
|
|
509
|
+
'1h'?: number | undefined;
|
|
510
|
+
'3h'?: number | undefined;
|
|
511
|
+
} | undefined;
|
|
508
512
|
}>;
|
|
509
513
|
type WeatherDataV2 = z.infer<typeof weatherDataV2Schema>;
|
|
510
514
|
declare function isWeatherDataV2(data: unknown): data is WeatherDataV2;
|
|
511
515
|
declare function assertWeatherDataV2(data: unknown): asserts data is WeatherDataV2;
|
|
512
|
-
|
|
516
|
+
//#endregion
|
|
517
|
+
//#region src/interfaces/IOpenWeatherV2.d.ts
|
|
513
518
|
/**
|
|
514
519
|
* Interface for OpenWeatherMap API v2 implementation.
|
|
515
520
|
*/
|
|
516
521
|
interface IOpenWeatherV2 {
|
|
517
|
-
|
|
522
|
+
dataWeatherApi: (params: URLSearchParams) => Promise<IResult<WeatherDataV2, SyntaxError | TypeError>>;
|
|
518
523
|
}
|
|
519
|
-
|
|
524
|
+
//#endregion
|
|
525
|
+
//#region src/types/ISO3166-Countries.d.ts
|
|
520
526
|
declare const CountryCodeList: readonly ["af", "ax", "al", "dz", "as", "ad", "ao", "ai", "aq", "ag", "ar", "am", "aw", "au", "at", "az", "bs", "bh", "bd", "bb", "by", "be", "bz", "bj", "bm", "bt", "bo", "bq", "ba", "bw", "bv", "br", "io", "bn", "bg", "bf", "bi", "kh", "cm", "ca", "cv", "ky", "cf", "td", "cl", "cn", "cx", "cc", "co", "km", "cg", "cd", "ck", "cr", "ci", "hr", "cu", "cw", "cy", "cz", "dk", "dj", "dm", "do", "ec", "eg", "sv", "gq", "er", "ee", "et", "fk", "fo", "fj", "fi", "fr", "gf", "pf", "tf", "ga", "gm", "ge", "de", "gh", "gi", "gr", "gl", "gd", "gp", "gu", "gt", "gg", "gn", "gw", "gy", "ht", "hm", "va", "hn", "hk", "hu", "is", "in", "id", "ir", "iq", "ie", "im", "il", "it", "jm", "jp", "je", "jo", "kz", "ke", "ki", "kp", "kr", "kw", "kg", "la", "lv", "lb", "ls", "lr", "ly", "li", "lt", "lu", "mo", "mk", "mg", "mw", "my", "mv", "ml", "mt", "mh", "mq", "mr", "mu", "yt", "mx", "fm", "md", "mc", "mn", "me", "ms", "ma", "mz", "mm", "na", "nr", "np", "nl", "nc", "nz", "ni", "ne", "ng", "nu", "nf", "mp", "no", "om", "pk", "pw", "ps", "pa", "pg", "py", "pe", "ph", "pn", "pl", "pt", "pr", "qa", "re", "ro", "ru", "rw", "bl", "sh", "kn", "lc", "mf", "pm", "vc", "ws", "sm", "st", "sa", "sn", "rs", "sc", "sl", "sg", "sx", "sk", "si", "sb", "so", "za", "gs", "ss", "es", "lk", "sd", "sr", "sj", "sz", "se", "ch", "sy", "tw", "tj", "tz", "th", "tl", "tg", "tk", "to", "tt", "tn", "tr", "tm", "tc", "tv", "ug", "ua", "ae", "gb", "us", "um", "uy", "uz", "vu", "ve", "vn", "vg", "vi", "wf", "eh", "ye", "zm", "zw"];
|
|
521
527
|
/**
|
|
522
528
|
* @internal
|
|
523
529
|
*/
|
|
524
530
|
declare const CountryCodeSchema: z.ZodEnum<["af", "ax", "al", "dz", "as", "ad", "ao", "ai", "aq", "ag", "ar", "am", "aw", "au", "at", "az", "bs", "bh", "bd", "bb", "by", "be", "bz", "bj", "bm", "bt", "bo", "bq", "ba", "bw", "bv", "br", "io", "bn", "bg", "bf", "bi", "kh", "cm", "ca", "cv", "ky", "cf", "td", "cl", "cn", "cx", "cc", "co", "km", "cg", "cd", "ck", "cr", "ci", "hr", "cu", "cw", "cy", "cz", "dk", "dj", "dm", "do", "ec", "eg", "sv", "gq", "er", "ee", "et", "fk", "fo", "fj", "fi", "fr", "gf", "pf", "tf", "ga", "gm", "ge", "de", "gh", "gi", "gr", "gl", "gd", "gp", "gu", "gt", "gg", "gn", "gw", "gy", "ht", "hm", "va", "hn", "hk", "hu", "is", "in", "id", "ir", "iq", "ie", "im", "il", "it", "jm", "jp", "je", "jo", "kz", "ke", "ki", "kp", "kr", "kw", "kg", "la", "lv", "lb", "ls", "lr", "ly", "li", "lt", "lu", "mo", "mk", "mg", "mw", "my", "mv", "ml", "mt", "mh", "mq", "mr", "mu", "yt", "mx", "fm", "md", "mc", "mn", "me", "ms", "ma", "mz", "mm", "na", "nr", "np", "nl", "nc", "nz", "ni", "ne", "ng", "nu", "nf", "mp", "no", "om", "pk", "pw", "ps", "pa", "pg", "py", "pe", "ph", "pn", "pl", "pt", "pr", "qa", "re", "ro", "ru", "rw", "bl", "sh", "kn", "lc", "mf", "pm", "vc", "ws", "sm", "st", "sa", "sn", "rs", "sc", "sl", "sg", "sx", "sk", "si", "sb", "so", "za", "gs", "ss", "es", "lk", "sd", "sr", "sj", "sz", "se", "ch", "sy", "tw", "tj", "tz", "th", "tl", "tg", "tk", "to", "tt", "tn", "tr", "tm", "tc", "tv", "ug", "ua", "ae", "gb", "us", "um", "uy", "uz", "vu", "ve", "vn", "vg", "vi", "wf", "eh", "ye", "zm", "zw"]>;
|
|
525
531
|
type CountryCode = z.infer<typeof CountryCodeSchema>;
|
|
526
|
-
|
|
532
|
+
//#endregion
|
|
533
|
+
//#region src/OpenWeatherV2.d.ts
|
|
527
534
|
/**
|
|
528
535
|
* Open Weather V2 API Common Options
|
|
529
536
|
* @default {lang: 'en', units: 'standard'} in API
|
|
@@ -532,14 +539,14 @@ type CountryCode = z.infer<typeof CountryCodeSchema>;
|
|
|
532
539
|
* @since v0.0.1
|
|
533
540
|
*/
|
|
534
541
|
type OpenWeatherV2CommonOptions = {
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
542
|
+
/**
|
|
543
|
+
* Language code
|
|
544
|
+
*/
|
|
545
|
+
lang: LangCode;
|
|
546
|
+
/**
|
|
547
|
+
* Weather units
|
|
548
|
+
*/
|
|
549
|
+
units: 'standard' | 'metric' | 'imperial';
|
|
543
550
|
};
|
|
544
551
|
/**
|
|
545
552
|
* Open Weather V2 API
|
|
@@ -566,76 +573,78 @@ type OpenWeatherV2CommonOptions = {
|
|
|
566
573
|
* @since v0.0.1
|
|
567
574
|
*/
|
|
568
575
|
declare class OpenWeatherV2 {
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
576
|
+
private cache;
|
|
577
|
+
private loadableApiKey;
|
|
578
|
+
private apiHandler;
|
|
579
|
+
private fetchPromiseMap;
|
|
580
|
+
/**
|
|
581
|
+
* OpenWeatherV2 constructor
|
|
582
|
+
* @param {Loadable<string>} loadableApiKey - Loadable API key
|
|
583
|
+
* @param {ICacheOrAsync<WeatherDataV2>=} cache - optional async cache implementation
|
|
584
|
+
* @param {IOpenWeatherV2=} apiHandler - optional API handler implementation for mocking
|
|
585
|
+
*/
|
|
586
|
+
constructor(loadableApiKey: Loadable<string>, cache?: IAsyncCache<WeatherDataV2>, apiHandler?: IOpenWeatherV2);
|
|
587
|
+
/**
|
|
588
|
+
* get weather by Id
|
|
589
|
+
* @param {number} id - Weather station ID
|
|
590
|
+
* @param {OpenWeatherV2CommonOptions=} currentOpts - Common options, example ```{lang: 'fi', units: 'metric'}```, defaults ```{lang: 'en', units: 'standard'}```
|
|
591
|
+
* @return {Promise<Result<WeatherDataV2, DOMException | TypeError>>} Weather data Result Promise
|
|
592
|
+
* @example
|
|
593
|
+
* const result: Result<WeatherDataV2, DOMException | TypeError> = await weather.getWeatherResultById(id: 564, {lang: 'fi'});
|
|
594
|
+
* if (result.isOk) {
|
|
595
|
+
* const weatherData: WeatherDataV2 = result.ok();
|
|
596
|
+
* } else {
|
|
597
|
+
* const error: DOMException | TypeError = result.err();
|
|
598
|
+
* }
|
|
599
|
+
*/
|
|
600
|
+
getWeatherById(id: number, currentOpts?: Partial<OpenWeatherV2CommonOptions>): Promise<IResult<WeatherDataV2, DOMException | TypeError>>;
|
|
601
|
+
/**
|
|
602
|
+
* get weather with city name and optional country code
|
|
603
|
+
* @param {string} city - City name
|
|
604
|
+
* @param {countryCode=} countryCode - Optional Country code
|
|
605
|
+
* @param {OpenWeatherV2CommonOptions=} currentOpts - Common options, example ```{lang: 'fi', units: 'metric'}```, defaults ```{lang: 'en', units: 'standard'}```
|
|
606
|
+
* @return {Promise<Result<WeatherDataV2, DOMException | TypeError>>} Weather data Result Promise
|
|
607
|
+
* @example
|
|
608
|
+
* const result: Result<WeatherDataV2, DOMException | TypeError> = await weather.getWeatherByCity('Helsinki', 'fi', {lang: 'fi'});
|
|
609
|
+
* if (result.isOk) {
|
|
610
|
+
* const weatherData: WeatherDataV2 = result.ok();
|
|
611
|
+
* } else {
|
|
612
|
+
* const error: DOMException | TypeError = result.err();
|
|
613
|
+
* }
|
|
614
|
+
*/
|
|
615
|
+
getWeatherByCity(city: string, countryCode?: CountryCode, currentOpts?: Partial<OpenWeatherV2CommonOptions>): Promise<IResult<WeatherDataV2, DOMException | TypeError>>;
|
|
616
|
+
/**
|
|
617
|
+
* get weather with latitude and longitude with Result
|
|
618
|
+
* @param {number} lat - Latitude
|
|
619
|
+
* @param {number} lon - Longitude
|
|
620
|
+
* @param {OpenWeatherV2CommonOptions=} currentOpts - Common options, example ```{lang: 'fi', units: 'metric'}```, defaults ```{lang: 'en', units: 'standard'}```
|
|
621
|
+
* @return {Promise<Result<WeatherDataV2, DOMException | TypeError>>} Weather data Result Promise
|
|
622
|
+
* @example
|
|
623
|
+
* const result: Result<WeatherDataV2, DOMException | TypeError> = await weather.getWeatherByLatLon(60.1699, 24.9384, {lang: 'fi'});
|
|
624
|
+
* if (result.isOk) {
|
|
625
|
+
* const weatherData: WeatherDataV2 = result.ok();
|
|
626
|
+
* } else {
|
|
627
|
+
* const error: DOMException | TypeError = result.err();
|
|
628
|
+
* }
|
|
629
|
+
*/
|
|
630
|
+
getWeatherByLatLon(lat: number, lon: number, currentOpts?: Partial<OpenWeatherV2CommonOptions>): Promise<IResult<WeatherDataV2, DOMException | TypeError>>;
|
|
631
|
+
private buildBaseParams;
|
|
632
|
+
/**
|
|
633
|
+
* build base cache key
|
|
634
|
+
* @param main - main cache key prefix
|
|
635
|
+
* @param opts - OpenWeatherV2CommonOptions
|
|
636
|
+
* @returns {string} cache key
|
|
637
|
+
*/
|
|
638
|
+
private buildBaseCacheKey;
|
|
639
|
+
private handleFetch;
|
|
633
640
|
}
|
|
634
|
-
|
|
641
|
+
//#endregion
|
|
642
|
+
//#region src/lib/fetchUtils.d.ts
|
|
635
643
|
/**
|
|
636
644
|
* Ensures that the error is a DOMException or TypeError.
|
|
637
645
|
* @internal
|
|
638
646
|
*/
|
|
639
647
|
declare function fetchErrorWrapper(err: unknown): DOMException | TypeError;
|
|
640
|
-
|
|
641
|
-
export {
|
|
648
|
+
//#endregion
|
|
649
|
+
export { CountryCode, CountryCodeList, CountryCodeSchema, DayIcon, IOpenWeatherV2, Icon, LangCode, NightIcon, OpenWeatherV2, OpenWeatherV2CommonOptions, WeatherDataV2, WeatherDescription, WeatherGroup, WeatherID, assertWeatherDataV2, fetchErrorWrapper, getWeatherV2Description, iconSchema, isWeatherDataV2, langCodeSchema, langCodes, weatherDataV2Schema, weatherIdGroup, weatherIdSchema };
|
|
650
|
+
//# sourceMappingURL=index.d.mts.map
|