prow/github/client.go
func (c *Client) UpdateTeamMembership(id int, user string, maintainer bool) (*TeamMembership, error) {
	c.log("UpdateTeamMembership", id, user, maintainer)
	if c.fake {
		return nil, nil
	}
	tm := TeamMembership{}
	if maintainer {
		tm.Role = RoleMaintainer
	} else {
		tm.Role = RoleMember
	}

	if c.dry {
		return &tm, nil
	}

	_, err := c.request(&request{
		method:      http.MethodPut,
		path:        fmt.Sprintf("/teams/%d/memberships/%s", id, user),
		requestBody: &tm,
		exitCodes:   []int{200},
	}, &tm)
	return &tm, err
}
func (c *Client) UpdateTeamMembership(id int, user string, maintainer bool) (*TeamMembership, error) {
	c.log("UpdateTeamMembership", id, user, maintainer)
	if c.fake {
		return nil, nil
	}
	tm := TeamMembership{}
	if maintainer {
		tm.Role = RoleMaintainer
	} else {
		tm.Role = RoleMember
	}

	if c.dry {
		return &tm, nil
	}

	_, err := c.request(&request{
		method:      http.MethodPut,
		path:        fmt.Sprintf("/teams/%d/memberships/%s", id, user),
		requestBody: &tm,
		exitCodes:   []int{200},
	}, &tm)
	return &tm, err
}
func ( c * Client ) UpdateTeamMembership ( id int , user string , maintainer bool ) ( * TeamMembership , error ) { c . log ( " " , id , user , maintainer ) if c . fake { return nil , nil } tm := TeamMembership { } if maintainer { tm . Role = RoleMaintainer } else { tm . Role = RoleMember } if c . dry { return & tm , nil } _ , err := c . request ( & request { method : http . MethodPut , path : fmt . Sprintf ( " " , id , user ) , requestBody : & tm , exitCodes : [ ] int { 200 } , } , & tm ) return & tm , err }
// UpdateTeamMembership adds the user to the team and/or updates their role in that team.
//
// If the user is not a member of the org, GitHub will invite them to become an outside collaborator, setting their status to pending.
//
// https://developer.github.com/v3/teams/members/#add-or-update-team-membership
UpdateTeamMembership adds the user to the team and / or updates their role in that team . If the user is not a member of the org GitHub will invite them to become an outside collaborator setting their status to pending . https : // developer . github . com / v3 / teams / members / #add - or - update - team - membership