Documentation
¶
Overview ¶
Package opds provides structures to represent valid OPDS feeds According to https://specs.opds.io/opds-1.2
Index ¶
- Constants
- type Author
- type Content
- type Entry
- type Feed
- type FeedBuilder
- func (builder *FeedBuilder) Build() *Feed
- func (builder *FeedBuilder) WithAuthor(author *Author) *FeedBuilder
- func (builder *FeedBuilder) WithEntries(entries []*Entry) *FeedBuilder
- func (builder *FeedBuilder) WithID(id string) *FeedBuilder
- func (builder *FeedBuilder) WithLinks(links []*Link) *FeedBuilder
- func (builder *FeedBuilder) WithTitle(title string) *FeedBuilder
- func (builder *FeedBuilder) WithType(kind FeedType) *FeedBuilder
- func (builder *FeedBuilder) WithUpdated(updated time.Time) *FeedBuilder
- type FeedType
- type Link
Constants ¶
const ( // AcquisitionLink points to an acquisition feed: https://specs.opds.io/opds-1.2#23-acquisition-feeds AcquisitionLink = "application/atom+xml;profile=opds-catalog;kind=acquisition" )NavigationLink = "application/atom+xml;profile=opds-catalog;kind=navigation"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Author ¶
type Author struct { XMLName xml.Name `xml:"author"` Name string `xml:"name"` URI string `xml:"uri,omitempty"` }
Author of a resource
type Content ¶
type Content struct { XMLName xml.Name `xml:"content"` Content string `xml:",cdata"` Type string `xml:"type,attr"` }
Content of an entry
type Entry ¶
type Entry struct { XMLName xml.Name `xml:"entry"` ID string `xml:"id"` Title string `xml:"title"` Links []*Link `xml:",omitempty"` Updated time.Time `xml:"updated"` Content *Content `xml:",omitempty"` Summary string `xml:"summary,omitempty"` Authors []*Author `xml:",omitempty"` }
Entry represents an entry of an OPDS feed
type Feed ¶
type Feed struct { XMLName xml.Name `xml:"feed"` Xmlns string `xml:"xmlns,attr"` Xmlnsdc string `xml:"xmlns:dc,attr,omitempty"` Xmlnbookshelf string `xml:"xmlns:opds,attr,omitempty"` Title string `xml:"title"` ID string `xml:"id"` Updated time.Time `xml:"updated"` Links []*Link `xml:"links,omitempty"` Author *Author `xml:"author,omitempty"` Entries []*Entry `xml:",omitempty"` }
Feed represents an OPDS feed, use a FeedBuilder to properly create namespaced feed
type FeedBuilder ¶
type FeedBuilder struct {
// contains filtered or unexported fields
}
FeedBuilder allow to build a Feed while enforcing few invariants
func NewFeedBuilder ¶
func NewFeedBuilder() *FeedBuilder
NewFeedBuilder creates a FeedBuilder ready to use
func (*FeedBuilder) Build ¶
func (builder *FeedBuilder) Build() *Feed
Build will return the feed as configured by the FeedBuilder
func (*FeedBuilder) WithAuthor ¶
func (builder *FeedBuilder) WithAuthor(author *Author) *FeedBuilder
WithAuthor sets the feed's author
func (*FeedBuilder) WithEntries ¶
func (builder *FeedBuilder) WithEntries(entries []*Entry) *FeedBuilder
WithEntries adds entries to the feed
func (*FeedBuilder) WithID ¶
func (builder *FeedBuilder) WithID(id string) *FeedBuilder
WithID sets the feed's ID
func (*FeedBuilder) WithLinks ¶
func (builder *FeedBuilder) WithLinks(links []*Link) *FeedBuilder
WithLinks adds links to the feed
func (*FeedBuilder) WithTitle ¶
func (builder *FeedBuilder) WithTitle(title string) *FeedBuilder
WithTitle sets the feed's title
func (*FeedBuilder) WithType ¶
func (builder *FeedBuilder) WithType(kind FeedType) *FeedBuilder
WithType sets the feed's type, and may update the XML namespace accordingly
func (*FeedBuilder) WithUpdated ¶
func (builder *FeedBuilder) WithUpdated(updated time.Time) *FeedBuilder
WithUpdated sets the feed's updated date
type FeedType ¶
type FeedType string
FeedType denotes the OPDS type, being either a navigation or acquisition feed See https://specs.opds.io/opds-1.2#2-opds-catalog-feed-documents
const ( FeedType = "navigation" // Acquisition feed: https://specs.opds.io/opds-1.2#23-acquisition-feeds Acquisition = "acquisition" )Navigation