ronantakizawa/codereview-bench huggingface dataset:
Repository: google/go-github
File: github/orgs_immutable_releases_test.go (Go)

Code before:
		return err
	})

	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
		got, resp, err := client.Organizations.GetImmutableReleasesSettings(ctx, "o")
		if got != nil {
			t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
		}
		return resp, err
	})
}

func TestOrganizationsService_SetImmutableReleasesPolicy(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)

	input := ImmutableReleaseRepository{
		EnforcedRepositories: Ptr("selected"),
	}

	mux.HandleFunc("/orgs/o/settings/immutable-releases", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "PUT")

		// Decode request body into map
		var gotBody map[string]any
		if err := json.NewDecoder(r.Body).Decode(&gotBody); err != nil {
			t.Fatalf("Failed to decode request body: %v", err)
		}

		// Expected body
		wantBody := map[string]any{
			"enforced_repositories": "selected",
		}

		if !cmp.Equal(gotBody, wantBody) {
			t.Errorf("Request body = %+v, want %+v", gotBody, wantBody)
		}

		w.WriteHeader(http.StatusOK)
		fmt.Fprint(w, `{"enforced_repositories":"selected"}`)
	})

	ctx := t.Context()
	resp, err := client.Organizations.SetImmutableReleasesPolicy(ctx, "o", input)
	if err != nil {
		t.Errorf("Organizations.SetImmutableReleasesPolicy returned error: %v", err)
	}

	if resp.StatusCode != http.StatusOK {
		t.Errorf("Expected status 200 OK, got %v", resp.StatusCode)
	}

Review comment (suggestion):
```suggestion
		assertNilError(t, json.NewDecoder(r.Body).Decode(&gotBody))
```

Code after:
		return err
	})

	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
		got, resp, err := client.Organizations.GetImmutableReleasesSettings(ctx, "o")
		if got != nil {
			t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
		}
		return resp, err
	})
}

func TestOrganizationsService_UpdateImmutableReleasesSettings(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)

	input := ImmutableReleasePolicy{
		EnforcedRepositories: Ptr("selected"),
	}

	mux.HandleFunc("/orgs/o/settings/immutable-releases", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "PUT")

		var gotBody map[string]any
		assertNilError(t, json.NewDecoder(r.Body).Decode(&gotBody))

		wantBody := map[string]any{
			"enforced_repositories": "selected",
		}

		if !cmp.Equal(gotBody, wantBody) {
			t.Errorf("Request body = %+v, want %+v", gotBody, wantBody)
		}

		w.WriteHeader(http.StatusNoContent)
		fmt.Fprint(w, `{"enforced_repositories":"selected"}`)
	})

	ctx := t.Context()
	resp, err := client.Organizations.UpdateImmutableReleasesSettings(ctx, "o", input)
	if err != nil {
		t.Errorf("Organizations.UpdateImmutableReleasesSettings returned error: %v", err)
	}

	if resp.StatusCode != http.StatusNoContent {
		t.Errorf("Expected status 204 No Content, got %v", resp.StatusCode)
	}

	const methodName = "UpdateImmutableReleasesSettings"

	testBadOptions(t, methodName, func() error {
Repository: google/go-github
File: github/orgs_immutable_releases_test.go (Go)

Code before:
	t.Parallel()
	client, mux, _ := setup(t)

	input := ImmutableReleaseRepository{
		EnforcedRepositories: Ptr("selected"),
	}

	mux.HandleFunc("/orgs/o/settings/immutable-releases", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "PUT")

		// Decode request body into map
		var gotBody map[string]any
		if err := json.NewDecoder(r.Body).Decode(&gotBody); err != nil {
			t.Fatalf("Failed to decode request body: %v", err)
		}

		// Expected body
		wantBody := map[string]any{
			"enforced_repositories": "selected",
		}

		if !cmp.Equal(gotBody, wantBody) {
			t.Errorf("Request body = %+v, want %+v", gotBody, wantBody)
		}

		w.WriteHeader(http.StatusOK)
		fmt.Fprint(w, `{"enforced_repositories":"selected"}`)
	})

	ctx := t.Context()
	resp, err := client.Organizations.SetImmutableReleasesPolicy(ctx, "o", input)
	if err != nil {
		t.Errorf("Organizations.SetImmutableReleasesPolicy returned error: %v", err)
	}

	if resp.StatusCode != http.StatusOK {
		t.Errorf("Expected status 200 OK, got %v", resp.StatusCode)
	}

	const methodName = "SetImmutableReleasesPolicy"

	testBadOptions(t, methodName, func() error {
		_, err := client.Organizations.SetImmutableReleasesPolicy(ctx, "\n", input)
		return err
	})

	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
		resp, err := client.Organizations.SetImmutableReleasesPolicy(ctx, "o", input)
		return resp, err
	})
}

Review comment (suggestion):
```suggestion
		w.WriteHeader(http.StatusNoContent)
```

Code after:
	t.Parallel()
	client, mux, _ := setup(t)

	input := ImmutableReleasePolicy{
		EnforcedRepositories: Ptr("selected"),
	}

	mux.HandleFunc("/orgs/o/settings/immutable-releases", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "PUT")

		var gotBody map[string]any
		assertNilError(t, json.NewDecoder(r.Body).Decode(&gotBody))

		wantBody := map[string]any{
			"enforced_repositories": "selected",
		}

		if !cmp.Equal(gotBody, wantBody) {
			t.Errorf("Request body = %+v, want %+v", gotBody, wantBody)
		}

		w.WriteHeader(http.StatusNoContent)
		fmt.Fprint(w, `{"enforced_repositories":"selected"}`)
	})

	ctx := t.Context()
	resp, err := client.Organizations.UpdateImmutableReleasesSettings(ctx, "o", input)
	if err != nil {
		t.Errorf("Organizations.UpdateImmutableReleasesSettings returned error: %v", err)
	}

	if resp.StatusCode != http.StatusNoContent {
		t.Errorf("Expected status 204 No Content, got %v", resp.StatusCode)
	}

	const methodName = "UpdateImmutableReleasesSettings"

	testBadOptions(t, methodName, func() error {
		_, err := client.Organizations.UpdateImmutableReleasesSettings(ctx, "\n", input)
		return err
	})

	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
		resp, err := client.Organizations.UpdateImmutableReleasesSettings(ctx, "o", input)
		return resp, err
	})
}

func TestOrganizationsService_ListImmutableReleaseRepositories(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
Repository: google/go-github
File: github/actions_permissions_orgs.go (Go)

Code before:
// Copyright 2023 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
	"context"
	"fmt"
)

// ActionsPermissions represents a policy for repositories and allowed actions in an organization.
//
// GitHub API docs: https://docs.github.com/rest/actions/permissions
type ActionsPermissions struct {
	EnabledRepositories *string `json:"enabled_repositories,omitempty"`
	AllowedActions      *string `json:"allowed_actions,omitempty"`
	SelectedActionsURL  *string `json:"selected_actions_url,omitempty"`
	ShaPinningRequired  *bool   `json:"sha_pinning_required,omitempty"`
}

func (a ActionsPermissions) String() string {
	return Stringify(a)
}

// ActionsEnabledOnOrgRepos represents all the repositories in an organization for which Actions is enabled.
type ActionsEnabledOnOrgRepos struct {
	TotalCount   int           `json:"total_count"`
	Repositories []*Repository `json:"repositories"`
}

// ActionsAllowed represents selected actions that are allowed.
//
// GitHub API docs: https://docs.github.com/rest/actions/permissions
type ActionsAllowed struct {
	GithubOwnedAllowed *bool    `json:"github_owned_allowed,omitempty"`
	VerifiedAllowed    *bool    `json:"verified_allowed,omitempty"`
	PatternsAllowed    []string `json:"patterns_allowed,omitempty"`
}

func (a ActionsAllowed) String() string {
	return Stringify(a)
}


Review comment (suggestion):
```suggestion
	SHAPinningRequired  *bool   `json:"sha_pinning_required,omitempty"`
```

Code after:
// Copyright 2023 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
	"context"
	"fmt"
)

// ActionsPermissions represents a policy for repositories and allowed actions in an organization.
//
// GitHub API docs: https://docs.github.com/rest/actions/permissions
type ActionsPermissions struct {
	EnabledRepositories *string `json:"enabled_repositories,omitempty"`
	AllowedActions      *string `json:"allowed_actions,omitempty"`
	SelectedActionsURL  *string `json:"selected_actions_url,omitempty"`
	SHAPinningRequired  *bool   `json:"sha_pinning_required,omitempty"`
}

func (a ActionsPermissions) String() string {
	return Stringify(a)
}

// ActionsEnabledOnOrgRepos represents all the repositories in an organization for which Actions is enabled.
type ActionsEnabledOnOrgRepos struct {
	TotalCount   int           `json:"total_count"`
	Repositories []*Repository `json:"repositories"`
}

// ActionsAllowed represents selected actions that are allowed.
//
// GitHub API docs: https://docs.github.com/rest/actions/permissions
type ActionsAllowed struct {
	GithubOwnedAllowed *bool    `json:"github_owned_allowed,omitempty"`
	VerifiedAllowed    *bool    `json:"verified_allowed,omitempty"`
	PatternsAllowed    []string `json:"patterns_allowed,omitempty"`
}

func (a ActionsAllowed) String() string {
	return Stringify(a)
}
Repository: google/go-github
File: github/credentials.go (Go)

Code before:
// Copyright 2025 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
	"context"
)

// CredentialsService handles credentials related methods of the GitHub API.
type CredentialsService service

// RevokeCredentialsRequest represents the request body for revoking credentials.
type RevokeCredentialsRequest struct {
	// The list of credential strings (tokens) to revoke.
	Credentials []string `json:"credentials"`
}

// Revoke revokes a list of credentials.
//
// GitHub API docs: https://docs.github.com/rest/credentials/revoke#revoke-a-list-of-credentials
//
//meta:operation POST /credentials/revoke
func (s *CredentialsService) Revoke(ctx context.Context, credentials []string) (*Response, error) {
	u := "credentials/revoke"

	reqBody := &RevokeCredentialsRequest{Credentials: credentials}

	req, err := s.client.NewRequest("POST", u, reqBody)
	if err != nil {
		return nil, err
	}

	return s.client.Do(ctx, req, nil)
}


Review comment (security):
I think we can make this struct unexported:


```suggestion
type revokeCredentialsRequest struct {
	// The list of credential strings (tokens) to revoke.
	Credentials []string `json:"credentials"`
}
```

Code after:
// Copyright 2025 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
	"context"
)

// CredentialsService handles credentials related methods of the GitHub API.
type CredentialsService service

// revokeCredentialsRequest represents the request body for revoking credentials.
type revokeCredentialsRequest struct {
	// The list of credential strings (tokens) to revoke.
	Credentials []string `json:"credentials"`
}

// Revoke revokes a list of credentials.
//
// GitHub API docs: https://docs.github.com/rest/credentials/revoke#revoke-a-list-of-credentials
//
//meta:operation POST /credentials/revoke
func (s *CredentialsService) Revoke(ctx context.Context, credentials []string) (*Response, error) {
	u := "credentials/revoke"

	reqBody := &revokeCredentialsRequest{Credentials: credentials}

	req, err := s.client.NewRequest("POST", u, reqBody)
	if err != nil {
		return nil, err
	}

	return s.client.Do(ctx, req, nil)
}
Repository: google/go-github
File: github/rules.go (Go)

Code before:
			return nil, err
		}
		rawRules = append(rawRules, json.RawMessage(bytes))
	}

	return json.Marshal(rawRules)
}

// marshalRepositoryRulesetRule is a helper function to marshal a ruleset rule.
func marshalRepositoryRulesetRule[T any](t RepositoryRuleType, params T) ([]byte, error) {
	hasParams := true

	switch t {
	case RulesetRuleTypeCreation,
		RulesetRuleTypeDeletion,
		RulesetRuleTypeRequiredLinearHistory,
		RulesetRuleTypeRequiredSignatures,
		RulesetRuleTypeNonFastForward,
		RulesetRuleTypeRepositoryCreate,
		RulesetRuleTypeRepositoryDelete,
		RulesetRuleTypeRepositoryTransfer:
		hasParams = false
	case RulesetRuleTypeUpdate:
		paramsTyped, ok := any(params).(*UpdateRuleParameters)
		if !ok {
			return nil, fmt.Errorf("expected UpdateRuleParameters for rule type %s", t)
		}
		if paramsTyped == nil || *paramsTyped == (UpdateRuleParameters{}) {
			hasParams = false
		}
	}

	if !hasParams {
		return json.Marshal(repositoryRulesetRuleWrapper{Type: t})
	}

	bytes, err := json.Marshal(params)
	if err != nil {
		return nil, err
	}

	return json.Marshal(repositoryRulesetRuleWrapper{Type: t, Parameters: json.RawMessage(bytes)})
}

// UnmarshalJSON is a custom JSON unmarshaler for RulesetRules.
func (r *RepositoryRulesetRules) UnmarshalJSON(data []byte) error {
	var wrappers []*repositoryRulesetRuleWrapper

	if err := json.Unmarshal(data, &wrappers); err != nil {
		return err
	}

Review comment (suggestion):
```suggestion
			return nil, fmt.Errorf("expected UpdateRuleParameters for rule type %v", t)
```

Code after:
			return nil, err
		}
		rawRules = append(rawRules, json.RawMessage(bytes))
	}

	return json.Marshal(rawRules)
}

// marshalRepositoryRulesetRule is a helper function to marshal a ruleset rule.
func marshalRepositoryRulesetRule[T any](t RepositoryRuleType, params T) ([]byte, error) {
	hasParams := true

	switch t {
	case RulesetRuleTypeCreation,
		RulesetRuleTypeDeletion,
		RulesetRuleTypeRequiredLinearHistory,
		RulesetRuleTypeRequiredSignatures,
		RulesetRuleTypeNonFastForward,
		RulesetRuleTypeRepositoryCreate,
		RulesetRuleTypeRepositoryDelete,
		RulesetRuleTypeRepositoryTransfer:
		hasParams = false
	case RulesetRuleTypeUpdate:
		paramsTyped, ok := any(params).(*UpdateRuleParameters)
		if !ok {
			return nil, fmt.Errorf("expected UpdateRuleParameters for rule type %v", t)
		}
		if paramsTyped == nil || *paramsTyped == (UpdateRuleParameters{}) {
			hasParams = false
		}
	}

	if !hasParams {
		return json.Marshal(repositoryRulesetRuleWrapper{Type: t})
	}

	bytes, err := json.Marshal(params)
	if err != nil {
		return nil, err
	}

	return json.Marshal(repositoryRulesetRuleWrapper{Type: t, Parameters: json.RawMessage(bytes)})
}

// UnmarshalJSON is a custom JSON unmarshaler for RulesetRules.
func (r *RepositoryRulesetRules) UnmarshalJSON(data []byte) error {
	var wrappers []*repositoryRulesetRuleWrapper

	if err := json.Unmarshal(data, &wrappers); err != nil {
		return err
	}
Repository: google/go-github
File: github/repos_releases.go (Go)

Code before:
		uploadURL = uploadURL[:idx]
	}

	// If this is a *relative* URL (no scheme), normalize it by trimming a leading "/"
	// so it works with Client.BaseURL path prefixes (e.g. "/api-v3/").
	if !strings.HasPrefix(uploadURL, "http://") && !strings.HasPrefix(uploadURL, "https://") {
		uploadURL = strings.TrimPrefix(uploadURL, "/")
	}

	// addOptions will append name/label query params (same behavior as UploadReleaseAsset).
	u, err := addOptions(uploadURL, opts)
	if err != nil {
		return nil, nil, err
	}

	// determine media type
	mediaType := defaultMediaType
	if opts != nil && opts.MediaType != "" {
		mediaType = opts.MediaType
	} else if opts != nil && opts.Name != "" {
		if ext := filepath.Ext(opts.Name); ext != "" {
			if mt := mime.TypeByExtension(ext); mt != "" {
				mediaType = mt
			}
		}
	}

	req, err := s.client.NewUploadRequest(u, reader, size, mediaType)
	if err != nil {
		return nil, nil, err
	}

	asset := new(ReleaseAsset)
	resp, err := s.client.Do(ctx, req, asset)
	if err != nil {
		return nil, resp, err
	}
	return asset, resp, nil
}


Review comment (suggestion):
Let's check `opts != nil` only once.


```suggestion
	if opts != nil {
		switch {
		case opts.MediaType != "":
			mediaType = opts.MediaType
		case opts.Name != "":
			if ext := filepath.Ext(opts.Name); ext != "" {
				if mt := mime.TypeByExtension(ext); mt != "" {
					mediaType = mt
				}
			}
		}
	}
```

Code after:
		uploadURL = uploadURL[:idx]
	}

	// If this is a *relative* URL (no scheme), normalize it by trimming a leading "/"
	// so it works with Client.BaseURL path prefixes (e.g. "/api-v3/").
	if !strings.HasPrefix(uploadURL, "http://") && !strings.HasPrefix(uploadURL, "https://") {
		uploadURL = strings.TrimPrefix(uploadURL, "/")
	}

	// addOptions will append name/label query params (same behavior as UploadReleaseAsset).
	u, err := addOptions(uploadURL, opts)
	if err != nil {
		return nil, nil, err
	}

	// determine media type
	mediaType := defaultMediaType
	if opts != nil {
		switch {
		case opts.MediaType != "":
			mediaType = opts.MediaType
		case opts.Name != "":
			if ext := filepath.Ext(opts.Name); ext != "" {
				if mt := mime.TypeByExtension(ext); mt != "" {
					mediaType = mt
				}
			}
		}
	}

	req, err := s.client.NewUploadRequest(u, reader, size, mediaType)
	if err != nil {
		return nil, nil, err
	}

	asset := new(ReleaseAsset)
	resp, err := s.client.Do(ctx, req, asset)
	if err != nil {
		return nil, resp, err
	}
	return asset, resp, nil
}
Repository: google/go-github
File: github/enterprise_team.go (Go)

Code before:

	return updatedTeam, resp, nil
}

// DeleteTeam deletes a team in an enterprise.
//
// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-teams#delete-an-enterprise-team
//
//meta:operation DELETE /enterprises/{enterprise}/teams/{team_slug}
func (s *EnterpriseService) DeleteTeam(ctx context.Context, enterprise, teamSlug string) (*Response, error) {
	u := fmt.Sprintf("enterprises/%v/teams/%v", enterprise, teamSlug)

	req, err := s.client.NewRequest("DELETE", u, nil)
	if err != nil {
		return nil, err
	}

	resp, err := s.client.Do(ctx, req, nil)
	if err != nil {
		return resp, err
	}

	return resp, nil
}

// ListTeamMembers lists all members of a team in an enterprise team.
//
// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-members#list-members-in-an-enterprise-team
//
//meta:operation GET /enterprises/{enterprise}/teams/{enterprise-team}/memberships
func (s *EnterpriseService) ListTeamMembers(ctx context.Context, enterprise, enterpriseTeam string, opt *ListOptions) ([]*User, *Response, error) {
	u := fmt.Sprintf("enterprises/%v/teams/%v/memberships", enterprise, enterpriseTeam)
	u, err := addOptions(u, opt)
	if err != nil {
		return nil, nil, err
	}

	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	var members []*User
	resp, err := s.client.Do(ctx, req, &members)
	if err != nil {
		return nil, resp, err
	}

	return members, resp, nil
}


Review comment (suggestion):
This seems slightly redundant to me. How about this?


```suggestion
// ListTeamMembers lists all members of an enterprise team.
```

Code after:

	return updatedTeam, resp, nil
}

// DeleteTeam deletes a team in an enterprise.
//
// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-teams#delete-an-enterprise-team
//
//meta:operation DELETE /enterprises/{enterprise}/teams/{team_slug}
func (s *EnterpriseService) DeleteTeam(ctx context.Context, enterprise, teamSlug string) (*Response, error) {
	u := fmt.Sprintf("enterprises/%v/teams/%v", enterprise, teamSlug)

	req, err := s.client.NewRequest("DELETE", u, nil)
	if err != nil {
		return nil, err
	}

	resp, err := s.client.Do(ctx, req, nil)
	if err != nil {
		return resp, err
	}

	return resp, nil
}

// ListTeamMembers lists all members of an enterprise team.
//
// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-members#list-members-in-an-enterprise-team
//
//meta:operation GET /enterprises/{enterprise}/teams/{enterprise-team}/memberships
func (s *EnterpriseService) ListTeamMembers(ctx context.Context, enterprise, enterpriseTeam string, opt *ListOptions) ([]*User, *Response, error) {
	u := fmt.Sprintf("enterprises/%v/teams/%v/memberships", enterprise, enterpriseTeam)
	u, err := addOptions(u, opt)
	if err != nil {
		return nil, nil, err
	}

	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	var members []*User
	resp, err := s.client.Do(ctx, req, &members)
	if err != nil {
		return nil, resp, err
	}

	return members, resp, nil
}
Repository: google/go-github
File: github/enterprise_team.go (Go)

Code before:
	return membership, resp, nil
}

// AddTeamMember adds a member to a team in an enterprise team.
//
// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-members#add-team-member
//
//meta:operation PUT /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username}
func (s *EnterpriseService) AddTeamMember(ctx context.Context, enterprise, enterpriseTeam, username string) (*User, *Response, error) {
	u := fmt.Sprintf("enterprises/%v/teams/%v/memberships/%v", enterprise, enterpriseTeam, username)

	req, err := s.client.NewRequest("PUT", u, nil)
	if err != nil {
		return nil, nil, err
	}

	var member *User
	resp, err := s.client.Do(ctx, req, &member)
	if err != nil {
		return nil, resp, err
	}

	return member, resp, nil
}

// RemoveTeamMember removes a member from a team in an enterprise team.
//
// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-members#remove-team-membership
//
//meta:operation DELETE /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username}
func (s *EnterpriseService) RemoveTeamMember(ctx context.Context, enterprise, enterpriseTeam, username string) (*Response, error) {
	u := fmt.Sprintf("enterprises/%v/teams/%v/memberships/%v", enterprise, enterpriseTeam, username)

	req, err := s.client.NewRequest("DELETE", u, nil)
	if err != nil {
		return nil, err
	}

	resp, err := s.client.Do(ctx, req, nil)
	if err != nil {
		return resp, err
	}

	return resp, nil
}


Review comment (suggestion):
```suggestion
// RemoveTeamMember removes a member from an enterprise team.
```

Code after:
	return membership, resp, nil
}

// AddTeamMember adds a member to an enterprise team.
//
// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-members#add-team-member
//
//meta:operation PUT /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username}
func (s *EnterpriseService) AddTeamMember(ctx context.Context, enterprise, enterpriseTeam, username string) (*User, *Response, error) {
	u := fmt.Sprintf("enterprises/%v/teams/%v/memberships/%v", enterprise, enterpriseTeam, username)

	req, err := s.client.NewRequest("PUT", u, nil)
	if err != nil {
		return nil, nil, err
	}

	var member *User
	resp, err := s.client.Do(ctx, req, &member)
	if err != nil {
		return nil, resp, err
	}

	return member, resp, nil
}

// RemoveTeamMember removes a member from an enterprise team.
//
// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-members#remove-team-membership
//
//meta:operation DELETE /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username}
func (s *EnterpriseService) RemoveTeamMember(ctx context.Context, enterprise, enterpriseTeam, username string) (*Response, error) {
	u := fmt.Sprintf("enterprises/%v/teams/%v/memberships/%v", enterprise, enterpriseTeam, username)

	req, err := s.client.NewRequest("DELETE", u, nil)
	if err != nil {
		return nil, err
	}

	resp, err := s.client.Do(ctx, req, nil)
	if err != nil {
		return resp, err
	}

	return resp, nil
}