summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-04-27 22:41:52 +0900
committerJoram Wilander <jwawilander@gmail.com>2017-04-27 09:41:52 -0400
commit0e007e344bf10993529711f14c4168365c3504c3 (patch)
tree82b4178a043166b9ce6d9be36607bab0851a9819 /model
parentbd665871831a43184ceb928bdeb862b0a46386cf (diff)
downloadchat-0e007e344bf10993529711f14c4168365c3504c3.tar.gz
chat-0e007e344bf10993529711f14c4168365c3504c3.tar.bz2
chat-0e007e344bf10993529711f14c4168365c3504c3.zip
APIv4 POST /commands/execute (#6205)
Diffstat (limited to 'model')
-rw-r--r--model/client4.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go
index 2a7338809..a33e62846 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -2389,6 +2389,17 @@ func (c *Client4) ListCommands(teamId string, customOnly bool) ([]*Command, *Res
}
}
+// ExecuteCommand executes a given command.
+func (c *Client4) ExecuteCommand(channelId, command string) (*CommandResponse, *Response) {
+ commandArgs := &CommandArgs{ChannelId: channelId, Command: command}
+ if r, err := c.DoApiPost(c.GetCommandsRoute()+"/execute", commandArgs.ToJson()); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CommandResponseFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// ListCommands will retrieve a list of commands available in the team.
func (c *Client4) ListAutocompleteCommands(teamId string) ([]*Command, *Response) {
if r, err := c.DoApiGet(c.GetTeamAutoCompleteCommandsRoute(teamId), ""); err != nil {