-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathActivityWeather.go
34 lines (28 loc) · 1017 Bytes
/
ActivityWeather.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
package connect
import (
"fmt"
)
// ActivityWeather describes the weather during an activity.
type ActivityWeather struct {
Temperature int `json:"temp"`
ApparentTemperature int `json:"apparentTemp"`
DewPoint int `json:"dewPoint"`
RelativeHumidity int `json:"relativeHumidity"`
WindDirection int `json:"windDirection"`
WindDirectionCompassPoint string `json:"windDirectionCompassPoint"`
WindSpeed int `json:"windSpeed"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
}
// ActivityWeather returns the reported weather for an activity.
func (c *Client) ActivityWeather(activityID int) (*ActivityWeather, error) {
URL := fmt.Sprintf("https://connect.garmin.com/modern/proxy/weather-service/weather/%d",
activityID,
)
weather := new(ActivityWeather)
err := c.getJSON(URL, weather)
if err != nil {
return nil, err
}
return weather, nil
}