Crossref-rs - A rust client for the Crossref-API
API Documentation: latest release – master branch
This client is inspired by sckott/habanero.
This is still WIP.
Crossref - Crossref search API. The Crossref crate provides methods matching Crossref API routes:
works-/worksroutemembers-/membersrouteprefixes-/prefixesroutefunders-/fundersroutejournals-/journalsroutetypes-/typesrouteagency-/works/{doi}/agencyget DOI minting agency
Usage
Create a Crossref client:
let client = builder.build?;
If you have an Authorization token for Crossref's Plus service:
let client = builder
.token
.build?;
Encouraged to use the The Polite Pool:
Good manners = more reliable service
To get into Crossref's polite pool include a email address
let client = builder
.polite
.token
.build?;
Constructing Queries
Not all components support queries and there are custom available parameters for each route that supports querying.
For each resource components that supports querying there exist a Query struct: WorksQuery, MembersQuery, FundersQuery. The WorksQuery also differs from the others by supporting deep paging with cursors and field queries.
otherwise creating queries works the same for all resource components:
use *;
let query = new
.query
// field queries supported for `Works`
.field_query
// filters are specific for each resource component
.filter
.order
.sort;
Get Records
See this table for a detailed overview of the major components.
There are 3 available targets:
- standalone resource components:
/works,/members, etc. that return a list list of the corresponding items and can be specified with queries - Resource component with identifiers:
/works/{doi}?<query>,/members/{member_id}?<query>, etc. that returns a single item if found. - combined with the
worksroute: The works component can be appended to other resources:/members/{member_id}/works?<query>etc. that returns a list of matchingWorkitems.
This resembles in the enums of the resource components, eg. for Members:
All options are supported by the client:
Single Item by DOI (ID)
Analogous methods exist for all resource components
let work = client.work?;
let agency = client.work_agency?;
let funder = client.funder?;
let member = client.member?;
Query
let query = new.query;
// one page of the matching results
let works = client.works?;
Convenience method for Work Items by terms
let works = client.query_works?;
Combining Routes with the Works route
For each resource component other than Works there exist methods to append a WorksQuery with the ID option /members/{member_id}/works?<query>?
let works = client.member_works?;
Convenience method to append works query term:
let works = client.member_works?;
Deep paging for Works
License
Licensed under either of these:
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)