MM-19250 - new endpoint to retrieve command by id (#13598)
* MM-19250 add endpoint to retrieve command by id * endpoint * client * unit tests * MM-19250 update comment; remove redundant unit test * MM-19250 rename GetCommand to GetCommandById * MM-19250 don't filter on autocomplete flag * MM-19250: require team_id when using GetCommandById * team_id added to endpoint query string for GET * unit test to check for mismatch teamid param and command teamid * Revert "MM-19250: require team_id when using GetCommandById" This reverts commit ed78e2796426f75bc23d0f16064be95fa37305fd. * MM-19250 don't leak existence of id when user doesn't have perms * return 404 not_found when id not found * return 404 not_found when id exists but user missing perms to view team * return 404 not_found when id exists but user missing perms to manage commands * MM-19250 fix typos in comments Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
@@ -4015,6 +4015,17 @@ func (c *Client4) ListCommands(teamId string, customOnly bool) ([]*Command, *Res
|
||||
return CommandListFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
|
||||
// GetCommandById will retrieve a command by id.
|
||||
func (c *Client4) GetCommandById(cmdId string) (*Command, *Response) {
|
||||
url := fmt.Sprintf("%s/%s", c.GetCommandsRoute(), cmdId)
|
||||
r, err := c.DoApiGet(url, "")
|
||||
if err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
}
|
||||
defer closeBody(r)
|
||||
return CommandFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
|
||||
// ExecuteCommand executes a given slash command.
|
||||
func (c *Client4) ExecuteCommand(channelId, command string) (*CommandResponse, *Response) {
|
||||
commandArgs := &CommandArgs{
|
||||
|
||||
Ссылка в новой задаче
Block a user