-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.d.ts
165 lines (144 loc) · 3.27 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
import {LocationProfile} from './classes/LocationManager';
import {NavigatorScreenParams} from '@react-navigation/native';
import {SettingsSection} from './Settings';
export type RootStackParamList = {
Home: undefined;
Forecasts: ForecastResult;
Locations: undefined;
Settings: undefined;
};
export type LocationStackParamList = {
Asdf: NavigatorScreenParams<RootStackParamList>;
Index: CoreGeocodeLocation | undefined;
Search: undefined;
};
export type SettingsStackParamList = {
Asdf: NavigatorScreenParams<RootStackParamList>;
Index: undefined;
Setting: SettingsSection;
};
export interface BaseCoordinates {
latitude: number;
longitude: number;
elevation: number | null;
}
export interface WeatherDataOptions {
location: BaseCoordinates;
timezone: string;
}
export interface RawWeatherData {
daily: {
sunrise: number[];
sunset: number[];
time: number[];
[key: string];
};
daily_units: {
sunrise: string;
sunset: string;
time: string;
[key: string];
};
elevation: number;
generationtime_ms: number;
hourly: {
cloudcover_high: number[];
cloudcover_mid: number[];
cloudcover_low: number[];
precipitation: number[];
rain: number[];
relativehumidity_150hPa: number[];
relativehumidity_500hPa: number[];
relativehumidity_1000hPa: number[];
temperature_2m: number[];
visibility: number[];
windspeed_80m: number[];
windspeed_120m: number[];
windspeed_180m: number[];
time: number[];
// [key: string]: number[];
};
hourly_units: {
cloudcover_high: string;
cloudcover_mid: string;
cloudcover_low: string;
precipitation: string;
rain: string;
temperature_2m: string;
visibility: string;
relativehumidity_150hPa: string;
relativehumidity_500hPa: string;
relativehumidity_1000hPa: string;
windspeed_10m: string;
windspeed_80m: string;
windspeed_120m: string;
windspeed_180m: string;
[key: string];
};
latitude: number;
longitude: number;
timezone: string;
timezone_abbreviation: string;
utc_offset_seconds: number;
}
export interface ForecastedData {
sunsetQuality: number;
info: {
sunrise: Date;
sunset: Date;
};
}
export interface RawGeocodeLocation {
id: number;
name: string;
latitude: number;
longitude: number;
elevation: number;
feature_code: string;
country_code: string;
admin1_id: number;
admin2_id: number;
admin3_id: number;
admin4_id: number;
timezone: string;
population: number;
postcodes: string[];
country_id: number;
country: string;
admin1: string;
admin2?: string;
admin3?: string;
admin4?: string;
}
export interface RawGeocodeData {
generationtime_ms: number;
results?: RawGeocodeLocation[];
}
export interface CoreGeocodeLocation
extends Omit<
RawGeocodeLocation,
| 'feature_code'
| 'admin2'
| 'admin3'
| 'admin4'
| 'country_id'
| 'country_code'
| 'population'
| 'admin1_id'
| 'admin2_id'
| 'admin3_id'
| 'admin4_id'
| 'postcodes'
> {}
type SunTime = 'sunrise' | 'sunset';
interface Forecast {
quality: number;
type: SunTime;
}
interface UpcomingForecast extends Forecast {
date: number;
}
export interface ForecastResult {
current: Forecast;
upcoming: UpcomingForecast[];
}