crossref

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2026 License: BSD-3-Clause Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func NewClient(options ...Option) *Client

NewClient returns a Crossref client limited to 10 request starts per second, with a burst of three and at most three concurrent upstream requests.

func (*Client) Do added in v0.6.0

func (c *Client) Do(req *http.Request) (*http.Response, error)

Do performs a rate-limited HTTP request. WASM requests rely on the shared fetch proxy's limiter instead of applying a second browser-local limit.

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

func WithDelayCallback(callback func(time.Duration)) Option

WithDelayCallback registers a callback for requests delayed by rate limiting.

func WithHTTPClient added in v0.6.0

func WithHTTPClient(client *http.Client) Option

WithHTTPClient replaces the HTTP client used for upstream requests.

type ReferenceMatchResult

type ReferenceMatchResult struct {
	BestMatch    *CrossrefWork
	SecondMatch  *CrossrefWork
	IsConclusive bool
	Error        error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL