summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2016-12-22 18:21:05 +0000
committerCorey Hulen <corey@hulen.com>2016-12-22 10:21:05 -0800
commit53847af2c4e84e6dc81b12fb6481cb8dfbf701b9 (patch)
tree25ab583993593e17b06c20429d46714ff6a50b95 /model
parentb79b2b2a53935cd883312c1158918291a926bacd (diff)
downloadchat-53847af2c4e84e6dc81b12fb6481cb8dfbf701b9.tar.gz
chat-53847af2c4e84e6dc81b12fb6481cb8dfbf701b9.tar.bz2
chat-53847af2c4e84e6dc81b12fb6481cb8dfbf701b9.zip
API for getting channel members by IDs. (#4877)
Diffstat (limited to 'model')
-rw-r--r--model/client.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/model/client.go b/model/client.go
index 9ff34f5bf..1f87c619e 100644
--- a/model/client.go
+++ b/model/client.go
@@ -1387,6 +1387,18 @@ func (c *Client) GetChannelMember(channelId string, userId string) (*Result, *Ap
}
}
+// GetChannelMembersByIds will return channel member objects as an array based on the
+// channel id and a list of user ids provided. Must be authenticated.
+func (c *Client) GetChannelMembersByIds(channelId string, userIds []string) (*Result, *AppError) {
+ if r, err := c.DoApiPost(c.GetChannelRoute(channelId)+"/members/ids", ArrayToJson(userIds)); err != nil {
+ return nil, err
+ } else {
+ defer closeBody(r)
+ return &Result{r.Header.Get(HEADER_REQUEST_ID),
+ r.Header.Get(HEADER_ETAG_SERVER), ChannelMembersFromJson(r.Body)}, nil
+ }
+}
+
func (c *Client) CreatePost(post *Post) (*Result, *AppError) {
if r, err := c.DoApiPost(c.GetChannelRoute(post.ChannelId)+"/posts/create", post.ToJson()); err != nil {
return nil, err