summaryrefslogtreecommitdiffstats
path: root/model/client.go
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2016-12-08 16:21:43 +0100
committerHarrison Healey <harrisonmhealey@gmail.com>2016-12-08 10:21:43 -0500
commitd402b1d010a56256f15bb482684c18b10ed4bcc5 (patch)
tree0f94813e07ced23c05b22dd302048698e88a7466 /model/client.go
parentb57c9fec89f736de8622218d6dc779012a266a91 (diff)
downloadchat-d402b1d010a56256f15bb482684c18b10ed4bcc5.tar.gz
chat-d402b1d010a56256f15bb482684c18b10ed4bcc5.tar.bz2
chat-d402b1d010a56256f15bb482684c18b10ed4bcc5.zip
Add API call to get a team by its name (#4690)
* Add API call to get a team by its name * add tests for client side and update route regex * remove action * add check for permissions and create tests
Diffstat (limited to 'model/client.go')
-rw-r--r--model/client.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/model/client.go b/model/client.go
index 53b1887a0..510ba461f 100644
--- a/model/client.go
+++ b/model/client.go
@@ -1769,6 +1769,18 @@ func (c *Client) GetTeamStats(teamId string) (*Result, *AppError) {
}
}
+// GetTeamStats will return a team stats object containing the number of users on the team
+// based on the team id provided. Must be authenticated.
+func (c *Client) GetTeamByName(teamName string) (*Result, *AppError) {
+ if r, err := c.DoApiGet(fmt.Sprintf("/teams/name/%v", teamName), "", ""); err != nil {
+ return nil, err
+ } else {
+ defer closeBody(r)
+ return &Result{r.Header.Get(HEADER_REQUEST_ID),
+ r.Header.Get(HEADER_ETAG_SERVER), TeamStatsFromJson(r.Body)}, nil
+ }
+}
+
// GetTeamMembersByIds will return team member objects as an array based on the
// team id and a list of user ids provided. Must be authenticated.
func (c *Client) GetTeamMembersByIds(teamId string, userIds []string) (*Result, *AppError) {