feed

package
v0.0.0-...-a089732 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoContent      = errors.New("failed to retrieve any content")
	ErrPartialContent = errors.New("failed to retrieve some of the content")
)

Functions

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 ForumPost

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

func (*ForumPost) HasTargetUrl

func (s *ForumPost) HasTargetUrl() bool

type ForumPosts

type ForumPosts []ForumPost

func FetchHackerNewsPosts

func FetchHackerNewsPosts(sort string, limit int, commentsUrlTemplate 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

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

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
	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"`
}

type RepositoryDetails

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

func FetchRepositoryDetailsFromGithub

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 FetchStatusesForRequests

func FetchStatusesForRequests(requests []*http.Request) ([]SiteStatus, error)

type Stock

type Stock struct {
	Name           string  `yaml:"name"`
	Symbol         string  `yaml:"symbol"`
	ChartLink      string  `yaml:"chart-link"`
	SymbolLink     string  `yaml:"symbol-link"`
	Currency       string  `yaml:"-"`
	Price          float64 `yaml:"-"`
	PercentChange  float64 `yaml:"-"`
	SvgChartPoints string  `yaml:"-"`
}

type Stocks

type Stocks []Stock

func FetchStocksDataFromYahoo

func FetchStocksDataFromYahoo(stockRequests Stocks) (Stocks, error)

func (Stocks) SortByAbsChange

func (t Stocks) SortByAbsChange()

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) 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