Documentation
¶
Overview ¶
Package freedictionary is the library behind the freedictionary command line: the HTTP client, request shaping, and the typed data models for the Free Dictionary API (api.dictionaryapi.dev).
The API requires no authentication. A polite User-Agent and 100 ms pacing between requests keeps the client within the free-tier rate limits.
Index ¶
Constants ¶
const Host = "api.dictionaryapi.dev"
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 Free Dictionary API over HTTP.
type Config ¶
Config holds all tunable parameters for the Client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults.
type Definition ¶
type Definition struct {
Word string `kit:"id" json:"word"`
PartOfSpeech string `json:"part_of_speech"`
Definition string `json:"definition"`
Example string `json:"example"`
Synonyms string `json:"synonyms"` // comma-joined, up to 5
Phonetic string `json:"phonetic"`
}
Definition is one record produced by the Lookup call. Each entry in the API response, times each meaning, times each definition yields one Definition record.
type Domain ¶
type Domain struct{}
Domain is the Free Dictionary driver.
func (Domain) Classify ¶
Classify turns any input into the canonical (type, id). Every non-empty string is treated as a word to look up.
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.