Documentation
¶
Overview ¶
Package checklistbank is the library behind the checklistbank command line: the HTTP client, request shaping, and the typed data models for ChecklistBank.
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 API throws under load. Build your endpoint calls and JSON decoding on top of it.
Index ¶
Constants ¶
const BaseURL = "https://" + Host
BaseURL is the root every request is built from.
const DefaultUserAgent = "checklistbank-cli/0.1.0"
DefaultUserAgent identifies the client to ChecklistBank. A real, honest User-Agent is both polite and the thing most likely to keep you unblocked.
const Host = "api.checklistbank.org"
Host is the site this client talks to, and the host the URI driver in domain.go claims.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checklist ¶
type Checklist struct {
ID string `json:"id" kit:"id"`
Title string `json:"title"`
Type string `json:"type"`
Size int `json:"size"`
}
Checklist is the public record type: one checklist/dataset from ChecklistBank.
type Client ¶
type Client struct {
HTTP *http.Client
UserAgent string
// Rate is the minimum gap between requests. Zero means no pacing.
Rate time.Duration
Retries int
// contains filtered or unexported fields
}
Client talks to ChecklistBank over HTTP.
func NewClient ¶
func NewClient() *Client
NewClient returns a Client with sensible defaults: a 30s timeout, a 300ms minimum gap between requests, and three retries on transient errors.
type Domain ¶
type Domain struct{}
Domain is the checklistbank 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 the canonical (type, id). Any non-empty string is accepted as a taxon ID.
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 Taxon ¶
type Taxon struct {
ID string `json:"id" kit:"id"`
ScientificName string `json:"scientific_name"`
Rank string `json:"rank"`
Genus string `json:"genus"`
Species string `json:"species"`
Status string `json:"status"`
DatasetKey int `json:"dataset_key"`
Code string `json:"code"`
Label string `json:"label"`
Classification string `json:"classification"`
}
Taxon is the public record type: one taxonomic name from ChecklistBank.