Documentation
¶
Overview ¶
Package types provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.0 DO NOT EDIT.
Package types provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.0 DO NOT EDIT.
Package types provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.0 DO NOT EDIT.
Package types contains methods and objects that are shared across different Feed schemas/specifications.
Index ¶
- Constants
- Variables
- func IsImage(mimetype string) bool
- func NewXMLAttr(name, value, namespace string) xml.Attr
- type AttrBitrate
- type AttrChannels
- type AttrDuration
- type AttrFileSize
- type AttrFramerate
- type AttrHeight
- type AttrHref
- type AttrLang
- type AttrMimeType
- type AttrSamplingrate
- type AttrURL
- type AttrWidth
- type Attributes
- type CharData
- type CustomTypeBase
- type DateTime
- type Extension
- type Extensions
- type FeedSource
- type HasAttribution
- type HasContent
- type HasID
- type HasLocalization
- type HasMedia
- type HasTaxonomy
- type ImageInfo
- type ItemSource
- type Language
- type MediaEditable
- type NameSpace
- type ObjectCommon
- type ObjectMetadata
- type OptionalValue
- type RequiredValue
- type Source
- type SourceEditable
- type StringData
- type URL
- type XMLName
Constants ¶
const (
// MimeTypeOPML indicates the canonical mimetype for an OPML file.
MimeTypeOPML = "text/x-opml+xml"
)
Variables ¶
var ( // MimeTypesRSS contains canonical/standard mimetypes for RSS feeds. MimeTypesRSS = []string{"application/rss+xml", "application/rdf+xml"} // MimeTypesAtom contains canonical/standard mimetypes for Atom feeds. MimeTypesAtom = []string{"application/atom+xml"} // 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"} // MimeTypesJSONFeed contains canonical/standard mimetypes for JSONFeed feeds. MimeTypesJSONFeed = []string{"application/feed+json", "application/json"} // MimeTypesFeed is the concatenation of all feed mime types. MimeTypesFeed = slices.Concat(MimeTypesAtom, MimeTypesRSS, MimeTypesIndeterminate, MimeTypesJSONFeed) // 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 DateTimeFormats = []string{ time.RFC1123Z, time.RFC1123, "Mon, 2 Jan 2006 15:04:05 -0700", "Mon, 2 Jan 2006 15:04:05 MST", "Mon, 02 Jan 2006 15:04 -0700", "Mon, 02 Jan 2006 15:04 MST", "Mon, 2 Jan 2006 15:04 -0700", "Mon, 2 Jan 2006 15:04 MST", time.RFC3339, "2006-01-02T15:04:05.00Z07:00", time.DateTime, time.DateOnly, time.DateOnly + "T" + "15:04-07:00", "2006-01", "2006", }
DateTimeFormats are the valid datetime formats across different feed specifications. A DateTime object will try to parse a given value as one of these formats.
var ErrInvalidDateTimeFormat = errors.New("invalid datetime format")
ErrInvalidDateTimeFormat indicates that the value of the datetime is not one of the defined DateTimeFormats. In most cases, this indicates the feed not using a valid datetime format according to its specification.
var UnixEpoch = time.Unix(0, 0)
UnixEpoch is the time.Time value of Unix epoch.
Functions ¶
func IsImage ¶
IsImage will return a boolean indicating whether the given mimetype represents an image.
func NewXMLAttr ¶
NewXMLAttr is a convienience function to create an xml.Attr from a name/value/namespace combination. The namespace value is optional, but the name and value should be provided.
Types ¶
type AttrChannels ¶
type AttrChannels = int
AttrChannels is number of audio channels in the media object.
type AttrDuration ¶
type AttrDuration = int
AttrDuration is the number of seconds the media object plays.
type AttrFileSize ¶
type AttrFileSize = int
AttrFileSize is the number of bytes of the media object.
type AttrFramerate ¶
type AttrFramerate = int
AttrFramerate is the number of frames per second for the media object.
type AttrLang ¶
type AttrLang = string
AttrLang is the primary language encapsulated in the element. Language codes possible are detailed in RFC 3066. This attribute is used similar to the xml:lang attribute detailed in the XML 1.0 Specification (Third Edition).
type AttrMimeType ¶
type AttrMimeType = string
AttrMimeType is the standard MIME type of the object.
type AttrSamplingrate ¶
type AttrSamplingrate = int
AttrSamplingrate is the number of samples per second taken to create the media object. It is expressed in thousands of samples per second (kHz)
type AttrWidth ¶
type AttrWidth = int
AttrWidth is the width of the media object. It is an optional attribute.
type CharData ¶
CharData represents character data of an element.
func (*CharData) UnmarshalJSON ¶
func (*CharData) UnmarshalText ¶
type CustomTypeBase ¶
type CustomTypeBase struct { // Attributes are any attributes of the element. Attributes Attributes `json:"attributes" xml:",any,attr"` // Value is an element value that is required. Value RequiredValue `json:"value" validate:"required" xml:",chardata"` }
CustomTypeBase defines model for CustomTypeBase.
func (*CustomTypeBase) String ¶
func (c *CustomTypeBase) String() string
String will return the value of the object.
type DateTime ¶
DateTime is a datetime value for a feed (or item) object, such as its published/updated date.
func (*DateTime) MarshalJSON ¶
MarshalJSON handles marshaling a DateTime to JSON.
func (*DateTime) UnmarshalJSON ¶
UnmarshalJSON handles unmarshaling a DateTime from JSON.
func (*DateTime) UnmarshalText ¶
UnmarshalText will unmarshal/parse a DateTime from the given string.
type Extension ¶
type Extension struct { // XMLName represents the XML namespace of an element. XMLName XMLName `json:"xml" validate:"required"` // Attributes are any attributes of the element. Attributes Attributes `json:"attributes" xml:",any,attr"` Extensions []Extension `json:"extensions,omitempty" xml:",any"` // Value is an element value that is optional. Value *OptionalValue `json:"value,omitempty" xml:",chardata"` }
Extension represents an element that is not defined in the schema.
type Extensions ¶
type Extensions = []Extension
Extensions records any elements that are unknown extensions to the schema.
type FeedSource ¶
type FeedSource interface { ObjectCommon Source SourceEditable MediaEditable GetItems() []ItemSource }
FeedSource is an abstraction representing any type of Feed.
type HasAttribution ¶
type HasAttribution interface { GetAuthors() []string GetContributors() []string GetRights() string }
HasAttribution contains methods for retrieving values that relate to the copyright, rights, authors and contributors of an Object.
type HasContent ¶
type HasContent interface {
GetContent() string
}
HasContent contains methods for retrieving any embedded content of the Object.
type HasID ¶
type HasID interface {
GetID() string
}
HasID contains methods for retrieving an Objects unique ID.
type HasLocalization ¶
type HasLocalization interface {
GetLanguage() string
}
HasLocalization contains methods for retrieving localization information of an Object.
type HasMedia ¶
type HasMedia interface {
GetImage() *ImageInfo
}
HasMedia contains methods for retrieving an Object's media, such as audio and video.
type HasTaxonomy ¶
type HasTaxonomy interface {
GetCategories() []string
}
HasTaxonomy contains methods for retrieving categorization and taxonomy values of an Object.
type ImageInfo ¶
type ImageInfo struct { // Title the description of the image Title *string `json:"title,omitempty"` // URL is the URL to the image. URL string `json:"url" validate:"required,url" xml:",chardata"` }
ImageInfo is an abstraction of an Image across different types of specifications.
type ItemSource ¶
type ItemSource interface { ObjectCommon HasID HasContent }
ItemSource is an abstraction representing an individual Item from any type of Feed source.
type Language ¶
type Language = string
Language is the primary language encapsulated in the element. Language codes possible are detailed in RFC 3066.
type MediaEditable ¶
type MediaEditable interface {
SetImage(image *ImageInfo)
}
MediaEditable indicates that the media of the object can be changed.
type NameSpace ¶
type NameSpace string
NameSpace maps namespace URL identifiers to a easy-to-use string type.
const ( NameSpaceAtom NameSpace = "http://www.w3.org/2005/Atom" NameSpaceContent NameSpace = "http://purl.org/rss/1.0/modules/content/" NameSpaceDublinCore NameSpace = "http://purl.org/dc/elements/1.1/" NameSpaceMediaRSS NameSpace = "http://search.yahoo.com/mrss/" NameSpaceSyndication NameSpace = "http://purl.org/rss/1.0/modules/syndication/" )
Defines values for NameSpace.
type ObjectCommon ¶
type ObjectCommon interface { ObjectMetadata HasAttribution HasLocalization HasTaxonomy HasMedia }
ObjectCommon contains all methods common across all objects.
type ObjectMetadata ¶
type ObjectMetadata interface { GetTitle() string GetDescription() string GetLink() string GetPublishedDate() time.Time GetUpdatedDate() time.Time }
ObjectMetadata contains methods for retrieving the metadata information about the Object.
type OptionalValue ¶
type OptionalValue = string
OptionalValue is an element value that is optional.
type RequiredValue ¶
type RequiredValue = string
RequiredValue is an element value that is required.
type Source ¶
type Source interface {
GetSourceURL() string
}
Source contains methods for retrieving or setting the source of the Object.
type SourceEditable ¶
type SourceEditable interface {
SetSourceURL(url string)
}
SourceEditable indicates the source URL for the object can be changed.
type StringData ¶
type StringData string
func (*StringData) String ¶
func (s *StringData) String() string
func (*StringData) UnmarshalText ¶
func (s *StringData) UnmarshalText(data []byte) error