[APIV4] POST /commands/{command_id}/regen_token for apiV4 (#6052)

* implement POST /commands/{command_id}/regen_token for apiV4

* update comment
Этот коммит содержится в:
Carlos Tadeu Panato Junior
2017-04-16 22:49:57 +02:00
коммит произвёл Joram Wilander
родитель 461a0b3b7c
Коммит d8d0716122
3 изменённых файлов: 84 добавлений и 0 удалений

Просмотреть файл

@@ -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.