Documentation
¶
Overview ¶
Copyright 2025 National Technology and Engineering Solutions of Sandia SPDX-License-Identifier: BSD-3-Clause
Copyright 2025 National Technology and Engineering Solutions of Sandia SPDX-License-Identifier: BSD-3-Clause
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v0.6.0
type Client struct {
// contains filtered or unexported fields
}
Client is a rate-limited client for the Crossref API. A Client is safe for concurrent use and should be shared by all work in one process.
func NewClient ¶ added in v0.6.0
NewClient returns a Crossref client limited to one request start every 334ms and at most three concurrent upstream requests.
func (*Client) QueryBibliographic ¶ added in v0.6.0
func (c *Client) QueryBibliographic(ctx context.Context, reference string, rows int) (*CrossrefResponse, error)
QueryBibliographic queries Crossref for reference matching.
type CrossrefResponse ¶
type CrossrefResponse struct {
Status string `json:"status"`
Message struct {
Items []CrossrefWork `json:"items"`
TotalResults int `json:"total-results"`
} `json:"message"`
}
type CrossrefWork ¶
type CrossrefWork struct {
DOI string `json:"DOI"`
Title []string `json:"title"`
Score float64 `json:"score"`
Author []struct {
Given string `json:"given"`
Family string `json:"family"`
} `json:"author"`
Published struct {
DateParts [][]int `json:"date-parts"`
} `json:"published-print"`
ContainerTitle []string `json:"container-title"`
}
CrossrefWork represents a work item from the Crossref API.
func (*CrossrefWork) ToString ¶
func (w *CrossrefWork) ToString() string
type Option ¶ added in v0.6.0
type Option func(*Client)
Option configures a Client.
func WithDelayCallback ¶ added in v0.6.0
WithDelayCallback registers a callback for requests delayed by rate limiting.
func WithHTTPClient ¶ added in v0.6.0
WithHTTPClient replaces the HTTP client used for upstream requests.
type ReferenceMatchResult ¶
type ReferenceMatchResult struct {
BestMatch *CrossrefWork
SecondMatch *CrossrefWork
IsConclusive bool
Error error
}