summaryrefslogtreecommitdiffstats
path: root/model/client4.go
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-03-08 01:30:33 +0100
committerJoram Wilander <jwawilander@gmail.com>2017-03-07 19:30:33 -0500
commit19ec4c42989df53279a1e7fe8dc997244ffbb20c (patch)
tree305febf622536ec03b1ef7190b7657be5a244811 /model/client4.go
parentfa75e0e7c45dfd7b72b9fa56dfb4b0ca1496c81c (diff)
downloadchat-19ec4c42989df53279a1e7fe8dc997244ffbb20c.tar.gz
chat-19ec4c42989df53279a1e7fe8dc997244ffbb20c.tar.bz2
chat-19ec4c42989df53279a1e7fe8dc997244ffbb20c.zip
add team exists endpoint for APIv4 (#5517)
Diffstat (limited to 'model/client4.go')
-rw-r--r--model/client4.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go
index d3bb6534d..34176bfb3 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -600,6 +600,16 @@ func (c *Client4) GetTeamByName(name, etag string) (*Team, *Response) {
}
}
+// TeamExists returns true or false if the team exist or not.
+func (c *Client4) TeamExists(name, etag string) (bool, *Response) {
+ if r, err := c.DoApiGet(c.GetTeamByNameRoute(name)+"/exists", etag); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return MapBoolFromJson(r.Body)["exists"], BuildResponse(r)
+ }
+}
+
// GetTeamsForUser returns a list of teams a user is on. Must be logged in as the user
// or be a system administrator.
func (c *Client4) GetTeamsForUser(userId, etag string) ([]*Team, *Response) {