oaipmh

package
v0.0.0-...-ab1f78f Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OAIDC = &MetadataFormat{
		MetadataPrefix:    "oai_dc",
		Schema:            "http://www.openarchives.org/OAI/2.0/oai_dc.xsd",
		MetadataNamespace: "http://www.openarchives.org/OAI/2.0/oai_dc/",
	}

	// TODO make all errors private and remove Error method
	ErrCannotDisseminateFormat = &Error{Code: "cannotDisseminateFormat", Value: "the metadata format identified by the value given for the metadataPrefix argument is not supported by the item or by the repository"}
	ErrBadResumptionToken      = &Error{Code: "badResumptionToken", Value: "the value of the resumptionToken argument is invalid or expired"}
)

Functions

This section is empty.

Types

type Error

type Error struct {
	XMLName xml.Name `xml:"error"`
	Code    string   `xml:"code,attr"`
	Value   string   `xml:",chardata"`
}

func (*Error) Error

func (e *Error) Error() string

type GetRecord

type GetRecord struct {
	XMLName xml.Name `xml:"GetRecord"`
	Record  *Record  `xml:"record"`
}
type Header struct {
	Status     string   `xml:"status,attr,omitempty"`
	Identifier string   `xml:"identifier"`
	Datestamp  string   `xml:"datestamp"`
	SetSpecs   []string `xml:"setSpec"`
}

type Identify

type Identify struct {
	XMLName           xml.Name `xml:"Identify"`
	RepositoryName    string   `xml:"repositoryName"`
	BaseURL           string   `xml:"baseURL"`
	ProtocolVersion   string   `xml:"protocolVersion"`
	AdminEmails       []string `xml:"adminEmail"`
	Granularity       string   `xml:"granularity"`
	EarliestDatestamp string   `xml:"earliestDatestamp"`
	Compression       string   `xml:"compression,omitempty"`
	DeletedRecord     string   `xml:"deletedRecord"`
}

type ListIdentifiers

type ListIdentifiers struct {
	XMLName         xml.Name         `xml:"ListIdentifiers"`
	Headers         []*Header        `xml:"header"`
	ResumptionToken *ResumptionToken `xml:"resumptionToken"`
}

type ListMetadataFormats

type ListMetadataFormats struct {
	XMLName         xml.Name          `xml:"ListMetadataFormats"`
	MetadataFormats []*MetadataFormat `xml:"metadataFormat"`
}

type ListRecords

type ListRecords struct {
	XMLName         xml.Name         `xml:"ListRecords"`
	Records         []*Record        `xml:"record"`
	ResumptionToken *ResumptionToken `xml:"resumptionToken"`
}

type ListSets

type ListSets struct {
	XMLName         xml.Name         `xml:"ListSets"`
	Sets            []*Set           `xml:"set"`
	ResumptionToken *ResumptionToken `xml:"resumptionToken"`
}

type MetadataFormat

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

type Payload

type Payload struct {
	XML string `xml:",innerxml"`
}

type Provider

type Provider struct {
	ProviderConfig
	// contains filtered or unexported fields
}

func NewProvider

func NewProvider(conf ProviderConfig) (*Provider, error)

func (*Provider) ServeHTTP

func (p *Provider) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ProviderBackend

type ProviderBackend interface {
	GetEarliestDatestamp(context.Context) (time.Time, error)
	HasMetadataFormat(context.Context, string) (bool, error)
	HasSets(context.Context) (bool, error)
	HasSet(context.Context, string) (bool, error)
	GetMetadataFormats(context.Context) ([]*MetadataFormat, error)
	GetRecordMetadataFormats(context.Context, string) ([]*MetadataFormat, error)
	GetSets(context.Context) ([]*Set, *ResumptionToken, error)
	GetMoreSets(context.Context, string) ([]*Set, *ResumptionToken, error)
	// TODO pass from, until as time objects
	GetIdentifiers(context.Context, string, string, string, string) ([]*Header, *ResumptionToken, error)
	GetMoreIdentifiers(context.Context, string) ([]*Header, *ResumptionToken, error)
	HasRecord(context.Context, string) (bool, error)
	GetRecords(context.Context, string, string, string, string) ([]*Record, *ResumptionToken, error)
	GetMoreRecords(context.Context, string) ([]*Record, *ResumptionToken, error)
	GetRecord(context.Context, string, string) (*Record, error)
}

type ProviderConfig

type ProviderConfig struct {
	RepositoryName string
	BaseURL        string
	AdminEmails    []string
	Granularity    string
	Compression    string
	DeletedRecord  string
	StyleSheet     string
	ErrorHandler   func(error)
	Backend        ProviderBackend
}

TODO use context in callbacks

type Record

type Record struct {
	Header   *Header  `xml:"header"`
	Metadata *Payload `xml:"metadata"`
}

type ResumptionToken

type ResumptionToken struct {
	CompleteListSize int    `xml:"completeListSize,attr,omitempty"`
	Value            string `xml:",chardata"`
	ExpirationDate   string `xml:"expirationDate,attr,omitempty"`
	Cursor           *int   `xml:"cursor,attr,omitempty"`
}

type Set

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

Jump to

Keyboard shortcuts

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