diff options
author | Carlos Tadeu Panato Junior <ctadeu@gmail.com> | 2017-04-16 22:49:57 +0200 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-04-16 16:49:57 -0400 |
commit | d8d0716122be5eebab85b89f5a5a522fcaed3bd1 (patch) | |
tree | 8568b44afc612d9adaddc7fea7b92d993663ce16 /model/client4.go | |
parent | 461a0b3b7c14cd59cb53eb66f419c965ab3bdd24 (diff) | |
download | chat-d8d0716122be5eebab85b89f5a5a522fcaed3bd1.tar.gz chat-d8d0716122be5eebab85b89f5a5a522fcaed3bd1.tar.bz2 chat-d8d0716122be5eebab85b89f5a5a522fcaed3bd1.zip |
[APIV4] POST /commands/{command_id}/regen_token for apiV4 (#6052)
* implement POST /commands/{command_id}/regen_token for apiV4
* update comment
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 c30be31e8..943525420 100644 --- a/model/client4.go +++ b/model/client4.go @@ -2243,6 +2243,16 @@ func (c *Client4) ListAutocompleteCommands(teamId string) ([]*Command, *Response } } +// RegenCommandToken will create a new token if the user have the right permissions. +func (c *Client4) RegenCommandToken(commandId string) (string, *Response) { + if r, err := c.DoApiPut(c.GetCommandRoute(commandId)+"/regen_token", ""); err != nil { + return "", &Response{StatusCode: r.StatusCode, Error: err} + } else { + defer closeBody(r) + return MapFromJson(r.Body)["token"], BuildResponse(r) + } +} + // Status Section // GetUserStatus returns a user based on the provided user id string. |