Documentation
¶
Overview ¶
Package airquality is the library behind the airquality command line: the HTTP client, request shaping, and the typed data models for the Open-Meteo Air Quality API.
The Client sets a real User-Agent, paces requests, and retries transient failures (429 and 5xx). All endpoint calls and JSON decoding build on top.
Index ¶
Constants ¶
const BaseURL = "https://" + Host
BaseURL is the root every request is built from.
const DefaultUserAgent = "airquality/dev (+https://github.com/tamnd/airquality-cli)"
DefaultUserAgent identifies the client to Open-Meteo.
const Host = "air-quality-api.open-meteo.com"
Host is the Open-Meteo Air Quality API host.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AirQuality ¶
type AirQuality struct {
Time string `kit:"id" json:"time"`
PM10 float64 `json:"pm10"`
PM25 float64 `json:"pm2_5"`
CarbonMonoxide float64 `json:"carbon_monoxide"`
Ozone float64 `json:"ozone"`
SulphurDioxide float64 `json:"sulphur_dioxide"`
NitrogenDioxide float64 `json:"nitrogen_dioxide"`
UVIndex float64 `json:"uv_index"`
}
AirQuality holds one hour of air quality measurements at a location.
type Client ¶
type Client struct {
HTTP *http.Client
UserAgent string
// Rate is the minimum gap between requests. Zero means no pacing.
Rate time.Duration
Retries int
// contains filtered or unexported fields
}
Client talks to the Open-Meteo Air Quality API over HTTP.
func NewClient ¶
func NewClient() *Client
NewClient returns a Client with sensible defaults: a 30s timeout, a 200ms minimum gap between requests, and five retries on transient errors.
type Domain ¶
type Domain struct{}
Domain is the airquality driver.
func (Domain) Classify ¶
Classify turns a lat,lon pattern or a full 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.