feed

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNullPointer     = errors.New("null reference instance")
	ErrInvalidFlickrId = errors.New("invalid Flickr user ID")
)

Functions

This section is empty.

Types

type Author

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

Author is author data in Metadata.

type Image

type Image struct {
	MimeType string     `json:"mime_type,omitempty"`
	Title    string     `json:"title,omitempty"`
	URL      string     `json:"url,omitempty"`
	FName    string     `json:"file_name,omitempty"`
	Taken    *time.Time `json:"taken,omitempty"`
}

Image is image data in Metadata.

func (*Image) FileName

func (i *Image) FileName() string

FileName returns file name from Image data.

type Item

type Item struct {
	Title       string     `json:"title,omitempty"`
	Description string     `json:"description,omitempty"`
	Link        string     `json:"link,omitempty"`
	Authors     []*Author  `json:"authors,omitempty"`
	Published   *time.Time `json:"published,omitempty"`
	Updated     *time.Time `json:"Updated,omitempty"`
	Images      []*Image   `json:"images,omitempty"`
}

Item is item data in Metadata.

type Metadata

type Metadata struct {
	FeedLink    string    `json:"feedLink,omitempty"`
	Title       string    `json:"title,omitempty"`
	Description string    `json:"description,omitempty"`
	Link        string    `json:"link,omitempty"`
	ID          string    `json:"id,omitempty"`
	Authors     []*Author `json:"authors,omitempty"`
	Items       []*Item   `json:"items,omitempty"`
}

Metadata is metadata for feed.

func DecodeFromJSON

func DecodeFromJSON(r io.Reader) (*Metadata, error)

DecodeFromJSON decodes from JSON string to Metadata.

func Feed

func Feed(ctx context.Context, u *url.URL) (*Metadata, error)

Feed fetches feed data from URL.

func FeedFlickr

func FeedFlickr(ctx context.Context, flickrId string) (*Metadata, error)

FeedFlickr fetches feed data from Flickr ID.

func (*Metadata) EncodeToJson

func (data *Metadata) EncodeToJson() (io.Reader, error)

EncodeToJson encodes from Metadata to JSON string.

Jump to

Keyboard shortcuts

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