mirror of
https://github.com/miniflux/v2.git
synced 2025-06-27 16:36:00 +00:00
feat(api): add endpoint for user integration status
This commit is contained in:
parent
7fdb450446
commit
0adbcc3a04
5 changed files with 70 additions and 1 deletions
|
@ -185,6 +185,25 @@ func (c *Client) MarkAllAsRead(userID int64) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// FetchIntegrationsStatus fetches the integrations status for a user.
|
||||
func (c *Client) FetchIntegrationsStatus() (bool, error) {
|
||||
body, err := c.request.Get("/v1/users/integrations/status")
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
defer body.Close()
|
||||
|
||||
var response struct {
|
||||
HasIntegrations bool `json:"has_integrations"`
|
||||
}
|
||||
|
||||
if err := json.NewDecoder(body).Decode(&response); err != nil {
|
||||
return false, fmt.Errorf("miniflux: response error (%v)", err)
|
||||
}
|
||||
|
||||
return response.HasIntegrations, nil
|
||||
}
|
||||
|
||||
// Discover try to find subscriptions from a website.
|
||||
func (c *Client) Discover(url string) (Subscriptions, error) {
|
||||
body, err := c.request.Post("/v1/discover", map[string]string{"url": url})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue