common

package
v0.0.0-...-44d4e1f Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2022 License: MIT, CC0-1.0 Imports: 5 Imported by: 0

Documentation

Overview

Package common contains structs for a unified feed format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	Name  string
	URI   string
	Email string
}

type Category

type Category struct {
	Domain string
	Text   string
}

type Channel

type Channel struct {
	Categories     []Category
	Cloud          Cloud
	Copyright      string
	Description    string
	Docs           string
	Extensions     map[string]map[string][]Extension
	Generator      Generator
	Image          Image
	Items          []*Item
	Language       string
	LastBuildDate  string
	Links          []Link
	ManagingEditor string
	PubDate        string
	Rating         string
	SkipDays       []int
	SkipHours      []int
	TTL            int
	TextInput      Input
	Title          string
	WebMaster      string

	// Atom fields
	Author   Author
	ID       string
	Rights   string
	SubTitle SubTitle
}

func (*Channel) Key

func (c *Channel) Key() string

type Cloud

type Cloud struct {
	Domain            string
	Port              int
	Path              string
	RegisterProcedure string
	Protocol          string
}

type Content

type Content struct {
	Type string
	Lang string
	Base string
	Text string
}

type Enclosure

type Enclosure struct {
	URL    string
	Length int64
	Type   string
}

type Extension

type Extension struct {
	Name      string
	Value     string
	Attrs     map[string]string
	Childrens map[string][]Extension
}

type GUID

type GUID struct {
	GUID        string
	IsPermaLink bool
}

type Generator

type Generator struct {
	URI     string
	Version string
	Text    string
}

type Image

type Image struct {
	Title       string
	URL         string
	Link        string
	Width       int
	Height      int
	Description string
}

type Input

type Input struct {
	Title       string
	Description string
	Name        string
	Link        string
}

type Item

type Item struct {
	// RSS and Shared fields
	Author      Author
	Categories  []Category
	Comments    string
	Description string
	Enclosures  []Enclosure
	Thumbnail   *Image
	Extensions  map[string]map[string][]Extension
	GUID        *GUID
	Links       []Link
	PubDate     string
	Source      *Source
	Title       string

	// Atom specific fields
	Content      *Content
	Contributors []string
	Generator    *Generator
	ID           string
}

func (*Item) Key

func (i *Item) Key() string

func (*Item) ParsedPubDate

func (i *Item) ParsedPubDate() (time.Time, error)
type Link struct {
	Href     string
	Rel      string
	Type     string
	HrefLang string
}

type Parser

type Parser interface {
	CanRead(io.Reader, func(charset string, input io.Reader) (io.Reader, error)) bool
	Read(io.Reader, *url.URL, func(charset string, input io.Reader) (io.Reader, error)) ([]*Channel, error)
}

type Source

type Source struct {
	URL  string
	Text string
}

type SubTitle

type SubTitle struct {
	Type string
	Text string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL