diff options
author | Frédéric Guillot <fred@miniflux.net> | 2018-06-23 16:16:54 -0700 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2018-06-23 16:16:54 -0700 |
commit | 7039df9af1de1aea72e90d4aa9fa6a37d21e1be0 (patch) | |
tree | 99df837fcec01a2972b2da91a34f9044cb016f72 /vendor | |
parent | cd77ebd7422b0988df9a5c017901a51507e79abd (diff) |
Improve feed and user API updates with optional values
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/github.com/miniflux/miniflux-go/client.go | 8 | ||||
-rw-r--r-- | vendor/github.com/miniflux/miniflux-go/miniflux.go | 29 |
2 files changed, 33 insertions, 4 deletions
diff --git a/vendor/github.com/miniflux/miniflux-go/client.go b/vendor/github.com/miniflux/miniflux-go/client.go index efc2a03..924fe49 100644 --- a/vendor/github.com/miniflux/miniflux-go/client.go +++ b/vendor/github.com/miniflux/miniflux-go/client.go @@ -104,8 +104,8 @@ func (c *Client) CreateUser(username, password string, isAdmin bool) (*User, err } // UpdateUser updates a user in the system. -func (c *Client) UpdateUser(user *User) (*User, error) { - body, err := c.request.Put(fmt.Sprintf("/v1/users/%d", user.ID), user) +func (c *Client) UpdateUser(userID int64, userChanges *UserModification) (*User, error) { + body, err := c.request.Put(fmt.Sprintf("/v1/users/%d", userID), userChanges) if err != nil { return nil, err } @@ -296,8 +296,8 @@ func (c *Client) CreateFeed(url string, categoryID int64) (int64, error) { } // UpdateFeed updates a feed. -func (c *Client) UpdateFeed(feed *Feed) (*Feed, error) { - body, err := c.request.Put(fmt.Sprintf("/v1/feeds/%d", feed.ID), feed) +func (c *Client) UpdateFeed(feedID int64, feedChanges *FeedModification) (*Feed, error) { + body, err := c.request.Put(fmt.Sprintf("/v1/feeds/%d", feedID), feedChanges) if err != nil { return nil, err } diff --git a/vendor/github.com/miniflux/miniflux-go/miniflux.go b/vendor/github.com/miniflux/miniflux-go/miniflux.go index 9d08a65..08e4d55 100644 --- a/vendor/github.com/miniflux/miniflux-go/miniflux.go +++ b/vendor/github.com/miniflux/miniflux-go/miniflux.go @@ -34,6 +34,17 @@ func (u User) String() string { return fmt.Sprintf("#%d - %s (admin=%v)", u.ID, u.Username, u.IsAdmin) } +// UserModification is used to update a user. +type UserModification struct { + Username *string `json:"username"` + Password *string `json:"password"` + IsAdmin *bool `json:"is_admin"` + Theme *string `json:"theme"` + Language *string `json:"language"` + Timezone *string `json:"timezone"` + EntryDirection *string `json:"entry_sorting_direction"` +} + // Users represents a list of users. type Users []User @@ -77,10 +88,28 @@ type Feed struct { LastModifiedHeader string `json:"last_modified_header,omitempty"` ParsingErrorMsg string `json:"parsing_error_message,omitempty"` ParsingErrorCount int `json:"parsing_error_count,omitempty"` + ScraperRules string `json:"scraper_rules"` + RewriteRules string `json:"rewrite_rules"` + Crawler bool `json:"crawler"` + Username string `json:"username"` + Password string `json:"password"` Category *Category `json:"category,omitempty"` Entries Entries `json:"entries,omitempty"` } +// FeedModification represents changes for a feed. +type FeedModification struct { + FeedURL *string `json:"feed_url"` + SiteURL *string `json:"site_url"` + Title *string `json:"title"` + ScraperRules *string `json:"scraper_rules"` + RewriteRules *string `json:"rewrite_rules"` + Crawler *bool `json:"crawler"` + Username *string `json:"username"` + Password *string `json:"password"` + CategoryID *int64 `json:"category_id"` +} + // FeedIcon represents the feed icon. type FeedIcon struct { ID int64 `json:"id"` |