Documentation
¶
Overview ¶
Package chucknorris is the library behind the chucknorris command line: the HTTP client, request shaping, and the typed data models for the Chuck Norris joke API at api.chucknorris.io.
The API is completely open — no authentication or API key required. The Client sets a polite User-Agent, paces requests, and retries transient 429 and 5xx failures with exponential backoff.
Index ¶
Constants ¶
const (
// Host is the site this client talks to.
Host = "api.chucknorris.io"
)
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 Chuck Norris API over HTTP.
func (*Client) Categories ¶
Categories returns the list of available joke categories.
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.
type Domain ¶
type Domain struct{}
Domain is the chucknorris 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.