mirror of
https://github.com/sstent/go-garth-cli.git
synced 2025-12-06 08:02:01 +00:00
35 lines
1017 B
Go
35 lines
1017 B
Go
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
|
|
}
|