feed

package
v0.0.0-...-8b1022e Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2016 License: Apache-2.0, Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FeedByName

func FeedByName(name string, retriever FeedRetriever)

FeedByName checks the previously created feed for an entry with the given source name

func GetFeed

func GetFeed(locale string, allStr string, shouldProxy bool, provider FeedProvider)

GetFeed creates an http.Client and fetches the latest Lantern public feed for displaying on the home screen.

func GetFeedURL

func GetFeedURL(defaultLocale string) string

GetFeedURL returns the URL to use for looking up the feed by looking up the users country before defaulting to the specified default locale if the country can't be determined.

func NumFeedEntries

func NumFeedEntries() int

NumFeedEntries just returns the total number of entries across all feeds

Types

type Feed

type Feed struct {
	Feeds   map[string]*Source   `json:"feeds"`
	Entries FeedItems            `json:"entries"`
	Items   map[string]FeedItems `json:"-"`
	Sorted  []string             `json:"sorted_feeds"`
}

Feed contains the data we get back from the public feed

func CurrentFeed

func CurrentFeed() *Feed

Returns the latest feed or nil if it doesn't exist

type FeedItem

type FeedItem struct {
	Title       string                 `json:"title"`
	Link        string                 `json:"link"`
	Image       string                 `json:"image"`
	Meta        map[string]interface{} `json:"meta,omitempty"`
	Content     string                 `json:"contentSnippetText"`
	Source      string                 `json:"source"`
	Description string                 `json:"-"`
}

type FeedItems

type FeedItems []*FeedItem

type FeedProvider

type FeedProvider interface {
	// AddSource: called for each new feed source
	AddSource(string)
}

type FeedRetriever

type FeedRetriever interface {
	// AddFeed: used to add a new entry to a given feed
	AddFeed(string, string, string, string)
}

type Source

type Source struct {
	FeedUrl        string `json:"feedUrl"`
	Title          string `json:"title"`
	Url            string `json:"link"`
	ExcludeFromAll bool   `json:"excludeFromAll"`
	Entries        []int  `json:"entries"`
}

Source represents a feed authority, a place where content is fetched from e.g. BBC, NYT, Reddit, etc.

Jump to

Keyboard shortcuts

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