func (m *MembershipsClient) Create(ctx context.Context, userID, orgID, teamID *identity.ID) error {
	if orgID == nil {
		return errors.New("invalid org")
	}
	if userID == nil {
		return errors.New("invalid user")
	}
	if teamID == nil {
		return errors.New("invalid team")
	}

	membershipBody := primitive.Membership{
		OwnerID: userID,
		OrgID:   orgID,
		TeamID:  teamID,
	}

	ID, err := identity.NewMutable(&membershipBody)
	if err != nil {
		return err
	}

	membership := apitypes.Membership{
		ID:      &ID,
		Version: 1,
		Body:    &membershipBody,
	}

	req, _, err := m.client.NewRequest("POST", "/memberships", nil, membership, true)
	if err != nil {
		return err
	}

	_, err = m.client.Do(ctx, req, nil, nil, nil)
	return err
}
// Create requests addition of a user to a team
Create requests addition of a user to a team
// Create requests addition of a user to a team
func (m *MembershipsClient) Create(ctx context.Context, userID, orgID, teamID *identity.ID) error {
	if orgID == nil {
		return errors.New("invalid org")
	}
	if userID == nil {
		return errors.New("invalid user")
	}
	if teamID == nil {
		return errors.New("invalid team")
	}
	membershipBody := primitive.Membership{
		OwnerID: userID,
		OrgID:   orgID,
		TeamID:  teamID,
	}
	ID, err := identity.NewMutable(&membershipBody)
	if err != nil {
		return err
	}
	membership := apitypes.Membership{
		ID:      &ID,
		Version: 1,
		Body:    &membershipBody,
	}
	req, _, err := m.client.NewRequest("POST", "/memberships", nil, membership, true)
	if err != nil {
		return err
	}
	_, err = m.client.Do(ctx, req, nil, nil, nil)
	return err
}
func ( m * MembershipsClient ) Create ( ctx context . Context , userID , orgID , teamID * identity . ID ) error { if orgID == nil { return errors . New ( " " ) } if userID == nil { return errors . New ( " " ) } if teamID == nil { return errors . New ( " " ) } membershipBody := primitive . Membership { OwnerID : userID , OrgID : orgID , TeamID : teamID , } ID , err := identity . NewMutable ( & membershipBody ) if err != nil { return err } membership := apitypes . Membership { ID : & ID , Version : 1 , Body : & membershipBody , } req , _ , err := m . client . NewRequest ( " " , " " , nil , membership , true ) if err != nil { return err } _ , err = m . client . Do ( ctx , req , nil , nil , nil ) return err }
Create requests addition of a user to a team
Create requests addition of a user to a team