diff options
author | Carlos Tadeu Panato Junior <ctadeu@gmail.com> | 2017-04-03 14:12:50 +0200 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-04-03 08:12:50 -0400 |
commit | 88b8df314673ceae08a37a6472296448e83d7442 (patch) | |
tree | ca1e646bbc3daf4f47cb8404d35305a74230f2e6 /model/client4.go | |
parent | 67a8770118a7e8902efe537c4257b7442cb651fd (diff) | |
download | chat-88b8df314673ceae08a37a6472296448e83d7442.tar.gz chat-88b8df314673ceae08a37a6472296448e83d7442.tar.bz2 chat-88b8df314673ceae08a37a6472296448e83d7442.zip |
implement GET /commands (#5865)
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. |