Documentation
¶
Overview ¶
Package jokeapi is the library behind the jokeapi command line: the HTTP client, request shaping, and the typed data models for official-joke-api.appspot.com.
The Client sets a real User-Agent, paces requests so a busy session stays polite, and retries the transient failures (429 and 5xx) that any public site throws under load.
Index ¶
Constants ¶
const Host = "official-joke-api.appspot.com"
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 official-joke-api.appspot.com over HTTP.
type Config ¶ added in v0.1.1
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 ¶ added in v0.1.1
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults.
type Domain ¶
type Domain struct{}
Domain is the jokeapi 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.