From d8d0716122be5eebab85b89f5a5a522fcaed3bd1 Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Sun, 16 Apr 2017 22:49:57 +0200 Subject: [APIV4] POST /commands/{command_id}/regen_token for apiV4 (#6052) * implement POST /commands/{command_id}/regen_token for apiV4 * update comment --- model/client4.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'model') 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. -- cgit v1.2.3-1-g7c22