diff options
Diffstat (limited to 'model/client4.go')
-rw-r--r-- | model/client4.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go index e62ce57bd..c542851e9 100644 --- a/model/client4.go +++ b/model/client4.go @@ -2019,6 +2019,17 @@ func (c *Client4) CreateCommand(cmd *Command) (*Command, *Response) { } } +// 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) + if r, err := c.DoApiGet(c.GetCommandsRoute()+query, ""); err != nil { + return nil, &Response{StatusCode: r.StatusCode, Error: err} + } else { + defer closeBody(r) + return CommandListFromJson(r.Body), BuildResponse(r) + } +} + // Status Section // GetUserStatus returns a user based on the provided user id string. |