feed

package
v0.0.0-...-7af979f Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EpisodeHandler

func EpisodeHandler() http.HandlerFunc

EpisodeHandler is a http.HandlerFunc serving FeedEpisodes.

func Handler

func Handler(feedRepository Repository) http.HandlerFunc

Handler is a http.HandlerFunc serving a Feed with a given ID.

func ImageHandler

func ImageHandler() http.HandlerFunc

ImageHandler is a http.HandlerFunc serving FeedImages.

Types

type Episode

type Episode struct {
	Title       string `json:"title" xml:"title"`
	Description string `json:"description" xml:"description" datastore:",noindex"`
	Author      string `json:"author" xml:"author"`
	GUID        string `json:"guid" xml:"guid"`
	PubDate     string `json:"pubDate" xml:"pubDate"`
}

Episode represents a Podcast Episode.

type Feed

type Feed struct {
	ID          int64     `json:"id" datastore:"-"`
	Title       string    `json:"title" xml:"title"`
	Link        string    `json:"link" xml:"link"`
	Description string    `json:"description" xml:"description" datastore:",noindex"`
	Language    string    `json:"language" xml:"language"`
	Copyright   string    `json:"copyright" xml:"copyright"`
	PubDate     string    `json:"pubDate" xml:"pubDate"`
	Image       Image     `json:"image" xml:"image"`
	Episodes    []Episode `json:"episodes" xml:"item"`
}

Feed represents a Podcast Feed.

type Image

type Image struct {
	//Id 	int64	`datastore:"-"`
	FeeURL string `json:"url" xml:"url"`
	Title  string `json:"title" xml:"title"`
	Link   string `json:"link" xml:"link"`
}

Image is attached to Feed.

type Repository

type Repository interface {
	Save(ctx context.Context, feed *Feed) (*Feed, error)
	Get(ctx context.Context, id int64) (*Feed, error)
	GetAll(ctx context.Context) ([]Feed, error)
}

Repository is responsible for CRUD operations on Feeds.

func NewFeedRepo

func NewFeedRepo() Repository

NewFeedRepo creates a new FeedRepository

type Task

type Task struct {
	FeedRepository Repository
	HTTPClient     middleware.HTTPClientFacade
}

Task fetches and stores Podcast Feeds

func NewFeedTask

func NewFeedTask(feedRepo Repository, httpClient middleware.HTTPClientFacade) *Task

NewFeedTask creates a new FeedTask

func (*Task) FetchAndStore

func (task *Task) FetchAndStore(ctx context.Context, feedURL string, collectionID int64)

FetchAndStore fetches the Feed assigned to given Podcast and persists it.

func (*Task) FetchData

func (task *Task) FetchData(ctx context.Context, url string) ([]byte, error)

FetchData fetches data from the given url.

type TaskFacade

type TaskFacade interface {
	FetchAndStore(ctx context.Context, feedURL string, collectionID int64)
}

TaskFacade combines fetching and storing of Podcasts

Jump to

Keyboard shortcuts

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