chronam

package
v2.5.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package chronam describes various internal structures for deserializing data from the live app's APIs and data

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchIssueXML

type BatchIssueXML struct {
	EditionOrder string `xml:"editionOrder,attr"`
	Date         string `xml:"issueDate,attr"`
	LCCN         string `xml:"lccn,attr"`
	Content      string `xml:",innerxml"`
}

BatchIssueXML describes each <issue> element in the batch XML

type BatchJSON

type BatchJSON struct {
	Name   string
	Issues []*IssueMetadata
	LCCNs  []string
}

BatchJSON is what we get from a batch-details API request

func ParseBatchJSON

func ParseBatchJSON(encoded []byte) (*BatchJSON, error)

ParseBatchJSON takes a pile of bytes and attempts to convert them into a BatchJSON structure. If json.Unmarshal has an error, it will be returned along with a nil object.

type BatchMetadata

type BatchMetadata struct {
	Name string
	URL  string
}

BatchMetadata holds the high-level batch metadata: name and URL to query detailed batch information

type BatchXML

type BatchXML struct {
	XMLName xml.Name        `xml:"batch"`
	Issues  []BatchIssueXML `xml:"issue"`
}

BatchXML is used to deserialize batch.xml files to get at their issues list

func ParseBatchXML

func ParseBatchXML(xmlFile string) (*BatchXML, error)

ParseBatchXML opens the given batch.xml file for a given batch path and returns the decoded XML structure. This is intended primarily for retrieving the list of issues in a batch.

type BatchesListJSON

type BatchesListJSON struct {
	Batches []*BatchMetadata
	Next    string
}

BatchesListJSON is what we get from a batches API request. It stores the list of batches' metadata and the link to the next page of results, if one is present.

func ParseBatchesListJSON

func ParseBatchesListJSON(encoded []byte) (*BatchesListJSON, error)

ParseBatchesListJSON takes a pile of bytes and attempts to convert them into a BatchesListJSON structure. If json.Unmarshal has an error, it will be returned along with a nil object.

type DescriptiveMetadata

type DescriptiveMetadata struct {
	ID   string    `xml:"ID,attr"`
	Data mods.Data `xml:"mdWrap>xmlData>mods"`
}

DescriptiveMetadata holds the <dmdSec> stuff

type IssueMetadata

type IssueMetadata struct {
	URL   string
	Date  string `json:"date_issued"`
	Title struct {
		URL  string
		Name string
	}
}

IssueMetadata is stored in a batch's issue list and gives us the information we need to query issue and title details

type METSHeader

type METSHeader struct {
	CreateDate string `xml:"CREATEDATE,attr"`
}

METSHeader just gives us the XML file's creation date

type METSIssue

type METSIssue struct {
	XMLName xml.Name              `xml:"mets"`
	Label   string                `xml:"LABEL,attr"`
	Header  METSHeader            `xml:"metsHdr"`
	DMDSecs []DescriptiveMetadata `xml:"dmdSec"`
}

A METSIssue stores deserialized issue XML, but at this time it *cannot* be reserialized due to bugs in how Go handles namespaces. This is primarily for converting live issues into data structures which can then be serialized out again to verify the correctness of our custom METS output.

func ParseMETSIssueXML

func ParseMETSIssueXML(filename string) (*METSIssue, error)

ParseMETSIssueXML reads the given file to extract the relevant METSIssue data

type TitleJSON

type TitleJSON struct {
	LCCN               string
	Name               string
	PlaceOfPublication string
	Place              []string
	StartYear          string
	EndYear            string
	Subject            []string
}

TitleJSON is what we get from a title-details API request

func ParseTitleJSON

func ParseTitleJSON(encoded []byte) (*TitleJSON, error)

ParseTitleJSON takes a pile of bytes and attempts to convert them into a TitleJSON structure. If json.Unmarshal has an error, it will be returned along with a nil object.

Jump to

Keyboard shortcuts

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