Documentation
¶
Overview ¶
Package wttr is the library behind the wttr command line: the HTTP client, request shaping, and the typed data models for the wttr.in API (weather for any city, no key required).
The Client is the spine every command shares. It sets a real User-Agent, paces requests so a busy session stays polite, and retries the transient failures (429 and 5xx) that any public API throws under load.
Index ¶
Constants ¶
const Host = "wttr.in"
Host is the site this client talks to.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to wttr.in over HTTP.
type Config ¶
type Config struct {
BaseURL string
UserAgent string
Rate time.Duration
Timeout time.Duration
Retries int
}
Config holds all tuneable parameters for a Client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the production configuration for wttr.in.
type Current ¶ added in v0.1.1
type Current struct {
Location string `kit:"id" json:"location"`
TempC string `json:"temp_c"`
TempF string `json:"temp_f"`
FeelsLikeC string `json:"feels_like_c"`
Humidity string `json:"humidity"`
WindKmph string `json:"wind_kmph"`
WindDir string `json:"wind_dir"`
Description string `json:"description"`
Visibility string `json:"visibility_km"`
UV string `json:"uv_index"`
}
Current holds the current weather conditions for a location.
type Domain ¶
type Domain struct{}
Domain is the wttr driver.
func (Domain) Classify ¶
Classify turns a location string or wttr.in URL into the canonical (type, id).
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.
type ForecastDay ¶ added in v0.1.1
type ForecastDay struct {
Date string `kit:"id" json:"date"`
MaxC string `json:"max_c"`
MinC string `json:"min_c"`
MaxF string `json:"max_f"`
MinF string `json:"min_f"`
Sunrise string `json:"sunrise"`
Sunset string `json:"sunset"`
}
ForecastDay holds the weather forecast for one day.