-
Notifications
You must be signed in to change notification settings - Fork 0
/
darksky.go
123 lines (122 loc) · 5.82 KB
/
darksky.go
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
package main
// DarkSkyData uses the Dark Sky API to get the forecast for
// any geographical coordinate on earth. The DarkSkyData struct
// includes the all the available data. Note that you can change
// which type of weather data you want Dark Sky to return by
// changing the quary parameters. If you do that, you'll want to
// change which data gets included in the DarkSkyData struct.
//
// Add a Dark Sky API key to your .env file.
type DarkSkyData struct {
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Timezone string `json:"timezone"`
Currently struct {
Time int `json:"time"`
Summary string `json:"summary"`
Icon string `json:"icon"`
NearestStormDistance int `json:"nearestStormDistance"`
PrecipIntensity float64 `json:"precipIntensity"`
PrecipIntensityError float64 `json:"precipIntensityError"`
PrecipProbability float64 `json:"precipProbability"`
PrecipType string `json:"precipType"`
Temperature float64 `json:"temperature"`
ApparentTemperature float64 `json:"apparentTemperature"`
DewPoint float64 `json:"dewPoint"`
Humidity float64 `json:"humidity"`
Pressure float64 `json:"pressure"`
WindSpeed float64 `json:"windSpeed"`
WindGust float64 `json:"windGust"`
WindBearing int `json:"windBearing"`
CloudCover float64 `json:"cloudCover"`
UvIndex int `json:"uvIndex"`
Visibility float64 `json:"visibility"`
Ozone float64 `json:"ozone"`
} `json:"currently"`
Minutely struct {
Summary string `json:"summary"`
Icon string `json:"icon"`
Data []struct {
Time int `json:"time"`
PrecipIntensity float64 `json:"precipIntensity"`
PrecipProbability float64 `json:"precipProbability"`
PrecipIntensityError float64 `json:"precipIntensityError,omitempty"`
PrecipType string `json:"precipType,omitempty"`
} `json:"data"`
} `json:"minutely"`
Hourly struct {
Summary string `json:"summary"`
Icon string `json:"icon"`
Data []struct {
Time int `json:"time"`
Summary string `json:"summary"`
Icon string `json:"icon"`
PrecipIntensity float64 `json:"precipIntensity"`
PrecipProbability float64 `json:"precipProbability"`
PrecipType string `json:"precipType,omitempty"`
Temperature float64 `json:"temperature"`
ApparentTemperature float64 `json:"apparentTemperature"`
DewPoint float64 `json:"dewPoint"`
Humidity float64 `json:"humidity"`
Pressure float64 `json:"pressure"`
WindSpeed float64 `json:"windSpeed"`
WindGust float64 `json:"windGust"`
WindBearing int `json:"windBearing"`
CloudCover float64 `json:"cloudCover"`
UvIndex int `json:"uvIndex"`
Visibility float64 `json:"visibility"`
Ozone float64 `json:"ozone"`
} `json:"data"`
} `json:"hourly"`
Daily struct {
Summary string `json:"summary"`
Icon string `json:"icon"`
Data []struct {
Time int `json:"time"`
Summary string `json:"summary"`
Icon string `json:"icon"`
SunriseTime int `json:"sunriseTime"`
SunsetTime int `json:"sunsetTime"`
MoonPhase float64 `json:"moonPhase"`
PrecipIntensity float64 `json:"precipIntensity"`
PrecipIntensityMax float64 `json:"precipIntensityMax"`
PrecipIntensityMaxTime int `json:"precipIntensityMaxTime"`
PrecipProbability float64 `json:"precipProbability"`
PrecipType string `json:"precipType"`
TemperatureHigh float64 `json:"temperatureHigh"`
TemperatureHighTime int `json:"temperatureHighTime"`
TemperatureLow float64 `json:"temperatureLow"`
TemperatureLowTime int `json:"temperatureLowTime"`
ApparentTemperatureHigh float64 `json:"apparentTemperatureHigh"`
ApparentTemperatureHighTime int `json:"apparentTemperatureHighTime"`
ApparentTemperatureLow float64 `json:"apparentTemperatureLow"`
ApparentTemperatureLowTime int `json:"apparentTemperatureLowTime"`
DewPoint float64 `json:"dewPoint"`
Humidity float64 `json:"humidity"`
Pressure float64 `json:"pressure"`
WindSpeed float64 `json:"windSpeed"`
WindGust float64 `json:"windGust"`
WindGustTime int `json:"windGustTime"`
WindBearing int `json:"windBearing"`
CloudCover float64 `json:"cloudCover"`
UvIndex int `json:"uvIndex"`
UvIndexTime int `json:"uvIndexTime"`
Visibility float64 `json:"visibility"`
Ozone float64 `json:"ozone"`
TemperatureMin float64 `json:"temperatureMin"`
TemperatureMinTime int `json:"temperatureMinTime"`
TemperatureMax float64 `json:"temperatureMax"`
TemperatureMaxTime int `json:"temperatureMaxTime"`
ApparentTemperatureMin float64 `json:"apparentTemperatureMin"`
ApparentTemperatureMinTime int `json:"apparentTemperatureMinTime"`
ApparentTemperatureMax float64 `json:"apparentTemperatureMax"`
ApparentTemperatureMaxTime int `json:"apparentTemperatureMaxTime"`
} `json:"data"`
} `json:"daily"`
Flags struct {
Sources []string `json:"sources"`
NearestStation float64 `json:"nearest-station"`
Units string `json:"units"`
} `json:"flags"`
Offset int `json:"offset"`
}