Documentation
¶
Overview ¶
Package boredapi is the library behind the boredapi command line: the HTTP client, request shaping, and typed data models for the Bored API.
The Client sets a real User-Agent, paces requests, and retries transient failures (429 and 5xx) with exponential backoff. One operation is provided: get a random activity suggestion, with optional filters by type, participants, or key.
Index ¶
Constants ¶
const BaseURL = "https://" + Host
BaseURL is the root every request is built from.
const Host = "bored.api.lewagon.com"
Host is the site this client talks to.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Activity ¶
type Activity struct {
Key string `kit:"id" json:"key"`
Activity string `json:"activity"`
Type string `json:"type"`
Participants int `json:"participants"`
Price string `json:"price"`
Accessibility string `json:"accessibility"`
Link string `json:"link"`
}
Activity is the public output record for the activity operation.
type ActivityFilter ¶
ActivityFilter holds optional query parameters for GetActivity.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the Bored API over HTTP.
func (*Client) GetActivity ¶
GetActivity returns a random activity, optionally filtered.
type Config ¶
type Config struct {
BaseURL string
UserAgent string
Rate time.Duration
Timeout time.Duration
Retries int
}
Config holds tunable knobs for the HTTP client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns sensible defaults for production use.
type Domain ¶
type Domain struct{}
Domain is the boredapi kit driver. It carries no state; the per-run client is built by the factory Register hands to kit.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, hostnames, and the identity used in help and version.