Documentation
¶
Overview ¶
Package cmo is the library behind the cmo command line. It scrapes the Canadian Mathematical Society's CMO/CJMO archive page, extracts all PDF links, and returns typed Edition records.
Index ¶
Constants ¶
const BaseURL = "https://" + Host
BaseURL is the root every request is built from.
const DefaultUserAgent = "Mozilla/5.0 (compatible; cmo-cli/dev; +https://github.com/tamnd/cmo-cli)"
DefaultUserAgent identifies the client to the CMS server.
const Host = "cms.math.ca"
Host is the CMS website this client reads.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 the CMS website over HTTP.
type Domain ¶
type Domain struct{}
Domain is the cmo driver for the any-cli/kit framework.
func (Domain) Classify ¶
Classify turns a URL or bare path into (type, id). For cmo we have a single resource type: "edition" identified by "YEAR:COMPETITION".
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 Edition ¶
type Edition struct {
Rank int `json:"rank" csv:"rank" tsv:"rank"`
Year int `json:"year" csv:"year" tsv:"year"`
Competition string `json:"competition" csv:"competition" tsv:"competition"`
ProblemsURL string `json:"problems_url" csv:"problems_url" tsv:"problems_url"`
SolutionsURL string `json:"solutions_url" csv:"solutions_url" tsv:"solutions_url"`
}
Edition is one year/competition entry in the CMO or CJMO archive.