diff options
author | 2024-10-18 11:59:05 +0800 | |
---|---|---|
committer | 2024-10-17 20:59:05 -0700 | |
commit | 0adbcc3a04aafc203d8303048e4ab82918463b2b (patch) | |
tree | 14426bd998be18cef047e7abf4bf8b10bf04bb7c /client/client.go | |
parent | 7fdb450446aded0f95f490a0fee275e3dfdf507b (diff) | |
download | v2-0adbcc3a04aafc203d8303048e4ab82918463b2b.tar.gz v2-0adbcc3a04aafc203d8303048e4ab82918463b2b.tar.zst v2-0adbcc3a04aafc203d8303048e4ab82918463b2b.zip |
feat(api): add endpoint for user integration status
Diffstat (limited to 'client/client.go')
-rw-r--r-- | client/client.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/client/client.go b/client/client.go index 11659164..a463b2d7 100644 --- a/client/client.go +++ b/client/client.go @@ -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}) |