summaryrefslogtreecommitdiffstats
path: root/model/client.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-11-29 10:12:59 -0500
committerChristopher Speller <crspeller@gmail.com>2016-11-29 10:12:59 -0500
commit02d581c1599c5d50cc507bd2633f1e3c34b1cc84 (patch)
tree73437f73a8031b8c792e4b6652d1eb2428c6f2d7 /model/client.go
parentad52183248512b9aafa59b4429364c75e024cf6f (diff)
downloadchat-02d581c1599c5d50cc507bd2633f1e3c34b1cc84.tar.gz
chat-02d581c1599c5d50cc507bd2633f1e3c34b1cc84.tar.bz2
chat-02d581c1599c5d50cc507bd2633f1e3c34b1cc84.zip
PLT-4697 Update channel switcher to autocomplete all users on the system (#4624)
* Add autocomplete API for system-wide users * Update channel switcher to autocomplete all users on the system
Diffstat (limited to 'model/client.go')
-rw-r--r--model/client.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/model/client.go b/model/client.go
index 30eba99f8..631de9c56 100644
--- a/model/client.go
+++ b/model/client.go
@@ -621,6 +621,19 @@ func (c *Client) AutocompleteUsersInTeam(term string) (*Result, *AppError) {
}
}
+// AutocompleteUsers returns a list for autocompletion of users on the system that match the provided term,
+// matching against username, full name and nickname. Must be authenticated.
+func (c *Client) AutocompleteUsers(term string) (*Result, *AppError) {
+ url := fmt.Sprintf("/users/autocomplete?term=%s", url.QueryEscape(term))
+ if r, err := c.DoApiGet(url, "", ""); err != nil {
+ return nil, err
+ } else {
+ defer closeBody(r)
+ return &Result{r.Header.Get(HEADER_REQUEST_ID),
+ r.Header.Get(HEADER_ETAG_SERVER), UserListFromJson(r.Body)}, nil
+ }
+}
+
// LoginById authenticates a user by user id and password.
func (c *Client) LoginById(id string, password string) (*Result, *AppError) {
m := make(map[string]string)