Documentation
¶
Overview ¶
Package sunrisesunset is the library behind the sunrisesunset command line: the HTTP client, request shaping, and the typed data models for the Sunrise-Sunset API (https://api.sunrise-sunset.org).
The Client paces and retries requests to stay polite. Build your endpoint calls and JSON decoding on top of it.
Index ¶
Constants ¶
const Host = "api.sunrise-sunset.org"
Host is the API host 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 the Sunrise-Sunset API 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 api.sunrise-sunset.org.
type Domain ¶
type Domain struct{}
Domain is the sunrisesunset driver.
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 SunTimes ¶
type SunTimes struct {
Lat string `kit:"id" json:"lat" table:"lat"`
Lng string `json:"lng" table:"lng"`
Date string `json:"date" table:"date"`
Sunrise string `json:"sunrise" table:"sunrise"`
Sunset string `json:"sunset" table:"sunset"`
SolarNoon string `json:"solar_noon" table:"solar_noon"`
DayLengthHours string `json:"day_length_hours" table:"day_length_hours"`
CivilTwilightBegin string `json:"civil_twilight_begin" table:"civil_twilight_begin"`
CivilTwilightEnd string `json:"civil_twilight_end" table:"civil_twilight_end"`
}
SunTimes is one record: the solar event times for a given location and date.