Skip to content

Commit

Permalink
Add user preferences update
Browse files Browse the repository at this point in the history
  • Loading branch information
kariudo committed Feb 7, 2015
1 parent 4df119a commit 7d2fc58
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
A complete go package for interacting with the fantastic Pushbullet service.

## Status
primary feature development still in progress, see below for current status:
Major features all complete. Additional tests need to be written and a couple less common features.

### Done :
* Get User
* Set User preferences
* Send Pushes
* Note
* Link
Expand All @@ -25,6 +26,5 @@ primary feature development still in progress, see below for current status:
* Subscriptions (add, info, remove)

### Todo :
* Set User preferences
* Web Sockets
* OAuth account access
10 changes: 10 additions & 0 deletions gopushbullet.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,16 @@ func (c *Client) AuthorizeUpload(fileName, fileType string) (Authorization, erro
return auth, nil
}

//UpdatePreferences overwrites user preferences with specified ones
func (c *Client) UpdatePreferences(preferences Preferences) error {
_, apiError, err := c.makeCall("POST", "users/me", preferences)
if err != nil {
log.Println("Failed to update preferences: ", apiError, err)
return err
}
return err
}

func (c *Client) makeCall(method string, call string, data interface{}) (responseBody []byte, apiError *Error, err error) {
// make sure API key seems ok
if len(c.APIKey) == 0 {
Expand Down

0 comments on commit 7d2fc58

Please sign in to comment.