feed

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExtensionHeaderTitle       = "Widget-Title"
	ExtensionHeaderContentType = "Widget-Content-Type"
)

Variables

View Source
var (
	ErrNoContent      = errors.New("failed to retrieve any content")
	ErrPartialContent = errors.New("failed to retrieve some of the content")
)
View Source
var ExtensionStringToType = map[string]ExtensionType{
	"html": ExtensionContentHTML,
}

Functions

func FetchWatchUUIDsFromChangeDetection added in v0.5.0

func FetchWatchUUIDsFromChangeDetection(instanceURL string, token string) ([]string, error)

func SvgPolylineCoordsFromYValues

func SvgPolylineCoordsFromYValues(width float64, height float64, values []float64) string

Types

type AppRelease

type AppRelease struct {
	Name         string
	Version      string
	NotesUrl     string
	TimeReleased time.Time
	Downvotes    int
}

type AppReleases

type AppReleases []AppRelease

func FetchLatestReleasesFromGithub

func FetchLatestReleasesFromGithub(repositories []string, token string) (AppReleases, error)

func (AppReleases) SortByNewest

func (r AppReleases) SortByNewest() AppReleases

type Calendar

type Calendar struct {
	CurrentDay        int
	CurrentWeekNumber int
	CurrentMonthName  string
	CurrentYear       int
	Days              []int
}

func NewCalendar

func NewCalendar(now time.Time) *Calendar

TODO: very inflexible, refactor to allow more customizability TODO: allow changing first day of week TODO: allow changing between showing the previous and next week and the entire month

type ChangeDetectionWatch added in v0.5.0

type ChangeDetectionWatch struct {
	Title        string
	URL          string
	LastChanged  time.Time
	DiffURL      string
	PreviousHash string
}

type ChangeDetectionWatches added in v0.5.0

type ChangeDetectionWatches []ChangeDetectionWatch

func FetchWatchesFromChangeDetection added in v0.5.0

func FetchWatchesFromChangeDetection(instanceURL string, requestedWatchIDs []string, token string) (ChangeDetectionWatches, error)

func (ChangeDetectionWatches) SortByNewest added in v0.5.0

type Extension added in v0.5.0

type Extension struct {
	Title   string
	Content template.HTML
}

func FetchExtension added in v0.5.0

func FetchExtension(options ExtensionRequestOptions) (Extension, error)

type ExtensionRequestOptions added in v0.5.0

type ExtensionRequestOptions struct {
	URL        string            `yaml:"url"`
	Parameters map[string]string `yaml:"parameters"`
	AllowHtml  bool              `yaml:"allow-potentially-dangerous-html"`
}

type ExtensionType added in v0.5.0

type ExtensionType int
const (
	ExtensionContentHTML    ExtensionType = iota
	ExtensionContentUnknown               = iota
)

type ForumPost

type ForumPost struct {
	Title           string
	DiscussionUrl   string
	TargetUrl       string
	TargetUrlDomain string
	ThumbnailUrl    string
	CommentCount    int
	Score           int
	Engagement      float64
	TimePosted      time.Time
	Tags            []string
}

func (*ForumPost) HasTargetUrl

func (s *ForumPost) HasTargetUrl() bool

type ForumPosts

type ForumPosts []ForumPost

func FetchHackerNewsPosts added in v0.4.0

func FetchHackerNewsPosts(sort string, limit int, commentsUrlTemplate string) (ForumPosts, error)

func FetchLobstersPosts added in v0.5.0

func FetchLobstersPosts(sortBy string, tags []string) (ForumPosts, error)

func FetchSubredditPosts

func FetchSubredditPosts(subreddit, sort, topPeriod, search, commentsUrlTemplate, requestUrlTemplate string) (ForumPosts, error)

func (ForumPosts) CalculateEngagement

func (p ForumPosts) CalculateEngagement()

func (ForumPosts) FilterPostedBefore

func (p ForumPosts) FilterPostedBefore(postedBefore time.Duration) []ForumPost

func (ForumPosts) SortByEngagement

func (p ForumPosts) SortByEngagement()

type GithubTicket added in v0.4.0

type GithubTicket struct {
	Number    int
	CreatedAt time.Time
	Title     string
}

type Market added in v0.5.0

type Market struct {
	MarketRequest
	Currency       string  `yaml:"-"`
	Price          float64 `yaml:"-"`
	PercentChange  float64 `yaml:"-"`
	SvgChartPoints string  `yaml:"-"`
}

type MarketRequest added in v0.5.0

type MarketRequest struct {
	Name       string `yaml:"name"`
	Symbol     string `yaml:"symbol"`
	ChartLink  string `yaml:"chart-link"`
	SymbolLink string `yaml:"symbol-link"`
}

type Markets added in v0.5.0

type Markets []Market

func FetchMarketsDataFromYahoo added in v0.5.0

func FetchMarketsDataFromYahoo(marketRequests []MarketRequest) (Markets, error)

func (Markets) SortByAbsChange added in v0.5.0

func (t Markets) SortByAbsChange()

type PlaceJson

type PlaceJson struct {
	Name      string
	Area      string `json:"admin1"`
	Latitude  float64
	Longitude float64
	Timezone  string
	Country   string
	// contains filtered or unexported fields
}

func FetchPlaceFromName

func FetchPlaceFromName(location string) (*PlaceJson, error)

type PlacesResponseJson

type PlacesResponseJson struct {
	Results []PlaceJson
}

type RSSFeedItem

type RSSFeedItem struct {
	ChannelName string
	ChannelURL  string
	Title       string
	Link        string
	ImageURL    string
	Categories  []string
	Description string
	PublishedAt time.Time
}

type RSSFeedItems

type RSSFeedItems []RSSFeedItem

func GetItemsFromRSSFeeds

func GetItemsFromRSSFeeds(requests []RSSFeedRequest) (RSSFeedItems, error)

func (RSSFeedItems) SortByNewest

func (f RSSFeedItems) SortByNewest() RSSFeedItems

type RSSFeedRequest

type RSSFeedRequest struct {
	Url             string `yaml:"url"`
	Title           string `yaml:"title"`
	HideCategories  bool   `yaml:"hide-categories"`
	HideDescription bool   `yaml:"hide-description"`
	ItemLinkPrefix  string `yaml:"item-link-prefix"`
}

type RepositoryDetails added in v0.4.0

type RepositoryDetails struct {
	Name             string
	Stars            int
	Forks            int
	OpenPullRequests int
	PullRequests     []GithubTicket
	OpenIssues       int
	Issues           []GithubTicket
}

func FetchRepositoryDetailsFromGithub added in v0.4.0

func FetchRepositoryDetailsFromGithub(repository string, token string, maxPRs int, maxIssues int) (RepositoryDetails, error)

type RequestDoer

type RequestDoer interface {
	Do(*http.Request) (*http.Response, error)
}

type SiteStatus

type SiteStatus struct {
	Code         int
	TimedOut     bool
	ResponseTime time.Duration
	Error        error
}

func FetchStatusForSites added in v0.5.0

func FetchStatusForSites(requests []*SiteStatusRequest) ([]SiteStatus, error)

type SiteStatusRequest added in v0.5.0

type SiteStatusRequest struct {
	URL           string `yaml:"url"`
	AllowInsecure bool   `yaml:"allow-insecure"`
}

type TwitchCategory

type TwitchCategory struct {
	Slug         string `json:"slug"`
	Name         string `json:"name"`
	AvatarUrl    string `json:"avatarURL"`
	ViewersCount int    `json:"viewersCount"`
	Tags         []struct {
		Name string `json:"tagName"`
	} `json:"tags"`
	GameReleaseDate string `json:"originalReleaseDate"`
	IsNew           bool   `json:"-"`
}

func FetchTopGamesFromTwitch

func FetchTopGamesFromTwitch(exclude []string, limit int) ([]TwitchCategory, error)

type TwitchChannel

type TwitchChannel struct {
	Login        string
	Exists       bool
	Name         string
	AvatarUrl    string
	IsLive       bool
	LiveSince    time.Time
	Category     string
	CategorySlug string
	ViewersCount int
}

type TwitchChannels

type TwitchChannels []TwitchChannel

func FetchChannelsFromTwitch

func FetchChannelsFromTwitch(channelLogins []string) (TwitchChannels, error)

func (TwitchChannels) SortByLive added in v0.5.0

func (channels TwitchChannels) SortByLive()

func (TwitchChannels) SortByViewers

func (channels TwitchChannels) SortByViewers()

type Video

type Video struct {
	ThumbnailUrl string
	Title        string
	Url          string
	Author       string
	AuthorUrl    string
	TimePosted   time.Time
}

type Videos

type Videos []Video

func FetchYoutubeChannelUploads

func FetchYoutubeChannelUploads(channelIds []string, videoUrlTemplate string) (Videos, error)

func (Videos) SortByNewest

func (v Videos) SortByNewest() Videos

type Weather

type Weather struct {
	Temperature         int
	ApparentTemperature int
	WeatherCode         int
	CurrentColumn       int
	SunriseColumn       int
	SunsetColumn        int
	Columns             []weatherColumn
}

func FetchWeatherForPlace

func FetchWeatherForPlace(place *PlaceJson, units string) (*Weather, error)

TODO: bunch of spaget, refactor

func (*Weather) WeatherCodeAsString

func (w *Weather) WeatherCodeAsString() string

type WeatherResponseJson

type WeatherResponseJson struct {
	Daily struct {
		Sunrise []int64 `json:"sunrise"`
		Sunset  []int64 `json:"sunset"`
	} `json:"daily"`

	Hourly struct {
		Temperature              []float64 `json:"temperature_2m"`
		PrecipitationProbability []int     `json:"precipitation_probability"`
	} `json:"hourly"`

	Current struct {
		Temperature         float64 `json:"temperature_2m"`
		ApparentTemperature float64 `json:"apparent_temperature"`
		WeatherCode         int     `json:"weather_code"`
	} `json:"current"`
}

Jump to

Keyboard shortcuts

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