1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-06-27 16:36:00 +00:00

Add new API endpoint /icons/{iconID}

This commit is contained in:
Frédéric Guillot 2023-10-05 22:23:29 -07:00
parent 5774323f2e
commit 2002d60fbe
6 changed files with 62 additions and 10 deletions

View file

@ -496,7 +496,7 @@ func (c *Client) SaveEntry(entryID int64) error {
return err
}
// FetchCounters
// FetchCounters fetches feed counters.
func (c *Client) FetchCounters() (*FeedCounters, error) {
body, err := c.request.Get("/v1/feeds/counters")
if err != nil {
@ -518,6 +518,22 @@ func (c *Client) FlushHistory() error {
return err
}
// Icon fetches a feed icon.
func (c *Client) Icon(iconID int64) (*FeedIcon, error) {
body, err := c.request.Get(fmt.Sprintf("/v1/icons/%d", iconID))
if err != nil {
return nil, err
}
defer body.Close()
var feedIcon *FeedIcon
if err := json.NewDecoder(body).Decode(&feedIcon); err != nil {
return nil, fmt.Errorf("miniflux: response error (%v)", err)
}
return feedIcon, nil
}
func buildFilterQueryString(path string, filter *Filter) string {
if filter != nil {
values := url.Values{}