summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorn1aba <n1aba.github@gmail.com>2017-09-18 14:40:41 +0300
committerJoram Wilander <jwawilander@gmail.com>2017-09-18 07:40:41 -0400
commit5a855e1ca1c1403ea63e4812d33b2b10a6a0fcf7 (patch)
treecfa615903bc4307e88584cd46001cb7c4f6746dd /model
parent7243aa6751c266ecd342a41cbef390c71a962425 (diff)
downloadchat-5a855e1ca1c1403ea63e4812d33b2b10a6a0fcf7.tar.gz
chat-5a855e1ca1c1403ea63e4812d33b2b10a6a0fcf7.tar.bz2
chat-5a855e1ca1c1403ea63e4812d33b2b10a6a0fcf7.zip
Implement update OAuthApp endpoint for APIv4, add test (#7413)
Diffstat (limited to 'model')
-rw-r--r--model/client4.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go
index 44c4cf6c9..42e89fd9c 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -2631,6 +2631,16 @@ func (c *Client4) CreateOAuthApp(app *OAuthApp) (*OAuthApp, *Response) {
}
}
+// UpdateOAuthApp
+func (c *Client4) UpdateOAuthApp(app *OAuthApp) (*OAuthApp, *Response) {
+ if r, err := c.DoApiPut(c.GetOAuthAppRoute(app.Id), app.ToJson()); err != nil {
+ return nil, BuildErrorResponse(r, err)
+ } else {
+ defer closeBody(r)
+ return OAuthAppFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// GetOAuthApps gets a page of registered OAuth 2.0 client applications with Mattermost acting as an OAuth 2.0 service provider.
func (c *Client4) GetOAuthApps(page, perPage int) ([]*OAuthApp, *Response) {
query := fmt.Sprintf("?page=%v&per_page=%v", page, perPage)