Documentation
¶
Overview ¶
Package nws is the library behind the nws command line: the HTTP client, request shaping, and the typed data models for the US National Weather Service public API (api.weather.gov). No API key required.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct {
Event string `json:"event"`
Severity string `json:"severity"`
AreaDesc string `json:"area_desc"`
Effective string `json:"effective"`
Expires string `json:"expires"`
Description string `json:"description"`
}
Alert is one active weather alert.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to api.weather.gov.
type Config ¶
type Config struct {
BaseURL string
UserAgent string
Rate time.Duration
Retries int
Timeout time.Duration
}
Config holds tunables for the NWS client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with conservative NWS-appropriate defaults. NWS blocks requests that carry no User-Agent.
type Domain ¶
type Domain struct{}
Domain is the NWS driver. It carries no state; the per-run client is built by the factory Register hands kit.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, the identity reused for the binary's help and version.
type ForecastPeriod ¶
type ForecastPeriod struct {
Name string `json:"name"`
ShortForecast string `json:"short_forecast"`
Temperature int `json:"temperature"`
TempUnit string `json:"temp_unit"`
WindSpeed string `json:"wind_speed"`
WindDirection string `json:"wind_direction"`
IsDaytime bool `json:"is_daytime"`
StartTime string `json:"start_time"`
DetailedForecast string `json:"detailed_forecast"`
}
ForecastPeriod is one period in a 7-day or hourly forecast.