aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/miniflux/miniflux-go/client.go
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2017-11-25 16:53:51 -0800
committerGravatar Frédéric Guillot <fred@miniflux.net>2017-11-25 16:53:51 -0800
commit39b03cc393da657b11dbf25e51e2495f8739e491 (patch)
tree0231ec313a78453a8fccbac73919f25cd9cf598a /vendor/github.com/miniflux/miniflux-go/client.go
parentf072439b79ff6a003810a337664961865fefa755 (diff)
Add integration tests for feed creation
Diffstat (limited to 'vendor/github.com/miniflux/miniflux-go/client.go')
-rw-r--r--vendor/github.com/miniflux/miniflux-go/client.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/vendor/github.com/miniflux/miniflux-go/client.go b/vendor/github.com/miniflux/miniflux-go/client.go
index 4cf40e0..6a5f678 100644
--- a/vendor/github.com/miniflux/miniflux-go/client.go
+++ b/vendor/github.com/miniflux/miniflux-go/client.go
@@ -214,23 +214,27 @@ func (c *Client) Feed(feedID int64) (*Feed, error) {
}
// CreateFeed creates a new feed.
-func (c *Client) CreateFeed(url string, categoryID int64) (*Feed, error) {
+func (c *Client) CreateFeed(url string, categoryID int64) (int64, error) {
body, err := c.request.Post("/v1/feeds", map[string]interface{}{
"feed_url": url,
"category_id": categoryID,
})
if err != nil {
- return nil, err
+ return 0, err
}
defer body.Close()
- var feed *Feed
+ type result struct {
+ FeedID int64 `json:"feed_id"`
+ }
+
+ var r result
decoder := json.NewDecoder(body)
- if err := decoder.Decode(&feed); err != nil {
- return nil, fmt.Errorf("miniflux: response error (%v)", err)
+ if err := decoder.Decode(&r); err != nil {
+ return 0, fmt.Errorf("miniflux: response error (%v)", err)
}
- return feed, nil
+ return r.FeedID, nil
}
// UpdateFeed updates a feed.