Documentation
¶
Index ¶
- Constants
- func FmtHelp(src string, appName string, version string, releaseDate string, ...) string
- func JsonDecode(src []byte, obj interface{}) error
- func MarshalObject(obj interface{}, prefix string, indent string) ([]byte, error)
- type Assertion
- type ClinicalTrailNumber
- type ContentDomain
- type CrossRefClient
- type DateObject
- type DateRange
- type Funder
- type Group
- type Identifier
- type JournalIssue
- type License
- type Link
- type Message
- type Object
- type Organization
- type Person
- type Property
- type Reference
- type Review
- type Updated
- type Works
Constants ¶
const ( // Version number of release Version = "1.0.7" // ReleaseDate, the date version.go was generated ReleaseDate = "2024-02-26" // ReleaseHash, the Git hash when version.go was generated ReleaseHash = "df9e4d1" LicenseText = `` /* 1524-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func FmtHelp ¶ added in v1.0.3
func FmtHelp(src string, appName string, version string, releaseDate string, releaseHash string) string
FmtHelp lets you process a text block with simple curly brace markup.
func JsonDecode ¶ added in v1.0.6
Custom JSON decoder so we can treat numbers easier
Types ¶
type Assertion ¶ added in v1.0.1
type ClinicalTrailNumber ¶ added in v1.0.1
type ClinicalTrailNumber struct {
ClinicalTrailNumber string `json:"clinical-trail-number,omitempty"`
Registry string `json:"registry,omitempty"`
Type string `json:"type,omitempty"`
}
func (*ClinicalTrailNumber) IsSame ¶ added in v1.0.1
func (ctn *ClinicalTrailNumber) IsSame(t *ClinicalTrailNumber) bool
type ContentDomain ¶ added in v1.0.1
type ContentDomain struct {
Domain []string `json:"domain,omitempty"`
CrossmarkRestriction bool `json:"crossmark-restriction,omitempty"`
}
func (*ContentDomain) IsSame ¶ added in v1.0.1
func (c *ContentDomain) IsSame(t *ContentDomain) bool
type CrossRefClient ¶
type CrossRefClient struct {
AppName string
MailTo string `json:"mailto"`
API string `json:"api"`
RateLimitLimit int `json:"limit"`
RateLimitInterval int `json:"interval"`
LimtCount int `json:"limit"`
Status string
StatusCode int
LastRequest time.Time `json:"last_request"`
}
func NewCrossRefClient ¶
func NewCrossRefClient(appName string, mailTo string) (*CrossRefClient, error)
NewCrossRefClient creates a client and makes a request and returns the JSON source as a []byte or error if their is a problem.
func (*CrossRefClient) Types ¶
func (c *CrossRefClient) Types() (Object, error)
Types returns the list of supported types as a Object
func (*CrossRefClient) TypesJSON ¶
func (c *CrossRefClient) TypesJSON() ([]byte, error)
TypesJSON return a list of types in JSON source
type DateObject ¶ added in v1.0.1
type DateObject struct {
// DateParts holds a date an an array of Year, Month and Day integer values
DateParts [][]int `json:"date-parts,omitempty"`
// DateTime holds a date/time stamp, e.g. 2023-03-28T18:43:06.364Z
DateTime string `json:"date-time,omitempty"`
// Olds an integer representation of a timestamp, Unix epoch?
Timestamp int64 `json:"timestamp,omitempty"`
}
DateObject is a date/timestamp/action timestamp of when something happened. It is used repeated in the message object
func (*DateObject) IsSame ¶ added in v1.0.1
func (do *DateObject) IsSame(t *DateObject) bool
IsSame checks if the date objects represent the same date. NOTE: if both objects are nil, they are considered the same.
type DateRange ¶ added in v1.0.1
type DateRange struct {
StartDate *DateObject `json:"start-date,omitempty"`
EndDate *DateObject `json:"end-date,omitempty"`
}
type Funder ¶ added in v1.0.1
type Identifier ¶ added in v1.0.1
type Identifier struct {
Label string `json:"label,omitempty"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Value string `json:"value,omitempty"`
IdType string `json:"id-type,omitempty"`
Id string `json:"id,omitempty"`
AssertedBy string `json:"asserted-by,omitempty"`
}
func (*Identifier) IsSame ¶ added in v1.0.1
func (i *Identifier) IsSame(t *Identifier) bool
IsSame checks if two works object are the same. NOTE: if both objects are nil, they are considered the same.
type JournalIssue ¶ added in v1.0.1
type JournalIssue struct {
Issue string `json:"issue,omitempty"`
}
func (*JournalIssue) IsSame ¶ added in v1.0.1
func (i *JournalIssue) IsSame(t *JournalIssue) bool
type License ¶ added in v1.0.1
type License struct {
URL string `json:"URL,omitempty"`
Start *DateObject `json:"start,omitempty"`
DelayInDays int `json:"delay-in-days,omitempty"`
ContentVersion string `json:"content-version,omitempty"`
}
type Link ¶ added in v1.0.1
type Message ¶ added in v1.0.1
type Message struct {
// Institutional information
Institution []*Organization `json:"institution,omitempty"`
// Indexed described when the work was last indexed
Indexed *DateObject `json:"indexed,omitempty"`
// Posted is when the work was posted to the API??
Posted *DateObject `json:"posted,omitempty"`
// PublisherLocation, where they are located as a string
PublisherLocation string `json:"publisher-location,omitempty"`
// UpdateTo ????
UpdateTo []*Updated `json:"updated-to,omitempty"`
// StandardsBody, ???
StandardsBody []*Organization `json:"standards-body,omitempty"`
EditionNumber string `json:"edition-number,omitempty"`
GroupTitle string `json:"group-title,omitempty"`
Publisher string `json:"publisher,omitempty"`
Issue string `json:"issue,omitempty"`
IsbnType []*Identifier `json:"isbn-type,omitempty"`
License []*License `json:"license,omitempty"`
Funder []*Funder `json:"funder,omitempty"`
ContentDomain *ContentDomain `json:"content-domain,omitempty"`
Chair []*Person `json:"chair,omitempty"`
ShortContainerTitle []string `json:"short-container-title,omitempty"`
Accepted *DateObject `json:"accepted,omitempty"`
ContentUpdated *DateObject `json:"content-updated,omitempty"`
PublishedPrint *DateObject `json:"published-print,omitempty"`
Abstract string `json:"abstract,omitempty"`
DOI string `json:"doi,omitempty"`
Type string `json:"type,omitempty"`
Created *DateObject `json:"created,omitempty"`
Approved *DateObject `json:"approved,omitempty"`
Page string `json:"page,omitempty"`
UpdatePolicy string `json:"update-policy,omitempty"`
Source string `json:"source,omitempty"`
Title []string `json:"title,omitempty"`
Prefix string `json:"prefix,omitempty"`
Volume string `json:"volume,omitempty"`
ClinicalTrailNumber *ClinicalTrailNumber `json:"clinical-trail-number,omitempty"`
Author []*Person `json:"author,omitempty"`
Member string `json:"member,omitempty"`
ContentCreated *DateObject `json:"content-created,omitempty"`
PublishedOnline *DateObject `json:"published-online,omitempty"`
Reference []*Reference `json:"reference,omitempty"`
ContainerTitle []string `json:"container-title,omitempty"`
Review *Review `json:"review,omitempty"`
OriginalTitle []string `json:"original-title,omitempty"`
Language string `json:"language,omitempty"`
Link []*Link `json:"link,omitempty"`
Deposited *DateObject `json:"deposited,omitempty"`
Score int `json:"score,omitempty"`
Degree string `json:"degree,omitempty"`
SubTitle []string `json:"subtitle,omitempty"`
Translator []*Person `json:"translator,omitempty"`
FreeToRead *DateRange `json:"free-to-read,omitempty"`
Editor []*Person `json:"editor,omitempty"`
ComponentNumber string `json:"component-number,omitempty"`
ShortTitle []string `json:"short-title,omitempty"`
Issued *DateObject `json:"issued,omitempty"`
ISBN []string `json:"isbn,omitempty"`
ReferenceCount int `json:"reference-count,omitempty"`
PartNumber string `json:"part-number,omitempty"`
JournalIssue *JournalIssue `json:"journal-issue,omitempty"`
ArticleNumber string `json:"article-number,omitempty"`
AlternativeId []string `json:"alternative-id,omitempty"`
URL string `json:"URL,omitempty"`
Archive []string `json:"archive,omitempty"`
Relation map[string][]*Property `json:"relation,omitempty"`
ISSN []string `json:"issn,omitempty"`
IssnType []*Identifier `json:"issn-type,omitempty"`
Subject []string `json:"subject,omitempty"`
PublishedOther *DateObject `json:"published-other,omitempty"`
Published *DateObject `json:"published,omitempty"`
Assertion []*Assertion `json:"assertion,omitempty"`
}
func (*Message) Changes ¶ added in v1.0.1
Changes takes the current Message, a new version of the Message and returns a Message object with the new Message object containing only the new elements.
func (*Message) Diff ¶ added in v1.0.1
Diff takes the current Message, a new version of the Message and two Message objects one holding the old values and another holding the new values.
func (*Message) DiffAsJSON ¶ added in v1.0.1
DiffAsJSON performs a Diff and returns the results as a JSON array where the first element (index 0) is the old object's values and the second (index 1) is the updated values
type Object ¶
type Object = map[string]interface{}
Object is the general holder of what get back after unmarshaling json
type Organization ¶ added in v1.0.1
type Organization struct {
IDs []*Identifier `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Place []string `json:"place,omitempty"`
Department []string `json:"department,omitempty"`
Acronym []string `json:"acronym,omitempty"`
}
func (*Organization) IsSame ¶ added in v1.0.1
func (org *Organization) IsSame(t *Organization) bool
IsSame checks if two works object are the same. NOTE: if both objects are nil, they are considered the same.
type Person ¶ added in v1.0.1
type Person struct {
ORCID string `json:"ORCID,omitempty"`
Suffix string `json:"suffix,omitempty"`
Given string `json:"given,omitempty"`
Family string `json:"family,omitempty"`
Affiliation []*Organization `json:"affiliation,omitempty"`
Name string `json:"name,omitempty"`
AuthenticatedOrcid bool `json:"authenticated-orcid,omitempty"`
Prefix string `json:"prefix,omitempty"`
Sequence string `json:"sequence,omitempty"`
}
type Property ¶ added in v1.0.1
type Reference ¶ added in v1.0.1
type Reference struct {
ISSN string `json:"issn,omitempty"`
StandardsBody string `json:"standards-body,omitempty"`
Issue string `json:"issue,omitempty"`
Key string `json:"key,omitempty"`
SeriesTitle string `json:"series-title,omitempty"`
IsbnType string `json:"isbn-type,omitempty"`
DoiAssertedBy string `json:"doi-asserted-by,omitempty"`
FirstPage string `json:"first-page,omitempty"`
ISBN string `json:"isbn,omitempty"`
DOI string `json:"doi,omitempty"`
Component string `json:"component,omitempty"`
ArticleTitle string `json:"article-title,omitempty"`
VolumeTitle string `json:"volume-title,omitempty"`
Volume string `json:"volume,omitempty"`
Author string `json:"author,omitempty"`
StandardDesignator string `json:"standard-designator,omitempty"`
Year string `json:"year,omitempty"`
Unstructured string `json:"unstructured,omitempty"`
Edition string `json:"edition,omitempty"`
JournalTitle string `json:"journal-title,omitempty"`
IssnType string `json:"issn-type,omitempty"`
}
type Review ¶ added in v1.0.1
type Review struct {
Type string `json:"type,omitempty"`
RunningNumber string `json:"running-number,omitempty"`
RevisionRound string `json:"revision-round,omitempty"`
Stage string `json:"stage,omitempty"`
CompetingInterestStatement string `json:"competing-interest-statement,omitempty"`
Recommendation string `json:"recommendation,omitempty"`
Language string `json:"language,omitempty"`
}
type Updated ¶ added in v1.0.1
type Updated struct {
Label string `json:"label,omitempty"`
DOI string `json:"doi,omitempty"`
Type string `json:"type,omitempty"`
Updated *DateObject `json:"updated,omitempty"`
}
type Works ¶ added in v1.0.1
type Works struct {
Status string `json:"status,omitempty"`
MessageType string `json:"message-type,omitempty"`
MessageVersion string `json:"message-version,omitempty"`
Message *Message `json:"message,omitempty"`
}
Works is a representation retrieved the CrossRef REST API using the Works path and a DOI. This is based on documentaiton at https://api.crossref.org/swagger-ui/index.html#/Works/get_works__doi_ Captured on 2023-03-28, RSD
NOTE: structure in documentation appears wrong, my test records indicate that some things listed as array of string are really just strings and visa versa.
func (*Works) DiffAsJSON ¶ added in v1.0.1
DiffAsJSON performs a Diff and returns the results as a JSON array where the first element (index 0) is the old object's values and the second (index 1) is the updated values
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
crossrefapi
command
crossrefapi.go is a command line tool for access the CrossRef API given a specific DOI.
|
crossrefapi.go is a command line tool for access the CrossRef API given a specific DOI. |