Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

API: Fix GetCollection

Neeraj Guptae3c6f4c8a7bc
diff --git a/internal/api/collection.go b/internal/api/collection.go
index 5977249816..2b24145a60 100644
--- a/internal/api/collection.go
+++ b/internal/api/collection.go
@@ -3,11 +3,20 @@ package api
import "context"
func (c *Client) GetCollections(ctx context.Context, sinceTime int) ([]Collection, error) {
- var collections []Collection
- _, err := c.restClient.R().
+ var res struct {
+ Collections []Collection `json:"collections"`
+ }
+ r, err := c.restClient.R().
SetContext(ctx).
- SetQueryParam("since", string(sinceTime)).
- SetResult(&collections).
+ SetQueryParam("since", "0").
+ SetResult(&res).
Get("/collections")
- return collections, err
+ if r.IsError() {
+ return nil, &ApiError{
+ StatusCode: r.StatusCode(),
+ Message: r.String(),
+ }
+ }
+
+ return res.Collections, err
}