# README
crossrefapi
This is a go package for working with the Crossref API. It is inspired by the an excellent CrossRefAPI Python package listed in the Crossref API docs. This package is meant to follow the "polite" guidelines for interacting with the public API at api.crossref.org.
Go package example
appName := path.Base(os.Args[0])
client, err := crossrefapi.NewCrossRefClient(appName, "[email protected]")
if err != nil {
// handle error...
}
works, err := client.Works("10.1037/0003-066x.59.1.29")
if err != nil {
// handle error...
}
// continue processing your "works" result...
You can compare two copies of a "works" response and see what has changed.
appName := path.Base(os.Args[0])
client, err := crossrefapi.NewCrossRefClient(appName, "[email protected]")
if err != nil {
// handle error...
}
newWorks, err := client.Works("10.1037/0003-066x.59.1.29")
if err != nil {
// handle error...
}
// Fetch our previously saved works document.
src, err := os.ReadFile("0003-066x.59.1.29.json")
if err != nil {
// handle error...
}
oldWorks := new(crossrefapi.Works)
if err := json.Unmarshal(src, &oldWorks); err != nil {
// handle error...
}
src, err = oldWorks.DiffAsJSON(newWorks)
if err != nil {
// handle error...
}
fmt.Println("Diff for 10.1037/0003-066x.59.1.29")
fmt.Printf("\n%s\n", src)
Command line example
crossrefapi -mailto="[email protected]" works "10.1037/0003-066x.59.1.29"
Reference
- Crossref API Docs
- Crossref Schemas
- CrossRefAPI - Python implementation
# Packages
No description provided by the author
# Functions
FmtHelp lets you process a text block with simple curly brace markup.
Custom JSON decoder so we can treat numbers easier.
MarshalObject provide a custom json encoder to solve a an issue with HTML entities getting converted to UTF-8 code points by json.Marshal() in recent versions of go (~= go1.21).
NewCrossRefClient creates a client and makes a request and returns the JSON source as a []byte or error if their is a problem.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
renamed from `Updated` to avoid name collision.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ReleaseDate, the date version.go was generated.
ReleaseHash, the Git hash when version.go was generated.
No description provided by the author
No description provided by the author
Version number of release.
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
DateObject is a date/timestamp/action timestamp of when something happened.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
License represents license-specific filter parameters.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Relation represents relation-specific filter parameters.
No description provided by the author
No description provided by the author
WorksFilter represents the available filter parameters for the /works endpoint.
WorksQuery represents a query for works in the CrossRef API.
WorksQueryFields represents the fields that can be queried in the CrossRef API.
No description provided by the author
WorksResponse is a generic type to represent responsed from the /works endpoint.
# Type aliases
BoolParameter overrides boolean text marshalling to comply with CrossRef API spec.
Object is the general holder of what get back after unmarshaling json.
No description provided by the author
No description provided by the author