doi

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Copyright 2025 National Technology and Engineering Solutions of Sandia SPDX-License-Identifier: BSD-3-Clause

Index

Constants

This section is empty.

Variables

View Source
var (
	DoesNotExistError = errors.New("doi does not exist")
)

Functions

This section is empty.

Types

type DOIOptions

type DOIOptions struct {
	Pretty   bool     // Pretty-print JSON output
	Auth     bool     // Authoritative query (bypass cache)
	Cert     bool     // Certified query (require authenticated response)
	Callback string   // JSONP callback function name
	Types    []string // Filter by element types
	Indexes  []int    // Filter by element indexes
}

DOIOptions represents optional parameters for DOI resolution

type DOIResponse

type DOIResponse struct {
	ResponseCode   int             `json:"responseCode"`
	Handle         string          `json:"handle"`
	RecordElements []RecordElement `json:"values,omitempty"`
	Message        string          `json:"message,omitempty"`
}

DOIResponse represents the JSON response from the DOI REST API

func ResolveDOI

func ResolveDOI(doi string) (*DOIResponse, error)

ResolveDOI resolves a DOI and returns all record elements

func ResolveDOIByIndex

func ResolveDOIByIndex(doi string, indexes ...int) (*DOIResponse, error)

ResolveDOIByIndex resolves a DOI and returns only elements at specified indexes

func ResolveDOIByType

func ResolveDOIByType(doi string, types ...string) (*DOIResponse, error)

ResolveDOIByType resolves a DOI and returns only elements of specified types

func ResolveDOIWithOptions

func ResolveDOIWithOptions(doi string, options DOIOptions) (*DOIResponse, error)

ResolveDOIWithOptions resolves a DOI with custom options

type RecordElement added in v0.2.0

type RecordElement struct {
	Index     int         `json:"index"`
	Type      string      `json:"type"`
	Value     ValueData   `json:"data"`
	Timestamp string      `json:"timestamp"`
	TTL       interface{} `json:"ttl"` // Can be int or string
}

RecordElement represents a DOI record element

type ValueData

type ValueData struct {
	Format string      `json:"format"`
	Value  interface{} `json:"value"`
}

ValueData represents the data field structure

Jump to

Keyboard shortcuts

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