APIv4 PUT /commands/{command_id} (#5999)

* APIv4 PUT /commands/{command_id}

* update client parameter and api4 test
Этот коммит содержится в:
Saturnino Abril
2017-04-08 02:06:09 +09:00
коммит произвёл Corey Hulen
родитель f7b39caf31
Коммит a3f5cffd46
5 изменённых файлов: 163 добавлений и 1 удалений

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

@@ -226,6 +226,10 @@ func (c *Client4) GetCommandsRoute() string {
return fmt.Sprintf("/commands")
}
func (c *Client4) GetCommandRoute(commandId string) string {
return fmt.Sprintf(c.GetCommandsRoute()+"/%v", commandId)
}
func (c *Client4) GetEmojisRoute() string {
return fmt.Sprintf("/emoji")
}
@@ -2188,6 +2192,16 @@ func (c *Client4) CreateCommand(cmd *Command) (*Command, *Response) {
}
}
// UpdateCommand updates a command based on the provided Command struct
func (c *Client4) UpdateCommand(cmd *Command) (*Command, *Response) {
if r, err := c.DoApiPut(c.GetCommandRoute(cmd.Id), cmd.ToJson()); err != nil {
return nil, &Response{StatusCode: r.StatusCode, Error: err}
} else {
defer closeBody(r)
return CommandFromJson(r.Body), BuildResponse(r)
}
}
// ListCommands will retrieve a list of commands available in the team.
func (c *Client4) ListCommands(teamId string, customOnly bool) ([]*Command, *Response) {
query := fmt.Sprintf("?team_id=%v&custom_only=%v", teamId, customOnly)