dataciteapi

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2018 License: BSD-3-Clause Imports: 11 Imported by: 3

README

dataciteapi

This is a go package for working with the DataCite API. It is inspired by work my colleague Tom Morrel has done in Python. This package is meant to follow the guidelines for interacting with the public API at api.datacite.org. It also follows the same form as the golang CrossRef API developed previously at Caltech Library.

Go package example

    client, err := dataciteapi.NewDataCiteClient("jane.doe@library.example.edu")
    if err != nil {
        // handle error...
    }
    works, err := client.Works("10.1037/0003-066x.59.1.29")
   
    if err != nil {
        // handle error...
    }
    // continue processing your "works" result...

Command line example

    dataciteapi -mailto="jane.doe@library.example.edu" works "10.1037/0003-066x.59.1.29"

Reference

Documentation

Index

Constants

View Source
const (
	Version = `v0.0.3`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DataCiteClient

type DataCiteClient 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 NewDataCiteClient

func NewDataCiteClient(appName string, mailTo string) (*DataCiteClient, error)

NewDataCiteClient creates a client and makes a request and returns the JSON source as a []byte or error if their is a problem.

func (*DataCiteClient) Works

func (c *DataCiteClient) Works(doi string) (Object, error)

Works return the Work unmarshaled into a Object (i.e. map[string]interface{})

func (*DataCiteClient) WorksJSON

func (c *DataCiteClient) WorksJSON(doi string) ([]byte, error)

WorksJSON return the work JSON source or error for a client and DOI

type Object

type Object = map[string]interface{}

Object is the general holder of what get back after unmarshaling json

Directories

Path Synopsis
cmd
dataciteapi
dataciteapi.go is a command line tool for access the DataCite API given a specific DOI.
dataciteapi.go is a command line tool for access the DataCite API given a specific DOI.

Jump to

Keyboard shortcuts

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