client

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2022 License: GPL-2.0, GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CrossRefUrl string = "https://api.crossref.org"
	DataCiteUrl string = "https://api.datacite.org"
)

Variables

This section is empty.

Functions

func GetCitations

func GetCitations(doi, file, mailto string) citation.Citation

returns Citation from crossref or datacite

Types

type Client

type Client struct {
	Typ               ClientType
	Api               string
	Path              string
	RateLimitLimit    int
	RateLimitInterval int
	Status            string
	StatusCode        int
	LastRequest       time.Time
}

crossref / datacite client taken and modified from https://github.com/caltechlibrary/dataciteapi

type ClientType

type ClientType int
const (
	CrossRefClient ClientType = 0
	DataCiteClient ClientType = 2
)

type CrossRef

type CrossRef struct {
	Status         string         `json:"status"`
	MessageType    string         `json:"message-type"`
	MessageVersion string         `json:"message-version"`
	Message        CrossRefFields `json:"message"`
}

type CrossRefDate

type CrossRefDate struct {
	Parts [][]int `json:"date-parts"` // date parts as array
}

type CrossRefFields

type CrossRefFields struct {
	Author            []citation.CitationAuthor `json:"author"`             // authors
	ContainerTitle    []string                  `json:"container-title"`    // title of journal or book
	DOI               string                    `json:"DOI"`                // DOI
	Editor            []citation.CitationAuthor `json:"editor"`             // editors
	EditionNumber     string                    `json:"edition-number"`     // edition number
	ISBN              []string                  `json:"ISBN"`               // book isbn
	ISSN              []string                  `json:"ISSN"`               // issn
	Institution       CrossRefInstitution       `json:"institution"`        // institution
	Issue             string                    `json:"issue"`              // issue
	Link              []CrossRefLink            `json:"link"`               // url to the resource
	Page              string                    `json:"page"`               // pages
	Published         CrossRefDate              `json:"published"`          // publication date
	Publisher         string                    `json:"publisher"`          // publisher
	PublisherLocation string                    `json:"publisher-location"` // location of the publisher
	Title             []string                  `json:"title"`              // title of the work
	Type              string                    `json:"type"`               // resource type
	URL               string                    `json:"URL"`                // doi url
	Volume            string                    `json:"volume"`             // volume
}

type CrossRefInstitution

type CrossRefInstitution struct {
	Name  string   `json:"name"`
	Place []string `json:"place"`
}
type CrossRefLink struct {
	URL string `json:"URL"` // url
}

type DataCite

type DataCite struct {
	Data struct {
		Attributes DataCiteFields `json:"attributes"`
	} `json:"data"`
}

type DataCiteContainer

type DataCiteContainer struct {
	Identifier     string `json:"identifier"`
	IdentifierType string `json:"identifierType"`
	Issue          string `json:"issue"`
	Title          string `json:"title"`
	Type           string `json:"type"`
	Volume         string `json:"volume"`
}

type DataCiteContributor

type DataCiteContributor struct {
	Family string `json:"familyName"`
	Given  string `json:"givenName"`
	Name   string `json:"name"`
}

type DataCiteFields

type DataCiteFields struct {
	Container       DataCiteContainer     `json:"container"`
	Contributors    []DataCiteContributor `json:"contributors"`
	Creators        []DataCiteContributor `json:"creators"`
	Doi             string                `json:"doi"`
	Identifier      string                `json:"identifier"`
	Name            string                `json:"name"`
	Publisher       string                `json:"publisher"`
	Title           []DataciteTitle       `json:"titles"`
	Types           DataciteTypes         `json:"types"`
	Url             string                `json:"url"`
	PublicationYear int                   `json:"publicationYear"`
}

type DataciteTitle

type DataciteTitle struct {
	Title string `json:"title"`
}

type DataciteTypes

type DataciteTypes struct {
	Bibtex string `json:"bibtex"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL