daisyonline

package module
v0.0.0-...-853f4b0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2021 License: MIT Imports: 5 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

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 int      `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 int      `xml:"rangeBegin,attr"`
	RangeEnd   int      `xml:"rangeEnd,attr"`
	Size       int64    `xml:"size,attr"`
}

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
}

func NewClient

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

func (*Client) GetContentList

func (c *Client) GetContentList(id string, firstItem int, lastItem int) (*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) 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) 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   int      `xml:"totalItems,attr"`
	FirstItem    int      `xml:"firstItem,attr"`
	LastItem     int      `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"`
}

func (*Fault) Error

func (f *Fault) Error() string

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 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 Questions

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

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 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