From 5a855e1ca1c1403ea63e4812d33b2b10a6a0fcf7 Mon Sep 17 00:00:00 2001 From: n1aba Date: Mon, 18 Sep 2017 14:40:41 +0300 Subject: Implement update OAuthApp endpoint for APIv4, add test (#7413) --- model/client4.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'model') 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) -- cgit v1.2.3-1-g7c22