summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorJesús Espino <jespinog@gmail.com>2018-09-11 22:45:31 +0200
committerGitHub <noreply@github.com>2018-09-11 22:45:31 +0200
commite32581aef3253bb0691d6fd678fbf01e86f2c10c (patch)
tree895aff7c6cc2e43a5209bb3c7b19384f13c5b105 /model
parentd585f9d9a3bd7c272a02e1d3d52990bc6ecb37a3 (diff)
downloadchat-e32581aef3253bb0691d6fd678fbf01e86f2c10c.tar.gz
chat-e32581aef3253bb0691d6fd678fbf01e86f2c10c.tar.bz2
chat-e32581aef3253bb0691d6fd678fbf01e86f2c10c.zip
MM-11725: Add specific autocomplete endpoint for search autocomplete (#9337)
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 47d227742..c95aaad0b 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -1961,6 +1961,17 @@ func (c *Client4) AutocompleteChannelsForTeam(teamId, name string) (*ChannelList
}
}
+// AutocompleteChannelsForTeamForSearch will return an ordered list of your channels autocomplete suggestions
+func (c *Client4) AutocompleteChannelsForTeamForSearch(teamId, name string) (*ChannelList, *Response) {
+ query := fmt.Sprintf("?name=%v", name)
+ if r, err := c.DoApiGet(c.GetChannelsForTeamRoute(teamId)+"/search_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.