Documentation ¶
Index ¶
- Constants
- Variables
- func FetchWatchUUIDsFromChangeDetection(instanceURL string, token string) ([]string, error)
- func SvgPolylineCoordsFromYValues(width float64, height float64, values []float64) string
- type AppRelease
- type AppReleases
- type Calendar
- type ChangeDetectionWatch
- type ChangeDetectionWatches
- type Extension
- type ExtensionRequestOptions
- type ExtensionType
- type ForumPost
- type ForumPosts
- type GithubTicket
- type Market
- type MarketRequest
- type Markets
- type PlaceJson
- type PlacesResponseJson
- type RSSFeedItem
- type RSSFeedItems
- type RSSFeedRequest
- type RepositoryDetails
- type RequestDoer
- type SiteStatus
- type SiteStatusRequest
- type TwitchCategory
- type TwitchChannel
- type TwitchChannels
- type Video
- type Videos
- type Weather
- type WeatherResponseJson
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
Types ¶
type AppRelease ¶
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 ¶
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 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
func (r ChangeDetectionWatches) SortByNewest() ChangeDetectionWatches
type Extension ¶ added in v0.5.0
func FetchExtension ¶ added in v0.5.0
func FetchExtension(options ExtensionRequestOptions) (Extension, error)
type ExtensionRequestOptions ¶ added in v0.5.0
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 ¶
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 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 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 ¶
type PlacesResponseJson ¶
type PlacesResponseJson struct {
Results []PlaceJson
}
type RSSFeedItem ¶
type RSSFeedItems ¶
type RSSFeedItems []RSSFeedItem
func GetItemsFromRSSFeeds ¶
func GetItemsFromRSSFeeds(requests []RSSFeedRequest) (RSSFeedItems, error)
func (RSSFeedItems) SortByNewest ¶
func (f RSSFeedItems) SortByNewest() RSSFeedItems
type RSSFeedRequest ¶
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
type SiteStatus ¶
func FetchStatusForSites ¶ added in v0.5.0
func FetchStatusForSites(requests []*SiteStatusRequest) ([]SiteStatus, error)
type SiteStatusRequest ¶ added in v0.5.0
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 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 Weather ¶
type Weather struct { Temperature int ApparentTemperature int WeatherCode int CurrentColumn int SunriseColumn int SunsetColumn int Columns []weatherColumn }
func FetchWeatherForPlace ¶
TODO: bunch of spaget, refactor
func (*Weather) WeatherCodeAsString ¶
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"` }
Click to show internal directories.
Click to hide internal directories.