Documentation
¶
Overview ¶
Package nager is the library behind the nager command line: the HTTP client, request shaping, and the typed data models for the Nager.Date public holiday API (date.nager.at).
No API key or authentication is required. The API provides public holiday data for 123 countries.
Index ¶
Constants ¶
const ( // DefaultUserAgent identifies the client to the server. DefaultUserAgent = "nager-cli/dev (+https://github.com/tamnd/nager-cli)" // Host is the site this client talks to. Host = "date.nager.at" )
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 Nager.Date API over HTTP.
type Config ¶
type Config struct {
BaseURL string
UserAgent string
Rate time.Duration
Timeout time.Duration
Retries int
}
Config holds all tunable parameters for the Client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults for the Nager.Date API.
type Country ¶
type Country struct {
Rank int `json:"rank"`
CountryCode string `kit:"id" json:"country_code"`
Name string `json:"name"`
}
Country is one supported country returned by the AvailableCountries endpoint.
type Domain ¶
type Domain struct{}
Domain is the nager 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 Holiday ¶
type Holiday struct {
Rank int `json:"rank"`
Date string `kit:"id" json:"date"`
Name string `json:"name"`
LocalName string `json:"local_name"`
CountryCode string `json:"country_code"`
Global bool `json:"global"`
Types string `json:"types"` // comma-joined list from the API (e.g. "Public")
}
Holiday is one public holiday record returned by Nager.Date.