From 88b8df314673ceae08a37a6472296448e83d7442 Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Mon, 3 Apr 2017 14:12:50 +0200 Subject: implement GET /commands (#5865) --- model/client4.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'model/client4.go') 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. -- cgit v1.2.3-1-g7c22