summaryrefslogtreecommitdiffstats
path: root/model/client4.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-03-26 12:41:06 -0700
committerGitHub <noreply@github.com>2018-03-26 12:41:06 -0700
commit4a69c277a620308959ad6870d4e7c8240f9a166d (patch)
tree11d3342d379e9dd937ecd14c05f94931da440f29 /model/client4.go
parent2bf2b5b851dfc693e5afa9648b5bbb9e6321b7fe (diff)
downloadchat-4a69c277a620308959ad6870d4e7c8240f9a166d.tar.gz
chat-4a69c277a620308959ad6870d4e7c8240f9a166d.tar.bz2
chat-4a69c277a620308959ad6870d4e7c8240f9a166d.zip
Adding go client support and basic unit tests for channel autocomplete. (#8510)
Diffstat (limited to 'model/client4.go')
-rw-r--r--model/client4.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go
index 3bbf7b4cc..231d8402d 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -1744,6 +1744,17 @@ func (c *Client4) RemoveUserFromChannel(channelId, userId string) (bool, *Respon
}
}
+// AutocompleteChannelsForTeam will return an ordered list of channels autocomplete suggestions
+func (c *Client4) AutocompleteChannelsForTeam(teamId, name string) (*ChannelList, *Response) {
+ query := fmt.Sprintf("?name=%v", name)
+ if r, err := c.DoApiGet(c.GetChannelsForTeamRoute(teamId)+"/autocomplete"+query, ""); err != nil {
+ return nil, BuildErrorResponse(r, err)
+ } else {
+ defer closeBody(r)
+ return ChannelListFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// Post Section
// CreatePost creates a post based on the provided post struct.