@jamesgopsill/crossref-client
v1.1.0
Published
A Typescript client for the Crossref API.
Downloads
118
Readme
Crossref API Typescript Client
The client has been developed as part of a research programme investigating agent-based manufacturing systems. The client has been used in our systematic literature reviews. It is isomorphic capable of running on server (Node.js) and client-side (Browser) applications.
Using crossref-client
To install the package, use the following code. I am aiming to put it onto npm soon.
pnpm install @jamesgopsill/crossref-client
You can then use it in your code like so (see the examples
folder for more implementations):
Typescript
import { CrossrefClient, QueryWorksParams } from "@jamesgopsill/crossref-client"
const client = new CrossrefClient()
const search: QueryWorksParams = {
queryAuthor: "Richard Feynman",
}
const r = await client.works(search)
if (r.ok && r.status == 200) console.log(r.content)
Selecting fields to return.
import {
CrossrefClient,
QueryWorksParams,
WorkSelectOptions,
} from "@jamesgopsill/crossref-client"
const client = new CrossrefClient()
const search: QueryWorksParams = {
queryAuthor: "Richard Feynman",
select: [WorkSelectOptions.CONTENT_DOMAIN],
sample: 10,
}
const r = await client.works(search)
if (r.ok && r.status == 200) console.log(r.content)
Javascript (ESM)
import { CrossrefClient } from "@jamesgopsill/crossref-client"
const client = new CrossrefClient()
const search = {
queryAuthor: "Richard Feynman",
}
const r = await client.works(search)
if (r.ok && r.status == 200) console.log(r.content)
Javascript (CJS)
const { CrossrefClient } = require("@jamesgopsill/crossref-client")
const client = new CrossrefClient()
const search = {
queryAuthor: "Richard Feynman",
}
client.works(search).then((r) => {
if (r.ok && r.status == 200) console.log(r.content)
})
Documentation
The docs have been produced using TypeDoc and can be accessed here. More details on the API can be found at Crossref API.
Contributing
We would love to have additional contributors to the project to help us maintain and add functionality to the project.
Support the Project
The project has been supported by the EPSRC-funded Brokering Additive Manufacturing project (EP/V05113X/1). More details on the project can be found at the Design Manufacturing Futures Lab website.
If you end up using the client a lot, please consider sponsoring the project to support the continued development and maintanence of the client.