Documentation
¶
Overview ¶
Package pragmaticengineer is the library behind the pragmaticengineer command line: the HTTP client, request shaping, and the typed data models for The Pragmatic Engineer.
The Client here is the spine every command shares. It 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 BaseURL = "https://" + Host
BaseURL is the root every request is built from.
const Host = "newsletter.pragmaticengineer.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 The Pragmatic Engineer over HTTP.
type Config ¶
type Config struct {
BaseURL string
Rate time.Duration
Timeout time.Duration
Retries int
UserAgent string
}
Config holds tunables for the Client.
type Domain ¶
type Domain struct{}
Domain is the pragmaticengineer driver. It carries no state; the per-run client is built by the factory Register hands kit.
func (Domain) Classify ¶
Classify turns any accepted input into (type, id). Only "top" is defined for now.
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 Post ¶
type Post struct {
Rank int `json:"rank" csv:"rank" tsv:"rank"`
Date string `json:"date" csv:"date" tsv:"date"`
Audience string `json:"audience" csv:"audience" tsv:"audience"`
Title string `json:"title" csv:"title" tsv:"title"`
Subtitle string `json:"subtitle" csv:"subtitle" tsv:"subtitle"`
URL string `json:"url" csv:"url" tsv:"url"`
}