dodp

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: MIT Imports: 8 Imported by: 0

README

Incomplete Golang implementation of the DAISY Online Delivery Protocol v1: https://daisy.org/activities/standards/dodp/specification-for-the-daisy-online-delivery-protocol-v1/

Documentation

Overview

Package dodp implements DAISY Online Delivery Protocol v1.

Index

Constants

View Source
const (
	TEXT_NUMERIC      = "TEXT_NUMERIC"
	TEXT_ALPHANUMERIC = "TEXT_ALPHANUMERIC"
	AUDIO             = "AUDIO"
)

Supported input types

View Source
const (
	Issued  = "issued"
	New     = "new"
	Expired = "expired"
)

The identifiers of the content list for getContentList operation

View Source
const (
	Default = "default"
	Search  = "search"
	Back    = "back"
)

The identifiers of the question for getQuestions operation

Variables

This section is empty.

Functions

This section is empty.

Types

type Announcement

type Announcement struct {
	XMLName  xml.Name `xml:"announcement"`
	ID       string   `xml:"id,attr"`
	Type     string   `xml:"type,attr"`
	Priority int32    `xml:"priority,attr"`
	Label    Label
}

type Announcements

type Announcements struct {
	XMLName      xml.Name       `xml:"announcements"`
	Announcement []Announcement `xml:"announcement"`
}

type Audio

type Audio struct {
	XMLName    xml.Name `xml:"audio"`
	URI        string   `xml:"uri,attr"`
	RangeBegin int64    `xml:"rangeBegin,attr"`
	RangeEnd   int64    `xml:"rangeEnd,attr"`
	Size       int64    `xml:"size,attr"`
}

type Bookmark added in v0.3.0

type Bookmark struct {
	XMLName    xml.Name `xml:"bookmark"`
	NcxRef     string   `xml:"ncxRef"`
	URI        string   `xml:"URI"`
	TimeOffset string   `xml:"timeOffset"`
	CharOffset string   `xml:"charOffset"`
	Note       Note
	Label      string `xml:"label,attr"`
	Lang       string `xml:"lang,attr"`
}

type BookmarkSet added in v0.3.0

type BookmarkSet struct {
	XMLName  xml.Name `xml:"http://www.daisy.org/z3986/2005/bookmark/ bookmarkSet"`
	Title    Title
	UID      string `xml:"uid"`
	Lastmark Lastmark
	Bookmark []Bookmark `xml:"bookmark,omitempty"`
	Hilite   []Hilite   `xml:"hilite,omitempty"`
}

type Choice

type Choice struct {
	XMLName xml.Name `xml:"choice"`
	ID      string   `xml:"id,attr"`
	Label   Label
}

type Choices

type Choices struct {
	XMLName xml.Name `xml:"choices"`
	Choice  []Choice `xml:"choice"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

DAISY Online client

func NewClient

func NewClient(url string, timeout time.Duration) *Client

func NewClientWithContext added in v0.2.0

func NewClientWithContext(ctx context.Context, url string, timeout time.Duration) *Client

Creates an instance of a new DAISY Online client with context and the specified service URL. Timeout limits the execution time of each HTTP request for this client. Zero timeout means no timeout.

func (*Client) GetBookmarks added in v0.3.0

func (c *Client) GetBookmarks(contentID string) (*BookmarkSet, error)

Retrieves the bookmarks for a Content item from a Service.

func (*Client) GetContentList

func (c *Client) GetContentList(id string, firstItem int32, lastItem int32) (*ContentList, error)

Retrieves a list of Content items. The list returned by the Service can be pre-composed, in which case it is retrieved by passing one of the three reserved values defined in the id parameter below. (Refer to 4, Protocol Fundamentals for information on the contexts in which these reserved values are used.) The list can also be dynamic (e.g., the result of a dynamic menu search operation sequence). In this case, the id value used to refer to the list is provided in the return value of a previous call to getQuestions. (Refer to the questions type for more information.)

func (*Client) GetContentMetadata

func (c *Client) GetContentMetadata(contentID string) (*ContentMetadata, error)

Retrieves the contentMetadata of the specified Content item. This operation must be called as part of the Content Retrieval Sequence.

func (*Client) GetContentResources

func (c *Client) GetContentResources(contentID string) (*Resources, error)

Retrieves the resources list for the specified Content item. The Content item must be issued before this operation is called. If not, the Service shall respond with an invalidParameter Fault.

func (*Client) GetQuestions

func (c *Client) GetQuestions(userResponses *UserResponses) (*Questions, error)

Retrieves a question from the series of questions that comprise the dynamic menu system.

func (*Client) GetServiceAnnouncements

func (c *Client) GetServiceAnnouncements() (*Announcements, error)

Retrieves any announcements from the Service that a User has not yet read.

func (*Client) GetServiceAttributes

func (c *Client) GetServiceAttributes() (*ServiceAttributes, error)

Retrieves Service properties, including information on which optional Operations the Service supports. A Reading System must call this operation as part of the Session Initialization Sequence and may call the operation to retrieve information on possible changes to Service properties at any other time during a Session.

func (*Client) IssueContent

func (c *Client) IssueContent(contentID string) (bool, error)

Requests a Service to issue the specified Content item.

func (*Client) LogOff

func (c *Client) LogOff() (bool, error)

Logs a Reading System off a Service. A return value of false or a Fault both indicate that the operation was not successful.

func (*Client) LogOn

func (c *Client) LogOn(username, password string) (bool, error)

Logs a Reading System on to a Service.

func (*Client) MarkAnnouncementsAsRead added in v0.3.0

func (c *Client) MarkAnnouncementsAsRead(read *Read) (bool, error)

Marks the specified announcement(s) as read. This operation is only valid if a previous call to getServiceAnnouncements has been made during the Session.

func (*Client) ReturnContent

func (c *Client) ReturnContent(contentID string) (bool, error)

Notifies the Service that the specified Content item has been deleted from the Reading System. The specified Content item is no longer issued to the User after a successful call to this operation. A Reading System must not call this function for a Content item that has a requiresReturn attribute with a value of false. A Reading System must delete the Content item before calling returnContent. A Reading System must not call returnContent for a Content item that was not issued to the User on that Reading System.

func (*Client) SetBookmarks added in v0.3.0

func (c *Client) SetBookmarks(contentID string, bookmarkSet *BookmarkSet) (bool, error)

Requests that a Service store the supplied bookmarks for a Content item. This operation only supports the storage of bookmarks for one Content item at a time.

func (*Client) SetReadingSystemAttributes

func (c *Client) SetReadingSystemAttributes(readingSystemAttributes *ReadingSystemAttributes) (bool, error)

Sends Reading System properties to a Service. A Reading System must call this operation as part of the Session Initialization Sequence. The operation may be called additional times during a Session to record dynamic changes in a Reading System's properties.

type Config

type Config struct {
	XMLName                           xml.Name `xml:"config"`
	SupportsMultipleSelections        bool     `xml:"supportsMultipleSelections"`
	PreferredUILanguage               string   `xml:"preferredUILanguage"`
	SupportedContentFormats           SupportedContentFormats
	SupportedContentProtectionFormats SupportedContentProtectionFormats
	SupportedMimeTypes                SupportedMimeTypes
	SupportedInputTypes               SupportedInputTypes
	RequiresAudioLabels               bool `xml:"requiresAudioLabels"`
}

type ContentItem

type ContentItem struct {
	XMLName          xml.Name `xml:"contentItem"`
	ID               string   `xml:"id,attr"`
	LastModifiedDate string   `xml:"lastModifiedDate,attr"`
	Label            Label
}

type ContentList

type ContentList struct {
	XMLName      xml.Name `xml:"contentList"`
	TotalItems   int32    `xml:"totalItems,attr"`
	FirstItem    int32    `xml:"firstItem,attr"`
	LastItem     int32    `xml:"lastItem,attr"`
	ID           string   `xml:"id,attr"`
	Label        Label
	ContentItems []ContentItem `xml:"contentItem"`
}

type ContentMetadata

type ContentMetadata struct {
	XMLName        xml.Name `xml:"contentMetadata"`
	Category       string   `xml:"category,attr"`
	RequiresReturn bool     `xml:"requiresReturn,attr"`
	Sample         Sample
	Metadata       Metadata
}

type Fault

type Fault struct {
	XMLName     xml.Name `xml:"Fault"`
	Faultstring string   `xml:"faultstring"`
}

SOAP fault

func (*Fault) Error

func (f *Fault) Error() string

type Hilite added in v0.3.0

type Hilite struct {
	XMLName     xml.Name `xml:"hilite"`
	HiliteStart HiliteStart
	HiliteEnd   HiliteEnd
	Note        Note
	Label       string `xml:"label,attr"`
}

type HiliteEnd added in v0.3.0

type HiliteEnd struct {
	XMLName    xml.Name `xml:"hiliteEnd"`
	NcxRef     string   `xml:"ncxRef"`
	URI        string   `xml:"URI"`
	TimeOffset string   `xml:"timeOffset"`
	CharOffset string   `xml:"charOffset"`
}

type HiliteStart added in v0.3.0

type HiliteStart struct {
	XMLName    xml.Name `xml:"hiliteStart"`
	NcxRef     string   `xml:"ncxRef"`
	URI        string   `xml:"URI"`
	TimeOffset string   `xml:"timeOffset"`
	CharOffset string   `xml:"charOffset"`
}

type Input

type Input struct {
	XMLName xml.Name `xml:"input"`
	Type    string   `xml:"type,attr"`
}

type InputQuestion

type InputQuestion struct {
	XMLName    xml.Name `xml:"inputQuestion"`
	ID         string   `xml:"id,attr"`
	InputTypes InputTypes
	Label      Label
}

type InputTypes

type InputTypes struct {
	XMLName xml.Name `xml:"inputTypes"`
	Input   []Input  `xml:"input"`
}

type Label

type Label struct {
	XMLName xml.Name `xml:"label"`
	Lang    string   `xml:"lang,attr"`
	Dir     string   `xml:"dir,attr"`
	Text    string   `xml:"text"`
	Audio   Audio
}

A multi-purpose label, containing text and optionally audio. To achieve maximum interoperability, Services should support the provision of audio labels, as Reading Systems may require them in order to render Service messages to the user.

type Lastmark added in v0.3.0

type Lastmark struct {
	XMLName    xml.Name `xml:"lastmark,omitempty"`
	NcxRef     string   `xml:"ncxRef"`
	URI        string   `xml:"URI"`
	TimeOffset string   `xml:"timeOffset"`
	CharOffset string   `xml:"charOffset"`
}

type Meta

type Meta struct {
	XMLName xml.Name `xml:"meta"`
	Name    string   `xml:"name,attr"`
	Content string   `xml:"content,attr"`
}

type Metadata

type Metadata struct {
	XMLName     xml.Name `xml:"metadata"`
	Title       string   `xml:"title"`
	Identifier  string   `xml:"identifier"`
	Publisher   string   `xml:"publisher"`
	Format      string   `xml:"format"`
	Date        string   `xml:"date"`
	Source      string   `xml:"source"`
	Type        []string `xml:"type"`
	Subject     []string `xml:"subject"`
	Rights      []string `xml:"rights"`
	Relation    []string `xml:"relation"`
	Language    []string `xml:"language"`
	Description []string `xml:"description"`
	Creator     []string `xml:"creator"`
	Coverage    []string `xml:"coverage"`
	Contributor []string `xml:"contributor"`
	Narrator    []string `xml:"narrator"`
	Size        int64    `xml:"size"`
	Meta        []Meta   `xml:"meta"`
}

type MimeType

type MimeType struct {
	XMLName xml.Name `xml:"mimeType"`
	Type    string   `xml:"type,attr"`
}

type MultipleChoiceQuestion

type MultipleChoiceQuestion struct {
	XMLName                 xml.Name `xml:"multipleChoiceQuestion"`
	ID                      string   `xml:"id,attr"`
	AllowMultipleSelections bool     `xml:"allowMultipleSelections,attr"`
	Label                   Label
	Choices                 Choices
}

type Note added in v0.3.0

type Note struct {
	XMLName xml.Name `xml:"note"`
	Text    string   `xml:"text,omitempty"`
}

type Questions

type Questions struct {
	XMLName                xml.Name                 `xml:"questions"`
	MultipleChoiceQuestion []MultipleChoiceQuestion `xml:"multipleChoiceQuestion"`
	InputQuestion          []InputQuestion          `xml:"inputQuestion"`
	ContentListRef         string                   `xml:"contentListRef"`
	Label                  Label
}

type Read added in v0.3.0

type Read struct {
	XMLName xml.Name `xml:"read"`
	Item    []string `xml:"item"`
}

type ReadingSystemAttributes

type ReadingSystemAttributes struct {
	XMLName      xml.Name `xml:"readingSystemAttributes"`
	Manufacturer string   `xml:"manufacturer"`
	Model        string   `xml:"model"`
	Version      string   `xml:"version"`
	Config       Config
}

Specifies Reading System properties. The properties specified are valid until the end of the Session.

type Resource

type Resource struct {
	XMLName          xml.Name `xml:"resource"`
	URI              string   `xml:"uri,attr"`
	MimeType         string   `xml:"mimeType,attr"`
	Size             int64    `xml:"size,attr"`
	LocalURI         string   `xml:"localURI,attr"`
	LastModifiedDate string   `xml:"lastModifiedDate,attr"`
}

type Resources

type Resources struct {
	XMLName          xml.Name   `xml:"resources"`
	ReturnBy         string     `xml:"returnBy,attr"`
	LastModifiedDate string     `xml:"lastModifiedDate,attr"`
	Resources        []Resource `xml:"resource"`
}

A list of all the resources that constitute the Content item.

type Sample

type Sample struct {
	XMLName xml.Name `xml:"sample"`
	ID      string   `xml:"id,attr"`
}

A sample of the Content item that the User may retrieve without the Content item being issued.

type Service

type Service struct {
	XMLName xml.Name `xml:"service"`
	ID      string   `xml:"id,attr"`
	Label   Label
}

The identity of the Service.

type ServiceAttributes

type ServiceAttributes struct {
	XMLName                          xml.Name `xml:"serviceAttributes"`
	ServiceProvider                  ServiceProvider
	Service                          Service
	SupportedContentSelectionMethods SupportedContentSelectionMethods
	SupportsServerSideBack           bool `xml:"supportsServerSideBack"`
	SupportsSearch                   bool `xml:"supportsSearch"`
	SupportedUplinkAudioCodecs       SupportedUplinkAudioCodecs
	SupportsAudioLabels              bool `xml:"supportsAudioLabels"`
	SupportedOptionalOperations      SupportedOptionalOperations
}

Properties of the Service. The properties specified must be constant for the duration of the Session.

type ServiceProvider

type ServiceProvider struct {
	XMLName xml.Name `xml:"serviceProvider"`
	ID      string   `xml:"id,attr"`
	Label   Label
}

The identity of the Service Provider.

type SupportedContentFormats

type SupportedContentFormats struct {
	XMLName       xml.Name `xml:"supportedContentFormats"`
	ContentFormat []string `xml:"contentFormat"`
}

Specifies which Content formats the Reading System supports. A Service may use this information to choose which formats to offer to the Reading System. This document does not specify the behavior of the Service if this list is empty.

type SupportedContentProtectionFormats

type SupportedContentProtectionFormats struct {
	XMLName          xml.Name `xml:"supportedContentProtectionFormats"`
	ProtectionFormat []string `xml:"protectionFormat"`
}

Specifies which Content protection (Digital Rights Management) standards the Reading System supports, if any.

type SupportedContentSelectionMethods

type SupportedContentSelectionMethods struct {
	XMLName xml.Name `xml:"supportedContentSelectionMethods"`
	Method  []string `xml:"method"`
}

A list of Content Selection Methods supported by this Service. A Service must support at least one of the two methods.

type SupportedInputTypes

type SupportedInputTypes struct {
	XMLName xml.Name `xml:"supportedInputTypes"`
	Input   []Input  `xml:"input"`
}

type SupportedMimeTypes

type SupportedMimeTypes struct {
	XMLName  xml.Name   `xml:"supportedMimeTypes"`
	MimeType []MimeType `xml:"mimeType"`
}

type SupportedOptionalOperations

type SupportedOptionalOperations struct {
	XMLName   xml.Name `xml:"supportedOptionalOperations"`
	Operation []string `xml:"operation"`
}

Specifies which (if any) of the optional operations are supported by the Service.

type SupportedUplinkAudioCodecs

type SupportedUplinkAudioCodecs struct {
	XMLName xml.Name `xml:"supportedUplinkAudioCodecs"`
	Codec   []string `xml:"codec"`
}

A list of the audio codecs (if any) supported in userResponses in addition to [ RIFF WAVE ] .

type Title added in v0.3.0

type Title struct {
	XMLName xml.Name `xml:"title"`
	Text    string   `xml:"text"`
}

type UserResponse

type UserResponse struct {
	XMLName    xml.Name `xml:"userResponse"`
	QuestionID string   `xml:"questionID,attr"`
	Value      string   `xml:"value,attr,omitempty"`
	Data       string   `xml:"data,omitempty"`
}

type UserResponses

type UserResponses struct {
	XMLName      xml.Name       `xml:"userResponses"`
	UserResponse []UserResponse `xml:"userResponse"`
}

A set of User responses to questions provided by the Service.

Jump to

Keyboard shortcuts

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