@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.d.mts CHANGED
@@ -1,8 +1,9 @@
1
- import { IAsyncCache } from '@luolapeikko/cache-types';
2
- import { IOption, IResult } from '@luolapeikko/result-option';
3
- import { Loadable } from '@luolapeikko/ts-common';
4
- import { z } from 'zod';
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
- readonly id: 200;
31
- readonly group: "thunderstorm";
32
- readonly description: "thunderstorm_with_light_rain";
33
+ readonly id: 200;
34
+ readonly group: "thunderstorm";
35
+ readonly description: "thunderstorm_with_light_rain";
33
36
  }, {
34
- readonly id: 201;
35
- readonly group: "thunderstorm";
36
- readonly description: "thunderstorm_with_rain";
37
+ readonly id: 201;
38
+ readonly group: "thunderstorm";
39
+ readonly description: "thunderstorm_with_rain";
37
40
  }, {
38
- readonly id: 202;
39
- readonly group: "thunderstorm";
40
- readonly description: "thunderstorm_with_heavy_rain";
41
+ readonly id: 202;
42
+ readonly group: "thunderstorm";
43
+ readonly description: "thunderstorm_with_heavy_rain";
41
44
  }, {
42
- readonly id: 210;
43
- readonly group: "thunderstorm";
44
- readonly description: "light_thunderstorm";
45
+ readonly id: 210;
46
+ readonly group: "thunderstorm";
47
+ readonly description: "light_thunderstorm";
45
48
  }, {
46
- readonly id: 211;
47
- readonly group: "thunderstorm";
48
- readonly description: "thunderstorm";
49
+ readonly id: 211;
50
+ readonly group: "thunderstorm";
51
+ readonly description: "thunderstorm";
49
52
  }, {
50
- readonly id: 212;
51
- readonly group: "thunderstorm";
52
- readonly description: "heavy_thunderstorm";
53
+ readonly id: 212;
54
+ readonly group: "thunderstorm";
55
+ readonly description: "heavy_thunderstorm";
53
56
  }, {
54
- readonly id: 221;
55
- readonly group: "thunderstorm";
56
- readonly description: "ragged_thunderstorm";
57
+ readonly id: 221;
58
+ readonly group: "thunderstorm";
59
+ readonly description: "ragged_thunderstorm";
57
60
  }, {
58
- readonly id: 230;
59
- readonly group: "thunderstorm";
60
- readonly description: "thunderstorm_with_light_drizzle";
61
+ readonly id: 230;
62
+ readonly group: "thunderstorm";
63
+ readonly description: "thunderstorm_with_light_drizzle";
61
64
  }, {
62
- readonly id: 231;
63
- readonly group: "thunderstorm";
64
- readonly description: "thunderstorm_with_drizzle";
65
+ readonly id: 231;
66
+ readonly group: "thunderstorm";
67
+ readonly description: "thunderstorm_with_drizzle";
65
68
  }, {
66
- readonly id: 232;
67
- readonly group: "thunderstorm";
68
- readonly description: "thunderstorm_with_heavy_drizzle";
69
+ readonly id: 232;
70
+ readonly group: "thunderstorm";
71
+ readonly description: "thunderstorm_with_heavy_drizzle";
69
72
  }, {
70
- readonly id: 300;
71
- readonly group: "drizzle";
72
- readonly description: "light_intensity_drizzle";
73
+ readonly id: 300;
74
+ readonly group: "drizzle";
75
+ readonly description: "light_intensity_drizzle";
73
76
  }, {
74
- readonly id: 301;
75
- readonly group: "drizzle";
76
- readonly description: "drizzle";
77
+ readonly id: 301;
78
+ readonly group: "drizzle";
79
+ readonly description: "drizzle";
77
80
  }, {
78
- readonly id: 302;
79
- readonly group: "drizzle";
80
- readonly description: "heavy_intensity_drizzle";
81
+ readonly id: 302;
82
+ readonly group: "drizzle";
83
+ readonly description: "heavy_intensity_drizzle";
81
84
  }, {
82
- readonly id: 310;
83
- readonly group: "drizzle";
84
- readonly description: "light_intensity_drizzle_rain";
85
+ readonly id: 310;
86
+ readonly group: "drizzle";
87
+ readonly description: "light_intensity_drizzle_rain";
85
88
  }, {
86
- readonly id: 311;
87
- readonly group: "drizzle";
88
- readonly description: "drizzle_rain";
89
+ readonly id: 311;
90
+ readonly group: "drizzle";
91
+ readonly description: "drizzle_rain";
89
92
  }, {
90
- readonly id: 312;
91
- readonly group: "drizzle";
92
- readonly description: "heavy_intensity_drizzle_rain";
93
+ readonly id: 312;
94
+ readonly group: "drizzle";
95
+ readonly description: "heavy_intensity_drizzle_rain";
93
96
  }, {
94
- readonly id: 313;
95
- readonly group: "drizzle";
96
- readonly description: "shower_rain_and_drizzle";
97
+ readonly id: 313;
98
+ readonly group: "drizzle";
99
+ readonly description: "shower_rain_and_drizzle";
97
100
  }, {
98
- readonly id: 314;
99
- readonly group: "drizzle";
100
- readonly description: "heavy_shower_rain_and_drizzle";
101
+ readonly id: 314;
102
+ readonly group: "drizzle";
103
+ readonly description: "heavy_shower_rain_and_drizzle";
101
104
  }, {
102
- readonly id: 321;
103
- readonly group: "drizzle";
104
- readonly description: "shower_drizzle";
105
+ readonly id: 321;
106
+ readonly group: "drizzle";
107
+ readonly description: "shower_drizzle";
105
108
  }, {
106
- readonly id: 500;
107
- readonly group: "rain";
108
- readonly description: "light_rain";
109
+ readonly id: 500;
110
+ readonly group: "rain";
111
+ readonly description: "light_rain";
109
112
  }, {
110
- readonly id: 501;
111
- readonly group: "rain";
112
- readonly description: "moderate_rain";
113
+ readonly id: 501;
114
+ readonly group: "rain";
115
+ readonly description: "moderate_rain";
113
116
  }, {
114
- readonly id: 502;
115
- readonly group: "rain";
116
- readonly description: "heavy_intensity_rain";
117
+ readonly id: 502;
118
+ readonly group: "rain";
119
+ readonly description: "heavy_intensity_rain";
117
120
  }, {
118
- readonly id: 503;
119
- readonly group: "rain";
120
- readonly description: "very_heavy_rain";
121
+ readonly id: 503;
122
+ readonly group: "rain";
123
+ readonly description: "very_heavy_rain";
121
124
  }, {
122
- readonly id: 504;
123
- readonly group: "rain";
124
- readonly description: "extreme_rain";
125
+ readonly id: 504;
126
+ readonly group: "rain";
127
+ readonly description: "extreme_rain";
125
128
  }, {
126
- readonly id: 511;
127
- readonly group: "rain";
128
- readonly description: "freezing_rain";
129
+ readonly id: 511;
130
+ readonly group: "rain";
131
+ readonly description: "freezing_rain";
129
132
  }, {
130
- readonly id: 520;
131
- readonly group: "rain";
132
- readonly description: "light_intensity_shower_rain";
133
+ readonly id: 520;
134
+ readonly group: "rain";
135
+ readonly description: "light_intensity_shower_rain";
133
136
  }, {
134
- readonly id: 521;
135
- readonly group: "rain";
136
- readonly description: "shower_rain";
137
+ readonly id: 521;
138
+ readonly group: "rain";
139
+ readonly description: "shower_rain";
137
140
  }, {
138
- readonly id: 522;
139
- readonly group: "rain";
140
- readonly description: "heavy_intensity_shower_rain";
141
+ readonly id: 522;
142
+ readonly group: "rain";
143
+ readonly description: "heavy_intensity_shower_rain";
141
144
  }, {
142
- readonly id: 531;
143
- readonly group: "rain";
144
- readonly description: "ragged_shower_rain";
145
+ readonly id: 531;
146
+ readonly group: "rain";
147
+ readonly description: "ragged_shower_rain";
145
148
  }, {
146
- readonly id: 600;
147
- readonly group: "snow";
148
- readonly description: "light_snow";
149
+ readonly id: 600;
150
+ readonly group: "snow";
151
+ readonly description: "light_snow";
149
152
  }, {
150
- readonly id: 601;
151
- readonly group: "snow";
152
- readonly description: "snow";
153
+ readonly id: 601;
154
+ readonly group: "snow";
155
+ readonly description: "snow";
153
156
  }, {
154
- readonly id: 602;
155
- readonly group: "snow";
156
- readonly description: "heavy_snow";
157
+ readonly id: 602;
158
+ readonly group: "snow";
159
+ readonly description: "heavy_snow";
157
160
  }, {
158
- readonly id: 611;
159
- readonly group: "snow";
160
- readonly description: "sleet";
161
+ readonly id: 611;
162
+ readonly group: "snow";
163
+ readonly description: "sleet";
161
164
  }, {
162
- readonly id: 612;
163
- readonly group: "snow";
164
- readonly description: "light_shower_sleet";
165
+ readonly id: 612;
166
+ readonly group: "snow";
167
+ readonly description: "light_shower_sleet";
165
168
  }, {
166
- readonly id: 613;
167
- readonly group: "snow";
168
- readonly description: "shower_sleet";
169
+ readonly id: 613;
170
+ readonly group: "snow";
171
+ readonly description: "shower_sleet";
169
172
  }, {
170
- readonly id: 615;
171
- readonly group: "snow";
172
- readonly description: "light_rain_and_snow";
173
+ readonly id: 615;
174
+ readonly group: "snow";
175
+ readonly description: "light_rain_and_snow";
173
176
  }, {
174
- readonly id: 616;
175
- readonly group: "snow";
176
- readonly description: "rain_and_snow";
177
+ readonly id: 616;
178
+ readonly group: "snow";
179
+ readonly description: "rain_and_snow";
177
180
  }, {
178
- readonly id: 620;
179
- readonly group: "snow";
180
- readonly description: "light_shower_snow";
181
+ readonly id: 620;
182
+ readonly group: "snow";
183
+ readonly description: "light_shower_snow";
181
184
  }, {
182
- readonly id: 621;
183
- readonly group: "snow";
184
- readonly description: "shower_snow";
185
+ readonly id: 621;
186
+ readonly group: "snow";
187
+ readonly description: "shower_snow";
185
188
  }, {
186
- readonly id: 622;
187
- readonly group: "snow";
188
- readonly description: "heavy_shower_snow";
189
+ readonly id: 622;
190
+ readonly group: "snow";
191
+ readonly description: "heavy_shower_snow";
189
192
  }, {
190
- readonly id: 701;
191
- readonly group: "atmosphere";
192
- readonly description: "mist";
193
+ readonly id: 701;
194
+ readonly group: "atmosphere";
195
+ readonly description: "mist";
193
196
  }, {
194
- readonly id: 711;
195
- readonly group: "atmosphere";
196
- readonly description: "smoke";
197
+ readonly id: 711;
198
+ readonly group: "atmosphere";
199
+ readonly description: "smoke";
197
200
  }, {
198
- readonly id: 721;
199
- readonly group: "atmosphere";
200
- readonly description: "haze";
201
+ readonly id: 721;
202
+ readonly group: "atmosphere";
203
+ readonly description: "haze";
201
204
  }, {
202
- readonly id: 731;
203
- readonly group: "atmosphere";
204
- readonly description: "sand_dust_whirls";
205
+ readonly id: 731;
206
+ readonly group: "atmosphere";
207
+ readonly description: "sand_dust_whirls";
205
208
  }, {
206
- readonly id: 741;
207
- readonly group: "atmosphere";
208
- readonly description: "fog";
209
+ readonly id: 741;
210
+ readonly group: "atmosphere";
211
+ readonly description: "fog";
209
212
  }, {
210
- readonly id: 751;
211
- readonly group: "atmosphere";
212
- readonly description: "sand";
213
+ readonly id: 751;
214
+ readonly group: "atmosphere";
215
+ readonly description: "sand";
213
216
  }, {
214
- readonly id: 761;
215
- readonly group: "atmosphere";
216
- readonly description: "dust";
217
+ readonly id: 761;
218
+ readonly group: "atmosphere";
219
+ readonly description: "dust";
217
220
  }, {
218
- readonly id: 762;
219
- readonly group: "atmosphere";
220
- readonly description: "volcanic_ash";
221
+ readonly id: 762;
222
+ readonly group: "atmosphere";
223
+ readonly description: "volcanic_ash";
221
224
  }, {
222
- readonly id: 771;
223
- readonly group: "atmosphere";
224
- readonly description: "squalls";
225
+ readonly id: 771;
226
+ readonly group: "atmosphere";
227
+ readonly description: "squalls";
225
228
  }, {
226
- readonly id: 781;
227
- readonly group: "atmosphere";
228
- readonly description: "tornado";
229
+ readonly id: 781;
230
+ readonly group: "atmosphere";
231
+ readonly description: "tornado";
229
232
  }, {
230
- readonly id: 800;
231
- readonly group: "clear";
232
- readonly description: "clear_sky";
233
+ readonly id: 800;
234
+ readonly group: "clear";
235
+ readonly description: "clear_sky";
233
236
  }, {
234
- readonly id: 801;
235
- readonly group: "clouds";
236
- readonly description: "few_clouds_11-25_percent";
237
+ readonly id: 801;
238
+ readonly group: "clouds";
239
+ readonly description: "few_clouds_11-25_percent";
237
240
  }, {
238
- readonly id: 802;
239
- readonly group: "clouds";
240
- readonly description: "scattered_clouds_25-50_percent";
241
+ readonly id: 802;
242
+ readonly group: "clouds";
243
+ readonly description: "scattered_clouds_25-50_percent";
241
244
  }, {
242
- readonly id: 803;
243
- readonly group: "clouds";
244
- readonly description: "broken_clouds_51-84_percent";
245
+ readonly id: 803;
246
+ readonly group: "clouds";
247
+ readonly description: "broken_clouds_51-84_percent";
245
248
  }, {
246
- readonly id: 804;
247
- readonly group: "clouds";
248
- readonly description: "overcast_clouds_85-100_percent";
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
- base: z.ZodString;
292
- clouds: z.ZodObject<{
293
- all: z.ZodNumber;
294
- }, "strip", z.ZodTypeAny, {
295
- all: number;
296
- }, {
297
- all: number;
298
- }>;
299
- cod: z.ZodNumber;
300
- coord: z.ZodObject<{
301
- lon: z.ZodNumber;
302
- lat: z.ZodNumber;
303
- }, "strip", z.ZodTypeAny, {
304
- lon: number;
305
- lat: number;
306
- }, {
307
- lon: number;
308
- lat: number;
309
- }>;
310
- dt: z.ZodNumber;
311
- id: z.ZodNumber;
312
- main: z.ZodObject<{
313
- grnd_level: z.ZodOptional<z.ZodNumber>;
314
- humidity: z.ZodNumber;
315
- pressure: z.ZodNumber;
316
- sea_level: z.ZodOptional<z.ZodNumber>;
317
- temp: z.ZodNumber;
318
- temp_max: z.ZodNumber;
319
- temp_min: z.ZodNumber;
320
- }, "strip", z.ZodTypeAny, {
321
- humidity: number;
322
- pressure: number;
323
- temp: number;
324
- temp_max: number;
325
- temp_min: number;
326
- grnd_level?: number | undefined;
327
- sea_level?: number | undefined;
328
- }, {
329
- humidity: number;
330
- pressure: number;
331
- temp: number;
332
- temp_max: number;
333
- temp_min: number;
334
- grnd_level?: number | undefined;
335
- sea_level?: number | undefined;
336
- }>;
337
- name: z.ZodString;
338
- rain: z.ZodOptional<z.ZodObject<{
339
- '1h': z.ZodOptional<z.ZodNumber>;
340
- '3h': z.ZodOptional<z.ZodNumber>;
341
- }, "strip", z.ZodTypeAny, {
342
- '1h'?: number | undefined;
343
- '3h'?: number | undefined;
344
- }, {
345
- '1h'?: number | undefined;
346
- '3h'?: number | undefined;
347
- }>>;
348
- snow: z.ZodOptional<z.ZodObject<{
349
- '1h': z.ZodOptional<z.ZodNumber>;
350
- '3h': z.ZodOptional<z.ZodNumber>;
351
- }, "strip", z.ZodTypeAny, {
352
- '1h'?: number | undefined;
353
- '3h'?: number | undefined;
354
- }, {
355
- '1h'?: number | undefined;
356
- '3h'?: number | undefined;
357
- }>>;
358
- sys: z.ZodObject<{
359
- country: z.ZodString;
360
- id: z.ZodOptional<z.ZodNumber>;
361
- message: z.ZodOptional<z.ZodNumber>;
362
- sunrise: z.ZodNumber;
363
- sunset: z.ZodNumber;
364
- type: z.ZodOptional<z.ZodNumber>;
365
- }, "strip", z.ZodTypeAny, {
366
- country: string;
367
- sunrise: number;
368
- sunset: number;
369
- message?: number | undefined;
370
- type?: number | undefined;
371
- id?: number | undefined;
372
- }, {
373
- country: string;
374
- sunrise: number;
375
- sunset: number;
376
- message?: number | undefined;
377
- type?: number | undefined;
378
- id?: number | undefined;
379
- }>;
380
- timezone: z.ZodNumber;
381
- visibility: z.ZodNumber;
382
- weather: z.ZodArray<z.ZodObject<{
383
- description: z.ZodString;
384
- 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"]>]>;
385
- 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>;
386
- main: z.ZodString;
387
- }, "strip", z.ZodTypeAny, {
388
- 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;
389
- description: string;
390
- icon: "01d" | "02d" | "03d" | "04d" | "09d" | "10d" | "11d" | "13d" | "50d" | "01n" | "02n" | "03n" | "04n" | "09n" | "10n" | "11n" | "13n" | "50n";
391
- main: string;
392
- }, {
393
- 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;
394
- description: string;
395
- icon: "01d" | "02d" | "03d" | "04d" | "09d" | "10d" | "11d" | "13d" | "50d" | "01n" | "02n" | "03n" | "04n" | "09n" | "10n" | "11n" | "13n" | "50n";
396
- main: string;
397
- }>, "many">;
398
- wind: z.ZodObject<{
399
- speed: z.ZodNumber;
400
- deg: z.ZodNumber;
401
- }, "strip", z.ZodTypeAny, {
402
- speed: number;
403
- deg: number;
404
- }, {
405
- speed: number;
406
- deg: number;
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
- clouds: {
410
- all: number;
411
- };
412
- id: number;
413
- main: {
414
- humidity: number;
415
- pressure: number;
416
- temp: number;
417
- temp_max: number;
418
- temp_min: number;
419
- grnd_level?: number | undefined;
420
- sea_level?: number | undefined;
421
- };
422
- base: string;
423
- cod: number;
424
- coord: {
425
- lon: number;
426
- lat: number;
427
- };
428
- dt: number;
429
- name: string;
430
- sys: {
431
- country: string;
432
- sunrise: number;
433
- sunset: number;
434
- message?: number | undefined;
435
- type?: number | undefined;
436
- id?: number | undefined;
437
- };
438
- timezone: number;
439
- visibility: number;
440
- weather: {
441
- 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;
442
- description: string;
443
- icon: "01d" | "02d" | "03d" | "04d" | "09d" | "10d" | "11d" | "13d" | "50d" | "01n" | "02n" | "03n" | "04n" | "09n" | "10n" | "11n" | "13n" | "50n";
444
- main: string;
445
- }[];
446
- wind: {
447
- speed: number;
448
- deg: number;
449
- };
450
- rain?: {
451
- '1h'?: number | undefined;
452
- '3h'?: number | undefined;
453
- } | undefined;
454
- snow?: {
455
- '1h'?: number | undefined;
456
- '3h'?: number | undefined;
457
- } | undefined;
458
- }, {
459
- clouds: {
460
- all: number;
461
- };
462
- id: number;
463
- main: {
464
- humidity: number;
465
- pressure: number;
466
- temp: number;
467
- temp_max: number;
468
- temp_min: number;
469
- grnd_level?: number | undefined;
470
- sea_level?: number | undefined;
471
- };
472
- base: string;
473
- cod: number;
474
- coord: {
475
- lon: number;
476
- lat: number;
477
- };
478
- dt: number;
479
- name: string;
480
- sys: {
481
- country: string;
482
- sunrise: number;
483
- sunset: number;
484
- message?: number | undefined;
485
- type?: number | undefined;
486
- id?: number | undefined;
487
- };
488
- timezone: number;
489
- visibility: number;
490
- weather: {
491
- 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;
492
- description: string;
493
- icon: "01d" | "02d" | "03d" | "04d" | "09d" | "10d" | "11d" | "13d" | "50d" | "01n" | "02n" | "03n" | "04n" | "09n" | "10n" | "11n" | "13n" | "50n";
494
- main: string;
495
- }[];
496
- wind: {
497
- speed: number;
498
- deg: number;
499
- };
500
- rain?: {
501
- '1h'?: number | undefined;
502
- '3h'?: number | undefined;
503
- } | undefined;
504
- snow?: {
505
- '1h'?: number | undefined;
506
- '3h'?: number | undefined;
507
- } | undefined;
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
- dataWeatherApi: (params: URLSearchParams) => Promise<IResult<WeatherDataV2, SyntaxError | TypeError>>;
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
- * Language code
537
- */
538
- lang: LangCode;
539
- /**
540
- * Weather units
541
- */
542
- units: 'standard' | 'metric' | 'imperial';
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
- private cache;
570
- private loadableApiKey;
571
- private apiHandler;
572
- private fetchPromiseMap;
573
- /**
574
- * OpenWeatherV2 constructor
575
- * @param {Loadable<string>} loadableApiKey - Loadable API key
576
- * @param {ICacheOrAsync<WeatherDataV2>=} cache - optional async cache implementation
577
- * @param {IOpenWeatherV2=} apiHandler - optional API handler implementation for mocking
578
- */
579
- constructor(loadableApiKey: Loadable<string>, cache?: IAsyncCache<WeatherDataV2>, apiHandler?: IOpenWeatherV2);
580
- /**
581
- * get weather by Id
582
- * @param {number} id - Weather station ID
583
- * @param {OpenWeatherV2CommonOptions=} currentOpts - Common options, example ```{lang: 'fi', units: 'metric'}```, defaults ```{lang: 'en', units: 'standard'}```
584
- * @return {Promise<Result<WeatherDataV2, DOMException | TypeError>>} Weather data Result Promise
585
- * @example
586
- * const result: Result<WeatherDataV2, DOMException | TypeError> = await weather.getWeatherResultById(id: 564, {lang: 'fi'});
587
- * if (result.isOk) {
588
- * const weatherData: WeatherDataV2 = result.ok();
589
- * } else {
590
- * const error: DOMException | TypeError = result.err();
591
- * }
592
- */
593
- getWeatherById(id: number, currentOpts?: Partial<OpenWeatherV2CommonOptions>): Promise<IResult<WeatherDataV2, DOMException | TypeError>>;
594
- /**
595
- * get weather with city name and optional country code
596
- * @param {string} city - City name
597
- * @param {countryCode=} countryCode - Optional Country code
598
- * @param {OpenWeatherV2CommonOptions=} currentOpts - Common options, example ```{lang: 'fi', units: 'metric'}```, defaults ```{lang: 'en', units: 'standard'}```
599
- * @return {Promise<Result<WeatherDataV2, DOMException | TypeError>>} Weather data Result Promise
600
- * @example
601
- * const result: Result<WeatherDataV2, DOMException | TypeError> = await weather.getWeatherByCity('Helsinki', 'fi', {lang: 'fi'});
602
- * if (result.isOk) {
603
- * const weatherData: WeatherDataV2 = result.ok();
604
- * } else {
605
- * const error: DOMException | TypeError = result.err();
606
- * }
607
- */
608
- getWeatherByCity(city: string, countryCode?: CountryCode, currentOpts?: Partial<OpenWeatherV2CommonOptions>): Promise<IResult<WeatherDataV2, DOMException | TypeError>>;
609
- /**
610
- * get weather with latitude and longitude with Result
611
- * @param {number} lat - Latitude
612
- * @param {number} lon - Longitude
613
- * @param {OpenWeatherV2CommonOptions=} currentOpts - Common options, example ```{lang: 'fi', units: 'metric'}```, defaults ```{lang: 'en', units: 'standard'}```
614
- * @return {Promise<Result<WeatherDataV2, DOMException | TypeError>>} Weather data Result Promise
615
- * @example
616
- * const result: Result<WeatherDataV2, DOMException | TypeError> = await weather.getWeatherByLatLon(60.1699, 24.9384, {lang: 'fi'});
617
- * if (result.isOk) {
618
- * const weatherData: WeatherDataV2 = result.ok();
619
- * } else {
620
- * const error: DOMException | TypeError = result.err();
621
- * }
622
- */
623
- getWeatherByLatLon(lat: number, lon: number, currentOpts?: Partial<OpenWeatherV2CommonOptions>): Promise<IResult<WeatherDataV2, DOMException | TypeError>>;
624
- private buildBaseParams;
625
- /**
626
- * build base cache key
627
- * @param main - main cache key prefix
628
- * @param opts - OpenWeatherV2CommonOptions
629
- * @returns {string} cache key
630
- */
631
- private buildBaseCacheKey;
632
- private handleFetch;
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 { type CountryCode, CountryCodeList, CountryCodeSchema, type DayIcon, type IOpenWeatherV2, type Icon, type LangCode, type NightIcon, OpenWeatherV2, type OpenWeatherV2CommonOptions, type WeatherDataV2, type WeatherDescription, type WeatherGroup, type WeatherID, assertWeatherDataV2, fetchErrorWrapper, getWeatherV2Description, iconSchema, isWeatherDataV2, langCodeSchema, langCodes, weatherDataV2Schema, weatherIdGroup, weatherIdSchema };
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