Documentation
¶
Index ¶
- Constants
- Variables
- type Affiliation
- type Author
- type ContentType
- type Date
- type DateParts
- type Query
- type Reference
- type Work
- type WorkAssertion
- type WorkClinicalTrial
- type WorkDomain
- type WorkFreeToRead
- type WorkFunder
- type WorkISSNType
- type WorkInstitution
- type WorkJournalIssue
- type WorkLicense
- type WorkLink
- type WorkMessage
- type WorkReview
- type WorkStandardsBody
- type WorkUpdate
- type Works
- type WorksMessage
- type WorksMessageMessageItemsAssertionExplanation
- type WorksMessageMessageItemsAssertionGroup
Constants ¶
const ( // API is the URL of Crossref's REST API. API string = "api.crossref.org" QueryKeyBib string = "query.bibliographic" QueryKeyFilter string = "filter" QueryValFilterISBN string = "isbn:" QueryValFilterTypeBook string = "type:book" QueryKeyRows string = "rows" QueryValRows string = "1" )
const ( APIFunders string = "funders" APIJournals string = "journals" APILicences string = "licenses" APIMembers string = "members" APIPrefixes string = "prefixes" APITypes string = "types" APIWorks string = "works" )
Crossref's REST API endpoints.
Variables ¶
var (
ErrBadContentType = fmt.Errorf(
"unknown content type, available types are: %q",
names)
)
Functions ¶
This section is empty.
Types ¶
type Affiliation ¶
type Affiliation struct {
Name string `json:"name"`
}
Affiliation holds the name of an affiliated institution.
type Author ¶
type Author struct { ORCID string `json:"ORCID"` Suffix string `json:"suffix"` Given string `json:"given"` Family string `json:"family"` Affiliation []Affiliation `json:"affiliation"` Name string `json:"name"` AuthenticatedORCID bool `json:"authenticated-orcid"` Prefix string `json:"prefix"` Sequence string `json:"sequence"` }
Author holds contributor-related data (author, editor, reviewer etc.).
type ContentType ¶
type ContentType int
ContentType represents a content return type supported by Crossref's API.
const ( BibTeX ContentType = iota CiteprocJSON RDFXML RDFTurtle RIS SchemaorgJSON TextCitation UnixrefXML UnixsdXML )
Citation content return types supported by Crossref's API. For more information see: https://citation.crosscite.org/docs.html
func (ContentType) Endpoint ¶
func (c ContentType) Endpoint() string
Endpoint returns the Crossref API content type endpoint path. This is appended to the '/works/{doi}' endpoint, which, when requested, returns the citation formatted in the requested type.
For more information see: https://citation.crosscite.org/docs.html
func (ContentType) Extension ¶
func (c ContentType) Extension() string
Extension returns the file extension for the ContentType.
func (*ContentType) Set ¶
func (c *ContentType) Set(name string) error
Set sets the value of the content type based on the provided content type name.
func (ContentType) String ¶
func (c ContentType) String() string
String returns the ContentType (name) as a user-friendly string.
func (ContentType) Type ¶
func (c ContentType) Type() string
Type returns the type used by ContentType.Set.
type Date ¶
type Date struct { // DateParts is an ordered array of year, month and day. DateParts [][]int `json:"date-parts"` // DateTime is the ISO 8601 formatted date time. DateTime string `json:"date-time"` // TimeStamp is the number of seconds since the UNIX epoch. Timestamp int `json:"timestamp"` }
Date holds the full information about a date in several formats.
type DateParts ¶
type DateParts struct { // DateParts is an ordered array of year, month and day. DateParts [][]int `json:"date-parts"` }
DateParts holds partial information about a date.
type Reference ¶
type Reference struct { ISSN string `json:"issn"` StandardsBody string `json:"standards-body"` Issue string `json:"issue"` Key string `json:"key"` SeriesTitle string `json:"series-title"` ISBNType string `json:"isbn-type"` DOIAssertedBy string `json:"doi-asserted-by"` FirstPage string `json:"first-page"` ISBN string `json:"isbn"` DOI string `json:"doi"` Component string `json:"component"` ArticleTitle string `json:"article-title"` VolumeTitle string `json:"volume-title"` Volume string `json:"volume"` Author string `json:"author"` StandardDesignator string `json:"standard-designator"` Year string `json:"year"` Unstructured string `json:"unstructured"` Edition string `json:"edition"` JournalTitle string `json:"journal-title"` ISSNType string `json:"issn-type"` }
Reference holds basic data about a work which references another work.
type Work ¶
type Work struct { Institution WorkInstitution `json:"institution"` Indexed Date `json:"indexed"` Posted DateParts `json:"posted"` PublisherLocation string `json:"publisher-location"` UpdateTo []WorkUpdate `json:"update-to"` StandardsBody []WorkStandardsBody `json:"standards-body"` EditionNumber string `json:"edition-number"` GroupTitle []string `json:"group-title"` ReferenceCount int `json:"reference-count"` Publisher string `json:"publisher"` Issue string `json:"issue"` ISBNType []WorkISSNType `json:"isbn-type"` License []WorkLicense `json:"license"` Founder []WorkFunder `json:"founder"` ContentDomain WorkDomain `json:"content-domain"` Chair []Author `json:"chair"` ShortContainerTitle string `json:"shortcontainer-title"` Accepted DateParts `json:"accepted"` ContentUpdated DateParts `json:"content-updated"` PublishedPrint DateParts `json:"published-print"` Abstract string `json:"abstract"` DOI string `json:"DOI"` Type string `json:"type"` Created Date `json:"created"` Approved DateParts `json:"approved"` Page string `json:"page"` UpdatePolicy string `json:"update-policy"` Source string `json:"source"` IsReferencedByCount int `json:"is-referenced-by-count"` Title []string `json:"title"` Prefix string `json:"prefix"` Volume string `json:"volume"` ClinicalTrialNumber []WorkClinicalTrial `json:"clinical-trial-number"` Author []Author `json:"author"` Member string `json:"member"` ContentCreated DateParts `json:"content-created"` PublishedOnline DateParts `json:"published-online"` Reference []Reference `json:"reference"` ContainerTitle []string `json:"container-title"` Review WorkReview `json:"review"` OriginalTitle []string `json:"original-title"` Language string `json:"language"` Link []WorkLink `json:"link"` Deposited Date `json:"deposited"` Score float64 `json:"score"` Degree string `json:"degree"` Subtitle []string `json:"subtitle"` Translator []Author `json:"translator"` FreeToRead WorkFreeToRead `json:"free-to-read"` Editor []Author `json:"editor"` ComponentNumber string `json:"component-number"` ShortTitle []string `json:"short-title"` Issued DateParts `json:"issued"` ISBN []string `json:"ISBN"` ReferencesCount int `json:"references-count"` PartNumber string `json:"part-number"` JournalIssue WorkJournalIssue `json:"journal-issue"` AlternativeID []string `json:"alternative-id"` URL string `json:"URL"` Archive []string `json:"archive"` Relation json.RawMessage `json:"relation"` // WARNING: unused ISSN []string `json:"ISSN"` ISSNType []WorkISSNType `json:"issn-type"` Subject []string `json:"subject"` PublishedOther DateParts `json:"published-other"` Published DateParts `json:"published"` Assertion []WorkAssertion `json:"assertion"` Subtype string `json:"subtype"` ArticleNumber string `json:"article-number"` }
Work holds all metadata about a particular work (article, book, dataset etc.).
type WorkAssertion ¶
type WorkAssertion struct { Group WorksMessageMessageItemsAssertionGroup `json:"group"` Explanation WorksMessageMessageItemsAssertionExplanation `json:"explanation"` Name string `json:"name"` Value string `json:"value"` URL string `json:"URL"` Order int `json:"order"` Label string `json:"label"` // WARNING: undocumented }
WorkAssertion holds information about various assertions related to the work.
type WorkClinicalTrial ¶
type WorkClinicalTrial struct { ClinicalTrialNumber string `json:"clinical-trial-number"` Registry string `json:"registry"` // DOI of the registry Type string `json:"type"` }
WorkClinicalTrial holds data about the clinical trial related to the work.
type WorkDomain ¶
type WorkDomain struct { Domain []string `json:"domain"` CrossmarkRestriction bool `json:"crossmark-restriction"` }
WorkDomain holds information about domains that support Crossmark for the work.
type WorkFreeToRead ¶
type WorkFreeToRead struct { StartDate DateParts `json:"start-date"` EndDate DateParts `json:"end-date"` }
WorkFreeToRead (presumably) holds information about open-access availability of the work. NOTE: This field is possibly unused.
type WorkFunder ¶
type WorkFunder struct { Name string `json:"name"` DOI string `json:"DOI"` // Open Funder Registry DOI DOIAssertedBy string `json:"doi-asserted-by"` Award []string `json:"award"` }
WorkFunder holds information about a funding organization of the work.
type WorkISSNType ¶
type WorkISSNType struct { // Type is the ISSN type: 'eissn', 'pissn' or 'lissn' Type string `json:"type"` Value string `json:"value"` }
WorkISSNType holds ISSN information related to the work.
type WorkInstitution ¶
type WorkInstitution struct { Name string `json:"name"` Place []string `json:"place"` Department []string `json:"department"` Acronym []string `json:"acronym"` }
WorkInstitution holds information about the institution related to the work.
type WorkJournalIssue ¶
type WorkJournalIssue struct {
Issue string `json:"issue"`
}
WorkJournalIssue is the journal issue in which the work was published.
type WorkLicense ¶
type WorkLicense struct { // URL is a link to the web page describing the license. URL string `json:"URL"` // Start is the date on which this license begins to take effect Start Date `json:"start"` // DelayInDays is the number of days between the publication date of the // work and the start date of this license. DelayInDays int `json:"delay-in-days"` // ContentVersion is one of 'vor' (version of record), 'am' (accepted // manuscript), 'tdm' (text and data mining) or 'unspecified'. ContentVersion string `json:"content-version"` }
WorkLicense holds data about the license of the work.
type WorkLink ¶
type WorkLink struct { // URL is the direct link to a full-text download location. URL string `json:"URL"` // ContentType is the content type (or MIME type) of the full-text object. ContentType string `json:"content-type"` // ContentVersion is one of 'vor' (version of record), 'am' (accepted // manuscript) or 'unspecified'. ContentVersion string `json:"content-version"` // IntendedApplication is one of 'text-mining', 'similarity-checking' // or 'unspecified'. IntendedApplication string `json:"intended-application"` }
WorkLink holds information about the URL of the full-text location of the work.
type WorkMessage ¶
type WorkMessage struct { Status string `json:"status"` MessageType string `json:"message-type"` MessageVersion string `json:"message-version"` Message Work `json:"message"` }
WorkMessage is the return type of the '/works' and '/works/{doi}' endpoints.
type WorkReview ¶
type WorkReview struct { // Type is one of 'major-revision', 'minor-revision', 'reject', // 'reject-with-resubmit' or 'accept'. Type string `json:"type"` // Stage is one of 'pre-publication' or 'post-publication'. Stage string `json:"stage"` // Recommendation is one of 'referee-report', 'editor-report', // 'author-comment', 'community-comment' or 'aggregate'. Recommendation string `json:"recommendation"` RunningNumber string `json:"running-number"` RevisionRound string `json:"revision-round"` Language string `json:"language"` CompetingInterestStatement string `json:"competing-interest-statement"` }
WorkReview holds peer review metadata.
type WorkStandardsBody ¶
WorkStandardsBody holds information about the standards body related to the work.
type WorkUpdate ¶
type WorkUpdate struct { // Label is a display-friendly label for the update type. Label string `json:"label"` // DOI is the DOI of the updated work. DOI string `json:"DOI"` // Type is the type of update, e.g., 'retraction' or 'correction'. Type string `json:"type"` // Updated is the date on which the update was published. Updated Date `json:"updated"` }
WorkUpdate holds information about updates of the work.
type Works ¶
type Works struct { ItemsPerPage int `json:"items-per-page"` Query Query `json:"query"` TotalResults int `json:"total-results"` NextCursor string `json:"next-cursor"` Items []Work `json:"items"` }
Works holds information about a list of works resulting from querying an endpoint.
type WorksMessage ¶
type WorksMessage struct { Status string `json:"status"` MessageType string `json:"message-type"` MessageVersion string `json:"message-version"` Message Works `json:"message"` }
WorksMessage is the response from querying the works endpoint.
type WorksMessageMessageItemsAssertionExplanation ¶
type WorksMessageMessageItemsAssertionExplanation struct {
URL string `json:"URL"`
}
WorksMessageMessageItemsAssertionExplanation holds an explanation of the assertion related to the work.
type WorksMessageMessageItemsAssertionGroup ¶
type WorksMessageMessageItemsAssertionGroup struct { Name string `json:"name"` Label string `json:"label"` }
WorksMessageMessageItemsAssertionGroup holds data about the group to which the assertion related to the work belongs.