1 | import { FixedLengthArray } from "type-fest";
|
2 | export interface OWMServiceOptions {
|
3 | appid: string;
|
4 | v: string;
|
5 | lang: Lang;
|
6 | mode: Mode;
|
7 | units: Unit;
|
8 | }
|
9 | export interface WithAppId {
|
10 | appid: string;
|
11 | }
|
12 | export interface WithV {
|
13 | v: string;
|
14 | }
|
15 | export interface QueryByCityName {
|
16 | q: string;
|
17 | }
|
18 | export interface QueryByCityId {
|
19 | id: number;
|
20 | }
|
21 | export interface QueryByGeoCoordinates {
|
22 | lat: Latitude;
|
23 | lon: Longitude;
|
24 | }
|
25 | export interface QueryByZipCode {
|
26 | zip: string;
|
27 | }
|
28 | export declare type QueryParams = QueryByCityId & QueryByCityName & QueryByGeoCoordinates & QueryByZipCode & WithAppId & WithLangModeUnits;
|
29 | export interface WithLang {
|
30 | lang: Lang;
|
31 | }
|
32 | export interface WithMode {
|
33 | mode: Mode;
|
34 | }
|
35 | export interface WithUnits {
|
36 | units: Unit;
|
37 | }
|
38 | export declare type WithLangModeUnits = WithLang & WithMode & WithUnits;
|
39 | export interface ByCityName {
|
40 | cityName: string;
|
41 | stateCode?: string;
|
42 | countryCode?: string;
|
43 | }
|
44 | export interface ByCityId {
|
45 | cityId: number;
|
46 | }
|
47 | export interface ByGeoGraphicCoordinates {
|
48 | lat: Latitude;
|
49 | lon: Longitude;
|
50 | }
|
51 | export interface ByZipCode {
|
52 | zipCode: string;
|
53 | countryCode?: string;
|
54 | }
|
55 | export declare type Unit = "standard" | "metric" | "imperial";
|
56 | export declare type Mode = "json" | "html" | "xml";
|
57 | export declare type Kelvin = number;
|
58 | export declare type Celsius = number;
|
59 | export declare type Fahrenheit = number;
|
60 | export declare type Longitude = number;
|
61 | export declare type Latitude = number;
|
62 | export declare type Lang = "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_br" | "ro" | "ru" | "sv, se" | "sk" | "sl" | "sp, es" | "sr" | "th" | "tr" | "ua, uk" | "vi" | "zh_cn" | "zh_tw" | "zu";
|
63 | export declare type WeatherCondition = {
|
64 | id: 200;
|
65 | main: "Thunderstorm";
|
66 | description: "thunderstorm with light rain";
|
67 | icon: "11d" | "11n";
|
68 | } | {
|
69 | id: 201;
|
70 | main: "Thunderstorm";
|
71 | description: "thunderstorm with rain";
|
72 | icon: "11d" | "11n";
|
73 | } | {
|
74 | id: 202;
|
75 | main: "Thunderstorm";
|
76 | description: "thunderstorm with heavy rain";
|
77 | icon: "11d" | "11n";
|
78 | } | {
|
79 | id: 210;
|
80 | main: "Thunderstorm";
|
81 | description: "light thunderstorm";
|
82 | icon: "11d" | "11n";
|
83 | } | {
|
84 | id: 211;
|
85 | main: "Thunderstorm";
|
86 | description: "thunderstorm";
|
87 | icon: "11d" | "11n";
|
88 | } | {
|
89 | id: 212;
|
90 | main: "Thunderstorm";
|
91 | description: "heavy thunderstorm";
|
92 | icon: "11d" | "11n";
|
93 | } | {
|
94 | id: 221;
|
95 | main: "Thunderstorm";
|
96 | description: "ragged thunderstorm";
|
97 | icon: "11d" | "11n";
|
98 | } | {
|
99 | id: 230;
|
100 | main: "Thunderstorm";
|
101 | description: "thunderstorm with light drizzle";
|
102 | icon: "11d" | "11n";
|
103 | } | {
|
104 | id: 231;
|
105 | main: "Thunderstorm";
|
106 | description: "thunderstorm with drizzle";
|
107 | icon: "11d" | "11n";
|
108 | } | {
|
109 | id: 232;
|
110 | main: "Thunderstorm";
|
111 | description: "thunderstorm with heavy drizzle";
|
112 | icon: "11d" | "11n";
|
113 | } | {
|
114 | id: 300;
|
115 | main: "Drizzle";
|
116 | description: "light intensity drizzle";
|
117 | icon: "09d" | "09n";
|
118 | } | {
|
119 | id: 301;
|
120 | main: "Drizzle";
|
121 | description: "drizzle";
|
122 | icon: "09d" | "09n";
|
123 | } | {
|
124 | id: 302;
|
125 | main: "Drizzle";
|
126 | description: "heavy intensity drizzle";
|
127 | icon: "09d" | "09n";
|
128 | } | {
|
129 | id: 310;
|
130 | main: "Drizzle";
|
131 | description: "light intensity drizzle rain";
|
132 | icon: "09d" | "09n";
|
133 | } | {
|
134 | id: 311;
|
135 | main: "Drizzle";
|
136 | description: "drizzle rain";
|
137 | icon: "09d" | "09n";
|
138 | } | {
|
139 | id: 312;
|
140 | main: "Drizzle";
|
141 | description: "heavy intensity drizzle rain";
|
142 | icon: "09d" | "09n";
|
143 | } | {
|
144 | id: 313;
|
145 | main: "Drizzle";
|
146 | description: "shower rain and drizzle";
|
147 | icon: "09d" | "09n";
|
148 | } | {
|
149 | id: 314;
|
150 | main: "Drizzle";
|
151 | description: "heavy shower rain and drizzle";
|
152 | icon: "09d" | "09n";
|
153 | } | {
|
154 | id: 321;
|
155 | main: "Drizzle";
|
156 | description: "shower drizzle";
|
157 | icon: "09d" | "09n";
|
158 | } | {
|
159 | id: 500;
|
160 | main: "Rain";
|
161 | description: "light rain";
|
162 | icon: "10d" | "10n";
|
163 | } | {
|
164 | id: 501;
|
165 | main: "Rain";
|
166 | description: "moderate rain";
|
167 | icon: "10d" | "10n";
|
168 | } | {
|
169 | id: 502;
|
170 | main: "Rain";
|
171 | description: "heavy intensity rain";
|
172 | icon: "10d" | "10n";
|
173 | } | {
|
174 | id: 503;
|
175 | main: "Rain";
|
176 | description: "very heavy rain";
|
177 | icon: "10d" | "10n";
|
178 | } | {
|
179 | id: 504;
|
180 | main: "Rain";
|
181 | description: "extreme rain";
|
182 | icon: "10d" | "10n";
|
183 | } | {
|
184 | id: 511;
|
185 | main: "Rain";
|
186 | description: "freezing rain";
|
187 | icon: "13d" | "13n";
|
188 | } | {
|
189 | id: 520;
|
190 | main: "Rain";
|
191 | description: "light intensity shower rain";
|
192 | icon: "09d" | "09n";
|
193 | } | {
|
194 | id: 521;
|
195 | main: "Rain";
|
196 | description: "shower rain";
|
197 | icon: "09d" | "09n";
|
198 | } | {
|
199 | id: 522;
|
200 | main: "Rain";
|
201 | description: "heavy intensity shower rain";
|
202 | icon: "09d" | "09n";
|
203 | } | {
|
204 | id: 531;
|
205 | main: "Rain";
|
206 | description: "ragged shower rain";
|
207 | icon: "09d" | "09n";
|
208 | } | {
|
209 | id: 600;
|
210 | main: "Snow";
|
211 | description: "light snow";
|
212 | icon: "13d" | "13n";
|
213 | } | {
|
214 | id: 601;
|
215 | main: "Snow";
|
216 | description: "Snow";
|
217 | icon: "13d" | "13n";
|
218 | } | {
|
219 | id: 602;
|
220 | main: "Snow";
|
221 | description: "Heavy snow";
|
222 | icon: "13d" | "13n";
|
223 | } | {
|
224 | id: 611;
|
225 | main: "Snow";
|
226 | description: "Sleet";
|
227 | icon: "13d" | "13n";
|
228 | } | {
|
229 | id: 612;
|
230 | main: "Snow";
|
231 | description: "Light shower sleet";
|
232 | icon: "13d" | "13n";
|
233 | } | {
|
234 | id: 613;
|
235 | main: "Snow";
|
236 | description: "Shower sleet";
|
237 | icon: "13d" | "13n";
|
238 | } | {
|
239 | id: 615;
|
240 | main: "Snow";
|
241 | description: "Light rain and snow";
|
242 | icon: "13d" | "13n";
|
243 | } | {
|
244 | id: 616;
|
245 | main: "Snow";
|
246 | description: "Rain and snow";
|
247 | icon: "13d" | "13n";
|
248 | } | {
|
249 | id: 620;
|
250 | main: "Snow";
|
251 | description: "Light shower snow";
|
252 | icon: "13d" | "13n";
|
253 | } | {
|
254 | id: 621;
|
255 | main: "Snow";
|
256 | description: "Shower snow";
|
257 | icon: "13d" | "13n";
|
258 | } | {
|
259 | id: 622;
|
260 | main: "Snow";
|
261 | description: "Heavy shower snow";
|
262 | icon: "13d" | "13n";
|
263 | } | {
|
264 | id: 701;
|
265 | main: "Mist";
|
266 | description: "mist";
|
267 | icon: "50d" | "50n";
|
268 | } | {
|
269 | id: 711;
|
270 | main: "Smoke";
|
271 | description: "Smoke";
|
272 | icon: "50d" | "50n";
|
273 | } | {
|
274 | id: 721;
|
275 | main: "Haze";
|
276 | description: "Haze";
|
277 | icon: "50d" | "50n";
|
278 | } | {
|
279 | id: 731;
|
280 | main: "Dust";
|
281 | description: "sand/ dust whirls";
|
282 | icon: "50d" | "50n";
|
283 | } | {
|
284 | id: 741;
|
285 | main: "Fog";
|
286 | description: "fog";
|
287 | icon: "50d" | "50n";
|
288 | } | {
|
289 | id: 751;
|
290 | main: "Sand";
|
291 | description: "sand";
|
292 | icon: "50d" | "50n";
|
293 | } | {
|
294 | id: 761;
|
295 | main: "Dust";
|
296 | description: "dust";
|
297 | icon: "50d" | "50n";
|
298 | } | {
|
299 | id: 762;
|
300 | main: "Ash";
|
301 | description: "volcanic ash";
|
302 | icon: "50d" | "50n";
|
303 | } | {
|
304 | id: 771;
|
305 | main: "Squall";
|
306 | description: "squalls";
|
307 | icon: "50d" | "50n";
|
308 | } | {
|
309 | id: 781;
|
310 | main: "Tornado";
|
311 | description: "tornado";
|
312 | icon: "50d" | "50n";
|
313 | } | {
|
314 | id: 800;
|
315 | main: "Clear";
|
316 | description: "clear sky";
|
317 | icon: "01d" | "01n";
|
318 | } | {
|
319 | id: 801;
|
320 | main: "Clouds";
|
321 | description: "few clouds";
|
322 | icon: "02d" | "02n";
|
323 | } | {
|
324 | id: 802;
|
325 | main: "Clouds";
|
326 | description: "scattered clouds";
|
327 | icon: "03d" | "03n";
|
328 | } | {
|
329 | id: 803;
|
330 | main: "Clouds";
|
331 | description: "broken clouds";
|
332 | icon: "04d" | "04n";
|
333 | } | {
|
334 | id: 804;
|
335 | main: "Clouds";
|
336 | description: "overcast clouds";
|
337 | icon: "04d" | "04n";
|
338 | };
|
339 | export declare type Endpoint = "weather" | "forecast/hourly" | "onecall" | "forecast/daily" | "forecast/climate" | "forecast" | "air_pollution" | "air_pollution/forecast" | "air_pollution/history";
|
340 | export declare type T = number;
|
341 | export declare type AnyData = CurrentWeatherDataData | OneCallData | DailyForecast16DaysData | ClimaticForeCast30DaysData | FiveDay3HourForecastData | HourlyForecast4DaysData | AirPollutionCurrentData | AirPollutionForecastData | AirPollutionHistoricalData;
|
342 | export declare type AnyResult = CurrentWeatherDataResult | OneCallResult | DailyForecast16DaysResult | ClimaticForeCast30DaysResult | FiveDay3HourForecastResult | HourlyForecast4DaysResult | AirPollutionResult;
|
343 | export declare type CurrentWeatherDataData = (ByCityName | ByCityId | ByGeoGraphicCoordinates | ByZipCode) & Partial<WithAppId & WithV & WithLang & WithUnits>;
|
344 | export interface CurrentWeatherDataResult {
|
345 | base: string;
|
346 | clouds: {
|
347 | all: number;
|
348 | };
|
349 | cod: number;
|
350 | coord: {
|
351 | lon: Longitude;
|
352 | lat: Latitude;
|
353 | };
|
354 | dt: number;
|
355 | id: number;
|
356 | main: {
|
357 | temp: T;
|
358 | feels_like: T;
|
359 | temp_min: T;
|
360 | temp_max: T;
|
361 | pressure: number;
|
362 | humidity: number;
|
363 | };
|
364 | name: string;
|
365 | rain?: {
|
366 | "1h"?: number;
|
367 | "3h"?: number;
|
368 | };
|
369 | snow?: {
|
370 | "1h"?: number;
|
371 | "3h"?: number;
|
372 | };
|
373 | sys: {
|
374 | type: number;
|
375 | id: number;
|
376 | message: number;
|
377 | country: string;
|
378 | sunrise: number;
|
379 | sunset: number;
|
380 | };
|
381 | timezone: number;
|
382 | visibility: number;
|
383 | weather: [WeatherCondition];
|
384 | wind: {
|
385 | deg: number;
|
386 | speed: number;
|
387 | };
|
388 | }
|
389 | export declare type OneCallData = ByGeoGraphicCoordinates & {
|
390 | exclude?: ("current" | "minutely" | "hourly" | "daily" | "alerts")[];
|
391 | } & Partial<WithAppId & WithV & WithLangModeUnits>;
|
392 | export interface OneCallResult {
|
393 | current: OneCallResultCurrent;
|
394 | daily: FixedLengthArray<OneCallResultDaily, 8>;
|
395 | hourly: FixedLengthArray<OneCallResultHourly, 48>;
|
396 | lat: Latitude;
|
397 | lon: Longitude;
|
398 | minutely: FixedLengthArray<OneCallResultMinutely, 61>;
|
399 | timezone: string;
|
400 | timezone_offset: number;
|
401 | }
|
402 | export interface OneCallResultCurrent {
|
403 | clouds: number;
|
404 | dew_point: number;
|
405 | dt: number;
|
406 | feels_like: number;
|
407 | humidity: number;
|
408 | pressure: number;
|
409 | sunrise: number;
|
410 | sunset: number;
|
411 | temp: number;
|
412 | uvi: number;
|
413 | visibility: number;
|
414 | weather: [WeatherCondition];
|
415 | wind_deg: number;
|
416 | wind_speed: number;
|
417 | }
|
418 | export interface OneCallResultDaily {
|
419 | clouds: number;
|
420 | dew_point: number;
|
421 | dt: number;
|
422 | feels_like: {
|
423 | day: number;
|
424 | eve: number;
|
425 | morn: number;
|
426 | night: number;
|
427 | };
|
428 | humidity: number;
|
429 | moon_phase: number;
|
430 | moonrise: number;
|
431 | moonset: number;
|
432 | pop: number;
|
433 | pressure: number;
|
434 | rain: number;
|
435 | sunrise: number;
|
436 | sunset: number;
|
437 | temp: {
|
438 | day: number;
|
439 | eve: number;
|
440 | max: number;
|
441 | min: number;
|
442 | morn: number;
|
443 | night: number;
|
444 | };
|
445 | uvi: number;
|
446 | weather: [WeatherCondition];
|
447 | wind_deg: number;
|
448 | wind_gust: number;
|
449 | wind_speed: number;
|
450 | }
|
451 | export interface OneCallResultHourly {
|
452 | clouds: number;
|
453 | dew_point: number;
|
454 | dt: number;
|
455 | feels_like: number;
|
456 | humidity: number;
|
457 | pop: number;
|
458 | pressure: number;
|
459 | temp: number;
|
460 | uvi: number;
|
461 | visibility: number;
|
462 | weather: [WeatherCondition];
|
463 | wind_deg: number;
|
464 | wind_gust: number;
|
465 | wind_speed: number;
|
466 | }
|
467 | export interface OneCallResultMinutely {
|
468 | dt: number;
|
469 | precipitation: number;
|
470 | }
|
471 | export declare type FiveDay3HourForecastData = (ByCityName | ByCityId | ByGeoGraphicCoordinates | ByZipCode) & Partial<WithAppId & WithV & WithLangModeUnits> & {
|
472 | cnt?: number;
|
473 | };
|
474 | export interface FiveDay3HourForecastResult {
|
475 | cod: number;
|
476 | message: number;
|
477 | cnt: number;
|
478 | list: {
|
479 | dt: number;
|
480 | main: {
|
481 | temp: T;
|
482 | feels_like: T;
|
483 | temp_min: T;
|
484 | temp_max: T;
|
485 | pressure: number;
|
486 | sea_level: number;
|
487 | grnd_level: number;
|
488 | humidity: number;
|
489 | };
|
490 | weather: [WeatherCondition];
|
491 | clouds: {
|
492 | all: number;
|
493 | };
|
494 | wind: {
|
495 | speed: number;
|
496 | deg: number;
|
497 | gust: number;
|
498 | };
|
499 | visibility: number;
|
500 | pop: number;
|
501 | rain?: {
|
502 | "3h": number;
|
503 | };
|
504 | snow?: {
|
505 | "3h": number;
|
506 | };
|
507 | sys: {
|
508 | pod: "d" | "n";
|
509 | };
|
510 | dt_txt: string;
|
511 | }[];
|
512 | city: {
|
513 | id: number;
|
514 | name: string;
|
515 | coord: {
|
516 | lat: Latitude;
|
517 | lon: Longitude;
|
518 | };
|
519 | country: string;
|
520 | timezone: number;
|
521 | sunrise: number;
|
522 | sunset: number;
|
523 | };
|
524 | }
|
525 | export declare type HourlyForecast4DaysData = (ByCityName | ByCityId | ByGeoGraphicCoordinates | ByZipCode) & Partial<WithAppId & WithV & WithLangModeUnits> & {
|
526 | cnt?: number;
|
527 | };
|
528 | export interface HourlyForecast4DaysResult {
|
529 | cod: number;
|
530 | message: number;
|
531 | cnt: number;
|
532 | list: {
|
533 | dt: number;
|
534 | main: {
|
535 | temp: T;
|
536 | feels_like: T;
|
537 | temp_min: T;
|
538 | temp_max: T;
|
539 | pressure: number;
|
540 | sea_level: number;
|
541 | grnd_level: number;
|
542 | humidity: number;
|
543 | temp_kf: number;
|
544 | };
|
545 | weather: [WeatherCondition];
|
546 | clouds: {
|
547 | all: number;
|
548 | };
|
549 | wind: {
|
550 | speed: number;
|
551 | deg: number;
|
552 | gust: number;
|
553 | };
|
554 | visibility: number;
|
555 | pop: number;
|
556 | sys: {
|
557 | pod: string;
|
558 | };
|
559 | dt_txt: string;
|
560 | }[];
|
561 | city: {
|
562 | id: number;
|
563 | name: string;
|
564 | coord: {
|
565 | lat: Latitude;
|
566 | lon: Longitude;
|
567 | };
|
568 | country: string;
|
569 | timezone: number;
|
570 | sunrise: number;
|
571 | sunset: number;
|
572 | };
|
573 | }
|
574 | export declare type DailyForecast16DaysData = (ByCityName | ByCityId | ByGeoGraphicCoordinates | ByZipCode) & Partial<WithAppId & WithV & WithLangModeUnits> & {
|
575 | cnt?: number;
|
576 | };
|
577 | export interface DailyForecast16DaysResult {
|
578 | city: {
|
579 | id: number;
|
580 | name: string;
|
581 | coord: {
|
582 | lat: Latitude;
|
583 | lon: Longitude;
|
584 | };
|
585 | country: string;
|
586 | population: number;
|
587 | timezone: number;
|
588 | };
|
589 | cod: number;
|
590 | message: number;
|
591 | cnt: number;
|
592 | list: {
|
593 | dt: number;
|
594 | sunrise: number;
|
595 | sunset: number;
|
596 | temp: {
|
597 | day: T;
|
598 | min: T;
|
599 | max: T;
|
600 | night: T;
|
601 | eve: T;
|
602 | morn: T;
|
603 | };
|
604 | feels_like: {
|
605 | day: T;
|
606 | night: T;
|
607 | eve: T;
|
608 | morn: T;
|
609 | };
|
610 | pressure: number;
|
611 | humidity: number;
|
612 | weather: [WeatherCondition];
|
613 | speed: number;
|
614 | deg: number;
|
615 | gust: number;
|
616 | clouds: number;
|
617 | pop: number;
|
618 | }[];
|
619 | }
|
620 | export declare type ClimaticForeCast30DaysData = (ByCityName | ByCityId | ByGeoGraphicCoordinates | ByZipCode) & Partial<WithAppId & WithV & WithLangModeUnits> & {
|
621 | cnt?: number;
|
622 | };
|
623 | export interface ClimaticForeCast30DaysResult {
|
624 | cod: number;
|
625 | city: {
|
626 | id: number;
|
627 | name: string;
|
628 | coord: {
|
629 | lat: Latitude;
|
630 | lon: Longitude;
|
631 | };
|
632 | country: string;
|
633 | };
|
634 | message: string;
|
635 | list: {
|
636 | dt: number;
|
637 | sunrise: number;
|
638 | sunset: number;
|
639 | temp: {
|
640 | day: T;
|
641 | min: T;
|
642 | max: T;
|
643 | night: T;
|
644 | eve: T;
|
645 | morn: T;
|
646 | };
|
647 | pressure: number;
|
648 | humidity: number;
|
649 | weather: [WeatherCondition];
|
650 | speed: number;
|
651 | deg: number;
|
652 | clouds: number;
|
653 | rain: number;
|
654 | }[];
|
655 | }
|
656 | export declare type AirPollutionCurrentData = ByGeoGraphicCoordinates & Partial<WithAppId & WithV>;
|
657 | export declare type AirPollutionForecastData = ByGeoGraphicCoordinates & Partial<WithAppId & WithV>;
|
658 | export declare type AirPollutionHistoricalData = ByGeoGraphicCoordinates & Partial<WithAppId & WithV> & {
|
659 | start: number;
|
660 | end: number;
|
661 | };
|
662 | export interface AirPollutionResult {
|
663 | coord: [
|
664 | number,
|
665 | number
|
666 | ];
|
667 | list: {
|
668 | dt: number;
|
669 | main: {
|
670 | aqi: 1 | 2 | 3 | 4 | 5;
|
671 | };
|
672 | components: {
|
673 | co: number;
|
674 | no: number;
|
675 | no2: number;
|
676 | o3: number;
|
677 | so2: number;
|
678 | pm2_5: number;
|
679 | pm10: number;
|
680 | nh3: number;
|
681 | };
|
682 | }[];
|
683 | }
|