Documentation
¶
Overview ¶
domain.go exposes orcid as a kit Domain: a driver that a multi-domain host (ant) enables with a single blank import,
import _ "github.com/tamnd/orcid-cli/orcid"
exactly as a database/sql program enables a driver with `import _ "github.com/lib/pq"`. The init below registers it; the host then dereferences orcid:// URIs by routing to the operations Register installs. The same Domain also builds the standalone orcid binary (see cli.NewApp), so the binary and a host share one source of truth.
Package orcid is the library behind the orcid command line: the HTTP client, request shaping, and typed data models for the ORCID public registry (pub.orcid.org).
The ORCID public API is free and requires no API key. All requests must include Accept: application/json to receive JSON responses. The Client paces requests, retries transient failures (429 and 5xx) with exponential backoff, and decodes the deeply nested ORCID JSON into clean typed structs.
Three operations are provided: person profile (Person), list of works (Works), and researcher search (Search).
Index ¶
Constants ¶
const BaseURL = "https://pub.orcid.org/v3.0"
BaseURL is the API base path including the API version.
const Host = "pub.orcid.org"
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 pub.orcid.org over HTTP.
func (*Client) Person ¶
Person fetches the researcher profile for the given ORCID identifier. The orcidID must be in the format 0000-0002-1825-0097.
type Config ¶
type Config struct {
BaseURL string
UserAgent string
Rate time.Duration
Timeout time.Duration
Retries int
}
Config holds tunable knobs for the HTTP client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns sensible defaults for production use.
type Domain ¶
type Domain struct{}
Domain is the orcid driver. It carries no state; the per-run client is built by the factory Register hands kit.
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 Person ¶
type Person struct {
ORCID string `json:"orcid"`
GivenName string `json:"given_name"`
FamilyName string `json:"family_name"`
Bio string `json:"bio,omitempty"`
Keywords []string `json:"keywords,omitempty"`
URLs []PersonURL `json:"urls,omitempty"`
}
Person holds the profile data for one ORCID researcher.
type SearchResult ¶
type SearchResult struct {
ORCID string `json:"orcid"`
GivenName string `json:"given_name,omitempty"`
FamilyName string `json:"family_name,omitempty"`
}
SearchResult is one entry returned by the search endpoint.
type Work ¶
type Work struct {
PutCode int64 `json:"put_code"`
Title string `json:"title"`
Type string `json:"type,omitempty"`
Year int `json:"year,omitempty"`
Journal string `json:"journal,omitempty"`
DOI string `json:"doi,omitempty"`
URL string `json:"url,omitempty"`
}
Work holds one publication entry from an ORCID profile.