diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-02-16 09:46:55 -0500 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-02-16 09:46:55 -0500 |
commit | f87d42916f1ec4287daad29d6ffd4145dfc4b5cd (patch) | |
tree | dd0296f0023efe031dbacbb39b724540bed2d8a5 /model/client4.go | |
parent | 8f262241595cc9377e4c3adce9c728eaff38c5f3 (diff) | |
download | chat-f87d42916f1ec4287daad29d6ffd4145dfc4b5cd.tar.gz chat-f87d42916f1ec4287daad29d6ffd4145dfc4b5cd.tar.bz2 chat-f87d42916f1ec4287daad29d6ffd4145dfc4b5cd.zip |
Implement PUT /users/{user_id}/patch endpoint for APIv4 (#5418)
Diffstat (limited to 'model/client4.go')
-rw-r--r-- | model/client4.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go index 5c51026a9..48a88e968 100644 --- a/model/client4.go +++ b/model/client4.go @@ -334,6 +334,16 @@ func (c *Client4) UpdateUser(user *User) (*User, *Response) { } } +// PatchUser partially updates a user in the system. Any missing fields are not updated. +func (c *Client4) PatchUser(userId string, patch *UserPatch) (*User, *Response) { + if r, err := c.DoApiPut(c.GetUserRoute(userId)+"/patch", patch.ToJson()); err != nil { + return nil, &Response{StatusCode: r.StatusCode, Error: err} + } else { + defer closeBody(r) + return UserFromJson(r.Body), BuildResponse(r) + } +} + // UpdateUserPassword updates a user's password. Must be logged in as the user or be a system administrator. func (c *Client4) UpdateUserPassword(userId, currentPassword, newPassword string) (bool, *Response) { requestBody := map[string]string{"current_password": currentPassword, "new_password": newPassword} |