code: func (s *TeamsService) AddTeamMembership(ctx context.Context, team int64, user string, opt *TeamAddTeamMembershipOptions) (*Membership, *Response, error) {
  	u := fmt.Sprintf("teams/%v/memberships/%v", team, user)
  	req, err := s.client.NewRequest("PUT", u, opt)
  	if err != nil {
  		return nil, nil, err
  	}
  
  	t := new(Membership)
  	resp, err := s.client.Do(ctx, req, t)
  	if err != nil {
  		return nil, resp, err
  	}
  
  	return t, resp, nil
  }
docs: // AddTeamMembership adds or invites a user to a team.
  //
  // In order to add a membership between a user and a team, the authenticated
  // user must have 'admin' permissions to the team or be an owner of the
  // organization that the team is associated with.
  //
  // If the user is already a part of the team's organization (meaning they're on
  // at least one other team in the organization), this endpoint will add the
  // user to the team.
  //
  // If the user is completely unaffiliated with the team's organization (meaning
  // they're on none of the organization's teams), this endpoint will send an
  // invitation to the user via email. This newly-created membership will be in
  // the "pending" state until the user accepts the invitation, at which point
  // the membership will transition to the "active" state and the user will be
  // added as a member of the team.
  //
  // GitHub API docs: https://developer.github.com/v3/teams/members/#add-or-update-team-membership