jsonfeed

package module
v0.0.0-...-a3cbcbb Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MPL-2.0 Imports: 4 Imported by: 0

README

go-jsonfeed

Go implementation of https://jsonfeed.org/.

License

MPL 2.0.

Documentation

Index

Constants

View Source
const (
	Version1  = "https://jsonfeed.org/version/1"
	Version11 = "https://jsonfeed.org/version/1.1"

	VersionLatest = Version11
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	URL               string  `json:"url"`
	MimeType          string  `json:"mime_type"`
	Title             string  `json:"title,omitempty"`
	SizeInBytes       uint64  `json:"size_in_bytes,omitempty"`
	DurationInSeconds float64 `json:"duration_in_seconds,omitempty"`
}

func (*Attachment) IsValid

func (fia *Attachment) IsValid() bool

type Author

type Author struct {
	Name      string `json:"name,omitempty"`
	URL       string `json:"url,omitempty"`
	AvatarURL string `json:"avatar,omitempty"`
}

func (*Author) IsValid

func (a *Author) IsValid() bool

type Feed

type Feed struct {
	Version     string   `json:"version"`
	Title       string   `json:"title"`
	Description string   `json:"description,omitempty"`
	IconURL     string   `json:"icon,omitempty"`
	FaviconURL  string   `json:"favicon,omitempty"`
	HomePageURL string   `json:"home_page_url,omitempty"`
	FeedURL     string   `json:"feed_url,omitempty"`
	UserComment string   `json:"user_comment,omitempty"`
	NextURL     string   `json:"next_url,omitempty"`
	Authors     []Author `json:"authors,omitempty"`
	Language    string   `json:"language,omitempty"`
	RawExpired  *bool    `json:"expired,omitempty"`
	Items       []Item   `json:"items"`

	// Author has been deprecated in favor of Authors. It's included here only
	// for compatibility.
	Author *Author `json:"author,omitempty"`
}

func Parse

func Parse(r io.Reader) (*Feed, error)

func (*Feed) IsExpired

func (f *Feed) IsExpired() bool

type Item

type Item struct {
	ID               string       `json:"id"`
	URL              string       `json:"url,omitempty"`
	ExternalURL      string       `json:"external_url,omitempty"`
	Title            string       `json:"title,omitempty"`
	ContentText      string       `json:"content_text,omitempty"`
	ContentHTML      string       `json:"content_html,omitempty"`
	Summary          string       `json:"summary,omitempty"`
	ImageURL         string       `json:"image,omitempty"`
	BannerImageURL   string       `json:"banner_image,omitempty"`
	RawDatePublished string       `json:"date_published,omitempty"`
	RawDateModified  string       `json:"date_modified,omitempty"`
	Authors          []Author     `json:"authors,omitempty"`
	Tags             []string     `json:"tags,omitempty"`
	Language         string       `json:"language,omitempty"`
	Attachments      []Attachment `json:"attachments,omitempty"`
}

func (*Item) IsValid

func (fi *Item) IsValid() bool

func (*Item) ModifiedAt

func (fi *Item) ModifiedAt() (time.Time, error)

func (*Item) PublishedAt

func (fi *Item) PublishedAt() (time.Time, error)

func (*Item) SetModifiedAt

func (fi *Item) SetModifiedAt(t time.Time)

func (*Item) SetPublishedAt

func (fi *Item) SetPublishedAt(t time.Time)

Jump to

Keyboard shortcuts

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