Documentation
¶
Overview ¶
Package feeds provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.
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 ¶
Types ¶
type Feed ¶
type Feed struct {
types.FeedSource `json:"source"`
SourceType SourceType `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 Image ¶
type Image struct {
// URL the URL to the image.
URL string `json:"URL" validate:"required,url"`
// Description is a description of the image (for example, the alt tag associated with the image).
Description *string `json:"description,omitempty"`
}
Image represents a remote image.
type Item ¶
type Item struct {
types.ItemSource `json:"source"`
SourceType SourceType `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.
type Link ¶
type Link struct {
// Type is the type of address. While there are some canonical values for the type, they are not conclusive and the type can be any value, including one of the canonical types. However, a canonical type should be used whenever appropriate.
Type LinkType `json:"type" validate:"required"`
// Value is the link value. It can be a URI, email or any string that acts as a unique identifier (i.e., social media handle).
Value string `json:"value" validate:"required|uri|email"`
}
Link is an 'address', usually of a person. For example, an email, website or social media handle. An address has a type and a value and/or URI associated with it.
type LinkType ¶
type LinkType string
LinkType is the type of address. While there are some canonical values for the type, they are not conclusive and the type can be any value, including one of the canonical types. However, a canonical type should be used whenever appropriate.
type Person ¶
type Person struct {
// Bio is an optional short biography of the person.
Bio *string `json:"bio,omitempty"`
// Links are links associated with the person that provide more details about them.
Links []Link `json:"links,omitempty" validate:"omitempty,dive,unique"`
// Name is the person's name.
Name string `json:"name" validate:"required"`
}
Person represents a person.
type SourceType ¶
type SourceType string
SourceType is the type of source the feed or object came from. This can be used with abstractions that generalize different feed types into a common format to preserve information on the original.
const ( SourceTypeAtom SourceType = "Atom" SourceTypeHTML SourceType = "HTML" SourceTypeJSONFeed SourceType = "JSONFeed" SourceTypeRDF SourceType = "RDF" SourceTypeRSS SourceType = "RSS" SourceTypeUnknown SourceType = "Unknown" )
Defines values for SourceType.
func DetectSourceType ¶
func DetectSourceType(r io.Reader) (SourceType, error)
DetectSourceType determines the feed source by extracting key signatures from the data. It can detect supported feed formats as well as HTML.
func (SourceType) Valid ¶
func (e SourceType) Valid() bool
Valid indicates whether the value is a known member of the SourceType enum.
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. |
|
dc
Package dc provides primitives to interact with the openapi HTTP API.
|
Package dc 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. |
|
media
Package media provides primitives to interact with the openapi HTTP API.
|
Package media provides primitives to interact with the openapi HTTP API. |
|
rss
Package rss provides primitives to interact with the openapi HTTP API.
|
Package rss 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. |
|
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. |