Documentation
¶
Overview ¶
Package types contains methods and objects that are shared across different Feed schemas/specifications.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // MimeTypesIndeterminate contains mimetypes that can be used for either RSS/Atom feeds and don't give any clues to // the actual type. MimeTypesIndeterminate = []string{"application/xml", "text/xml"} // MimeTypesFeed is the concatenation of all feed mime types. MimeTypesFeed = slices.Concat(atom.MimeTypes, rss.MimeTypes, jsonfeed.MimeTypes, MimeTypesIndeterminate) // MimeTypesHTML contains canonical/standard mimetypes for HTML. MimeTypesHTML = []string{"text/html", "application/xhtml+xml"} // MimeTypesImage contains canonical/standard/common mimetypes for images. MimeTypesImage = []string{"image/avif", "image/gif", "image/jpeg", "image/png", "image/svg+xml", "image/webp"} )
var ( // ErrParseBytes indicates an error occurred trying to parse a byte array as a feed. ErrParseBytes = errors.New("unable to parse bytes as feed") )
var ErrUnmarshal = errors.New("unmarshaling object failed")
ErrUnmarshal indicates an error occurred trying to unmarshal data into a given feed object.
Functions ¶
func Decode ¶
Decode will decode the byte array into the given type T, and assign values without a namespace with the given namespace.
func DetectSourceType ¶
DetectSourceType determines the feed source by extracting key signatures from the data. It can detect supported feed formats as well as HTML.
Types ¶
type Feed ¶
type Feed struct {
types.FeedSource `json:"source"`
SourceType types.Source `json:"type"`
}
Feed represents any feed type containing a number of items.
func NewDecoder ¶
NewDecoder will create a new Feed of the given type from the given io.Reader.
func NewFeedFromSource ¶
func NewFeedFromSource[T types.FeedSource](source T) *Feed
NewFeedFromSource will create a new Feed from the given source that satisfies the FeedSource interface. This can be used to create a Feed from an existing rss.RSS or atom.Feed object.
func (*Feed) UnmarshalJSON ¶
UnmarshalJSON handles unmarshaling of a Feed from JSON.
type Item ¶
type Item struct {
types.ItemSource `json:"source"`
SourceType types.Source `json:"type"`
FeedTitle string `json:"feed_title"`
}
Item represents a single item or entry (or article) in a feed.
func (*Item) UnmarshalJSON ¶
UnmarshalJSON handles unmarshaling of an Item from JSON.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package atom provides primitives to interact with the openapi HTTP API.
|
Package atom provides primitives to interact with the openapi HTTP API. |
|
Package extensions provides primitives to interact with the openapi HTTP API.
|
Package extensions provides primitives to interact with the openapi HTTP API. |
|
basicgeo
Package basicgeo provides primitives to interact with the openapi HTTP API.
|
Package basicgeo provides primitives to interact with the openapi HTTP API. |
|
content
Package content provides primitives to interact with the openapi HTTP API.
|
Package content provides primitives to interact with the openapi HTTP API. |
|
dc
Package dc provides primitives to interact with the openapi HTTP API.
|
Package dc provides primitives to interact with the openapi HTTP API. |
|
georss
Package georss provides primitives to interact with the openapi HTTP API.
|
Package georss provides primitives to interact with the openapi HTTP API. |
|
googleplay
Package googleplay provides primitives to interact with the openapi HTTP API.
|
Package googleplay provides primitives to interact with the openapi HTTP API. |
|
itunes
Package itunes provides primitives to interact with the openapi HTTP API.
|
Package itunes provides primitives to interact with the openapi HTTP API. |
|
link
Package link provides primitives to interact with the openapi HTTP API.
|
Package link provides primitives to interact with the openapi HTTP API. |
|
media
Package media provides primitives to interact with the openapi HTTP API.
|
Package media provides primitives to interact with the openapi HTTP API. |
|
slash
Package slash provides primitives to interact with the openapi HTTP API.
|
Package slash provides primitives to interact with the openapi HTTP API. |
|
source
Package source provides primitives to interact with the openapi HTTP API.
|
Package source provides primitives to interact with the openapi HTTP API. |
|
syndication
Package syndication provides primitives to interact with the openapi HTTP API.
|
Package syndication provides primitives to interact with the openapi HTTP API. |
|
wfw
Package wfw provides primitives to interact with the openapi HTTP API.
|
Package wfw provides primitives to interact with the openapi HTTP API. |
|
Package jsonfeed provides primitives to interact with the openapi HTTP API.
|
Package jsonfeed provides primitives to interact with the openapi HTTP API. |
|
Package opml provides primitives to interact with the openapi HTTP API.
|
Package opml provides primitives to interact with the openapi HTTP API. |
|
Package rdf provides primitives to interact with the openapi HTTP API.
|
Package rdf provides primitives to interact with the openapi HTTP API. |
|
Package rss provides primitives to interact with the openapi HTTP API.
|
Package rss provides primitives to interact with the openapi HTTP API. |
|
Package schema contains the OpenAPI schema definitions for go-syndication.
|
Package schema contains the OpenAPI schema definitions for go-syndication. |
|
Package types provides primitives to interact with the openapi HTTP API.
|
Package types provides primitives to interact with the openapi HTTP API. |