1
0
Fork 0
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:
AiraNadih 2024-10-18 11:59:05 +08:00 committed by GitHub
parent 7fdb450446
commit 0adbcc3a04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 70 additions and 1 deletions

View file

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