Documentation
¶
Overview ¶
Package unpaywall is the library behind the unpaywall command line: the HTTP client, request shaping, and the typed data models for the Unpaywall public open-access API (api.unpaywall.org/v2).
The API requires no registration — pass your email as the identifying key. It is polite to pace requests to at most one per second.
Index ¶
Constants ¶
const BaseURL = "https://api.unpaywall.org/v2"
BaseURL is the v2 API root every request is built from.
const Host = "api.unpaywall.org"
Host is the API hostname.
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 Unpaywall API over HTTP.
type Config ¶
type Config struct {
BaseURL string
Email string
UserAgent string
Rate time.Duration
Retries int
Timeout time.Duration
}
Config holds all tunable parameters for the Client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible, polite defaults.
type Domain ¶
type Domain struct{}
Domain is the unpaywall driver.
func (Domain) Classify ¶
Classify turns an input into the canonical (type, id). A string starting with "10." is treated as a DOI; everything else is a query.
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 Paper ¶
type Paper struct {
DOI string `json:"doi" kit:"id"`
Title string `json:"title"`
Journal string `json:"journal"`
Published string `json:"published"`
Year int `json:"year"`
IsOA bool `json:"is_oa"`
OAStatus string `json:"oa_status"`
BestURL string `json:"best_url"`
BestPDFURL string `json:"best_pdf_url"`
HostType string `json:"host_type"`
License string `json:"license"`
}
Paper is the canonical output record for a DOI lookup.