MM-23722 add endpoint for modify team privacy (#14287)

* MM-23722 add Rest API for updating team privacy
* unit tests for UpdateTeamPrivacy
Этот коммит содержится в:
Doug Lauder
2020-04-20 21:09:40 -04:00
коммит произвёл GitHub
родитель 0cb8d96be2
Коммит 98c6401f54
3 изменённых файлов: 135 добавлений и 0 удалений

Просмотреть файл

@@ -1794,6 +1794,18 @@ func (c *Client4) PermanentDeleteTeam(teamId string) (bool, *Response) {
return CheckStatusOK(r), BuildResponse(r)
}
// UpdateTeamPrivacy modifies the team type (model.TEAM_OPEN <--> model.TEAM_INVITE) and sets
// the corresponding AllowOpenInvite appropriately.
func (c *Client4) UpdateTeamPrivacy(teamId string, privacy string) (*Team, *Response) {
requestBody := map[string]string{"privacy": privacy}
r, err := c.DoApiPut(c.GetTeamRoute(teamId)+"/privacy", MapToJson(requestBody))
if err != nil {
return nil, BuildErrorResponse(r, err)
}
defer closeBody(r)
return TeamFromJson(r.Body), BuildResponse(r)
}
// GetTeamMembers returns team members based on the provided team id string.
func (c *Client4) GetTeamMembers(teamId string, page int, perPage int, etag string) ([]*TeamMember, *Response) {
query := fmt.Sprintf("?page=%v&per_page=%v", page, perPage)