oai

package
v0.0.0-...-d207067 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package oai Data structure for the OAI-PMH protocol request:

Data structure for the OAI-PMH protocol responses:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type About

type About struct {
	Body []byte `xml:",innerxml"`
}

func (About) GoString

func (ab About) GoString() string

Formatter for About content

type Description

type Description struct {
	Body []byte `xml:",innerxml"`
}

func (Description) GoString

func (desc Description) GoString() string

Formatter for Description content

type GetRecord

type GetRecord struct {
	Record Record `xml:"record"`
}
type Header struct {
	Status     string   `xml:"status,attr"`
	Identifier string   `xml:"identifier"`
	DateStamp  string   `xml:"datestamp"`
	SetSpec    []string `xml:"setSpec"`
}

type Identify

type Identify struct {
	RepositoryName    string        `xml:"repositoryName"`
	BaseURL           string        `xml:"baseURL"`
	ProtocolVersion   string        `xml:"protocolVersion"`
	AdminEmail        []string      `xml:"adminEmail"`
	EarliestDatestamp string        `xml:"earliestDatestamp"`
	DeletedRecord     string        `xml:"deletedRecord"`
	Granularity       string        `xml:"granularity"`
	Description       []Description `xml:"description"`
}

type ListIdentifiers

type ListIdentifiers struct {
	Headers         []Header `xml:"header"`
	ResumptionToken string   `xml:"resumptionToken"`
}

type ListMetadataFormats

type ListMetadataFormats struct {
	MetadataFormat []MetadataFormat `xml:"metadataFormat"`
}

type ListRecords

type ListRecords struct {
	Records         []Record `xml:"record"`
	ResumptionToken string   `xml:"resumptionToken"`
}

type ListSets

type ListSets struct {
	Set []Set `xml:"set"`
}

type Metadata

type Metadata struct {
	Body []byte `xml:",innerxml"`
}

func (Metadata) GoString

func (md Metadata) GoString() string

Formatter for Metadata content

type MetadataFormat

type MetadataFormat struct {
	MetadataPrefix    string `xml:"metadataPrefix"`
	Schema            string `xml:"schema"`
	MetadataNamespace string `xml:"metadataNamespace"`
}

type OAIError

type OAIError struct {
	Code    string `xml:"code,attr"`
	Message string `xml:",chardata"`
}

type Record

type Record struct {
	Header   Header   `xml:"header"`
	Metadata Metadata `xml:"metadata"`
	About    About    `xml:"about"`
}

type Request

type Request struct {
	BaseURL         string
	Set             string
	MetadataPrefix  string
	Verb            string
	Identifier      string
	ResumptionToken string
	From            string
	Until           string
}

Request represents a request URL and query string to an OAI-PMH service

func (*Request) ChannelHarvestIdentifiers

func (request *Request) ChannelHarvestIdentifiers(channels []chan *Header)

ChannelHarvestIdentifiers harvest the identifiers of a complete OAI set send a reference of each Header to a channel

func (*Request) GetFullURL

func (request *Request) GetFullURL() string

GetFullURL represents the OAI Request in a string format

func (*Request) Harvest

func (request *Request) Harvest(batchCallback func(*Response))

Harvest perform a harvest of a complete OAI set, or simply one request call the batchCallback function argument with the OAI responses

func (*Request) HarvestIdentifiers

func (request *Request) HarvestIdentifiers(callback func(*Header))

HarvestIdentifiers arvest the identifiers of a complete OAI set call the identifier callback function for each Header

func (*Request) HarvestRecords

func (request *Request) HarvestRecords(callback func(*Record))

HarvestRecords harvest the identifiers of a complete OAI set call the identifier callback function for each Header

func (*Request) Perform

func (request *Request) Perform() (oaiResponse *Response)

Perform an HTTP GET request using the OAI Requests fields and return an OAI Response reference

type RequestNode

type RequestNode struct {
	Verb           string `xml:"verb,attr"`
	Set            string `xml:"set,attr"`
	MetadataPrefix string `xml:"metadataPrefix,attr"`
}

type Response

type Response struct {
	ResponseDate string      `xml:"responseDate"`
	Request      RequestNode `xml:"request"`
	Error        OAIError    `xml:"error"`

	Identify            Identify            `xml:"Identify"`
	ListMetadataFormats ListMetadataFormats `xml:"ListMetadataFormats"`
	ListSets            ListSets            `xml:"ListSets"`
	GetRecord           GetRecord           `xml:"GetRecord"`
	ListIdentifiers     ListIdentifiers     `xml:"ListIdentifiers"`
	ListRecords         ListRecords         `xml:"ListRecords"`
}

The struct representation of an OAI-PMH XML response

func FromFile

func FromFile(filename string) (oaiResponse *Response)

FromFile reads OAI PMH response XML from a file

func (*Response) ResumptionToken

func (resp *Response) ResumptionToken() (hasResumptionToken bool, resumptionToken string)

ResumptionToken determine the resumption token in this Response

type Set

type Set struct {
	SetSpec        string      `xml:"setSpec"`
	SetName        string      `xml:"setName"`
	SetDescription Description `xml:"setDescription"`
}

Jump to

Keyboard shortcuts

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