datacite

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DataciteMetadata added in v0.7.4

func DataciteMetadata(doi, did, description string, record map[string]any, publish bool) ([]byte, error)

DataciteMetadata provides datacite metadata record for given did and FOXDEN record

func MakePublic added in v0.7.4

func MakePublic(doi string) error

MakePublic implements logic of publishing draft DOI curl -X PUT -H "Content-Type: application/vnd.api+json" --user YOUR_REPOSITORY_ID:YOUR_PASSWORD -d @my_doi_update.json https://api.test.datacite.org/dois/:id

func Publish added in v0.6.1

func Publish(did, description string, record map[string]any, publish bool) (string, string, error)

Publish provides publication of did into datacite

Types

type Attributes

type Attributes struct {
	Doi                string              `json:"doi,omitempty"`
	Prefix             string              `json:"prefix,omitempty"`
	Event              string              `json:"event,omitempty"`
	Creators           []Creator           `json:"creators,omitempty"`
	Titles             []Title             `json:"titles,omitempty"`
	Publisher          *Publisher          `json:"publisher,omitempty"` // omitempty ensures it's not included if nil
	PublicationYear    int                 `json:"publicationYear,omitempty"`
	Types              *Types              `json:"types,omitempty"` // omitempty ensures it's not included if nil
	RelatedIdentifiers []RelatedIdentifier `json:"relatedIdentifiers,omitempty"`
	Descriptions       []Description       `json:"descriptions,omitempty"`
	URL                string              `json:"url,omitempty"`
}

Attributes represent attributes NOTE1: we use pointers to Publisher and Types structs to ensure that they will not be included if nil NOTE2: we don't need points for lists since they will be properly omitted

type Creator

type Creator struct {
	Name            string           `json:"name,omitempty"`
	NameType        string           `json:"nameType,omitempty"`
	NameIdentifiers []NameIdentifier `json:"nameIdentifiers,omitempty"`
}

Creator represents creator struct

type Description added in v0.7.4

type Description struct {
	Description     string `json:"description,omitempty"`
	DescriptionType string `json:"descriptionType,omitempty"`
	Lang            string `json:"lang,omitempty"`
}

Description represents description info

type NameIdentifier added in v0.7.4

type NameIdentifier struct {
	AffiliationIdentifier       string `json:"affiliationIdentifier,omitempty"`
	AffiliationIdentifierScheme string `json:"affiliationIdentifierScheme,omitempty"`
	SchemeUri                   string `json:"schemeUri,omitempty"`
}

NameIdentifier represents name identifier info

type Publisher added in v0.7.4

type Publisher struct {
	Name                      string `json:"name,omitempty"`
	PublisherIdentifier       string `json:"publisherIdentifier,omitempty"`
	PublisherIdentifierScheme string `json:"publisherIdentifier,omitempty"`
	SchemeUri                 string `json:"schemeUri,omitempty"`
	Lang                      string `json:"lang,omitempty"`
}

Publisher represents publisher info

type RelatedIdentifier added in v0.7.4

type RelatedIdentifier struct {
	RelationType          string `json:"relationType,omitempty"`
	RelatedTypeGeneral    string `json:"relatedTypeGeneral,omitempty"`
	RelatedIdentifier     string `json:"relatedIdentifier,omitempty"`
	RelatedIdentifierType string `json:"relatedIdentifierType,omitempty"`
}

RelatedIdentifier represents related identifier meta-data

type RequestData

type RequestData struct {
	Type       string     `json:"type,omitempty"`
	Attributes Attributes `json:"attributes,omitempty"`
}

RequestData represents request data

type RequestPayload added in v0.7.4

type RequestPayload struct {
	Data RequestData `json:"data,omitempty"`
}

RequestPayload represents request payload

type ResponseAttributes added in v0.7.4

type ResponseAttributes struct {
	Doi                string              `json:"doi,omitempty"`
	Prefix             string              `json:"prefix,omitempty"`
	Event              string              `json:"event,omitempty"`
	Creators           []Creator           `json:"creators,omitempty"`
	Titles             []Title             `json:"titles,omitempty"`
	Publisher          string              `json:"publisher,omitempty"`
	PublicationYear    int                 `json:"publicationYear,omitempty"`
	Types              Types               `json:"types,omitempty"`
	State              string              `json:"state,omitempty"`
	RelatedIdentifiers []RelatedIdentifier `json:"relatedIdentifiers,omitempty"`
	Descriptions       []Description       `json:"descriptions,omitempty"`
	URL                string              `json:"url,omitempty"`
}

ResponseAttributes represent attributes

type ResponseData added in v0.7.4

type ResponseData struct {
	ID         string             `json:"id,omitempty"`
	Type       string             `json:"type,omitempty"`
	Attributes ResponseAttributes `json:"attributes,omitempty"`
}

ResponseData represents response payload NOTE: the Attributes of response is slightly different from Request Attributes, for instance Publisher is a string instead of Publisher struct in Request Attributes.

type ResponsePayload added in v0.7.4

type ResponsePayload struct {
	Data ResponseData `json:"data,omitempty"`
}

ResponsePayload represents request payload

func GetRecord added in v0.7.4

func GetRecord(doi string) (ResponsePayload, error)

GetRecord fetches DOI record for given doi

type Title

type Title struct {
	Title string `json:"title,omitempty"`
}

Title represents title

type Types

type Types struct {
	ResourceType        string `json:"resourceType,omitempty"`
	ResourceTypeGeneral string `json:"resourceTypeGeneral,omitempty"`
}

Types represents types

Jump to

Keyboard shortcuts

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