crossrefapi

package module
v1.0.0 Latest Latest
Warning

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

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

README

crossrefapi

This is a go package for working with the CrossRef API. It is inspired by the an excellent CrossRefAPI Python package listed in the CrossRef API docs. This package is meant to follow the "polite" guidelines for interacting with the public API at api.crossref.org.

Go package example

    client, err := crossrefapi.NewCrossRefClient("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

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

Reference

Documentation

Index

Constants

View Source
const (
	Version = `v1.0.0`
)

Variables

This section is empty.

Functions

This section is empty.

Types

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

func (*CrossRefClient) Works

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

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

func (*CrossRefClient) WorksJSON

func (c *CrossRefClient) 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
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.

Jump to

Keyboard shortcuts

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