Documentation ¶
Index ¶
- func Prettify(v any) string
- func StandardizeJSON(b []byte) ([]byte, error)
- type CachedItem
- type Client
- func (c *Client) DeleteOldCachedItems()
- func (c *Client) FetchFeeds(ignoreAlreadyCached bool) (feeds []gf.RssFeed, err error)
- func (c *Client) ListCachedItems(includeItemsMarkedAsRead bool) []CachedItem
- func (c *Client) MarkCachedItemsAsRead(items []CachedItem)
- func (c *Client) PublishXML(title, link, description, author, email string, items []CachedItem) (bytes []byte, err error)
- func (c *Client) SetDesiredLanguage(lang string)
- func (c *Client) SetGoogleAIModel(model string)
- func (c *Client) SetSummarizeIntervalSeconds(seconds int)
- func (c *Client) SetVerbose(v bool)
- func (c *Client) SummarizeAndCacheFeeds(feeds []gf.RssFeed, urlScrapper ...*ssg.Scrapper) (err error)
- type FeedsItemsCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StandardizeJSON ¶
StandardizeJSON standardizes given JSON (JWCC) bytes.
Types ¶
type CachedItem ¶
type CachedItem struct { gorm.Model Title string Link string // url to the original article Comments string // url to the community comments GUID string `gorm:"uniqueIndex"` Author string PublishDate string Description string Summary string MarkedAsRead bool `gorm:"index"` }
CachedItem is a struct for a cached item
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client struct
func NewClientWithDB ¶
func NewClientWithDB(googleAIAPIKey string, feedsURLs []string, dbFilepath string) (client *Client, err error)
NewClientWithDB returns a new client with SQLite DB cache.
func (*Client) DeleteOldCachedItems ¶
func (c *Client) DeleteOldCachedItems()
DeleteOldCachedItems deletes old cached items.
func (*Client) FetchFeeds ¶
FetchFeeds fetches feeds.
func (*Client) ListCachedItems ¶
func (c *Client) ListCachedItems(includeItemsMarkedAsRead bool) []CachedItem
ListCachedItems lists cached items.
func (*Client) MarkCachedItemsAsRead ¶
func (c *Client) MarkCachedItemsAsRead(items []CachedItem)
MarkCachedItemsAsRead marks given cached items as read.
func (*Client) PublishXML ¶
func (c *Client) PublishXML(title, link, description, author, email string, items []CachedItem) (bytes []byte, err error)
PublishXML returns XML bytes of given cached items.
func (*Client) SetDesiredLanguage ¶
SetDesiredLanguage sets the client's desired language for summaries.
func (*Client) SetGoogleAIModel ¶
SetGoogleAIModel sets the client's Google AI model.
func (*Client) SetSummarizeIntervalSeconds ¶
SetSummarizeIntervalSeconds sets the client's summarize interval seconds.
func (*Client) SetVerbose ¶
SetVerbose sets the client's verbose mode.
type FeedsItemsCache ¶
type FeedsItemsCache interface { Exists(guid string) bool Save(item feeds.RssItem, summary string) Fetch(guid string) *CachedItem MarkAsRead(guid string) List(includeItemsMarkedAsRead bool) []CachedItem DeleteOlderThan1Month() SetVerbose(v bool) }
FeedsItemsCache is an interface of feeds items' cache