Documentation ¶
Overview ¶
Package weather contains utilities for obtaining weather statistics from weatherapi.com.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrStatus = errors.New("unexpected status code")
ErrStatus is the error given when an HTTP call to weatherapi.com returns an error status code.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
The Client type is used to interact with the weather API via HTTP.
func (*Client) GetWeather ¶
GetWeather returns the current weather for a given location. Postcodes & city names are valid locations.
type Condition ¶
type Condition struct { Text string `json:"text"` Icon string `json:"icon"` Code int `json:"code"` }
The Condition type represents a summary of the current weather condition.
type GetCurrentWeatherResponse ¶
type GetCurrentWeatherResponse struct { Location Location `json:"location"` Current Weather `json:"current"` }
GetCurrentWeatherResponse represents the response body when requesting the current weather from the weather API.
type Location ¶
type Location struct { Name string `json:"name"` Region string `json:"region"` Country string `json:"country"` Lat float64 `json:"lat"` Lon float64 `json:"lon"` TzID string `json:"tz_id"` LocaltimeEpoch int `json:"localtime_epoch"` Localtime string `json:"localtime"` }
The Location type represents a unique location.
type Weather ¶
type Weather struct { LastUpdatedEpoch int `json:"last_updated_epoch"` LastUpdated string `json:"last_updated"` TempC float64 `json:"temp_c"` TempF float64 `json:"temp_f"` IsDay float64 `json:"is_day"` Condition Condition `json:"condition"` WindMph float64 `json:"wind_mph"` WindKph float64 `json:"wind_kph"` WindDegree float64 `json:"wind_degree"` WindDir string `json:"wind_dir"` PressureMb float64 `json:"pressure_mb"` PressureIn float64 `json:"pressure_in"` PrecipMm float64 `json:"precip_mm"` PrecipIn float64 `json:"precip_in"` Humidity float64 `json:"humidity"` Cloud float64 `json:"cloud"` FeelslikeC float64 `json:"feelslike_c"` FeelslikeF float64 `json:"feelslike_f"` VisKm float64 `json:"vis_km"` VisMiles float64 `json:"vis_miles"` Uv float64 `json:"uv"` GustMph float64 `json:"gust_mph"` GustKph float64 `json:"gust_kph"` }
The Weather type contains fields describing the weather.
Click to show internal directories.
Click to hide internal directories.