diff --git a/.custom-gcl.yml b/.custom-gcl.yml index 914429b101a..277e39e84e9 100644 --- a/.custom-gcl.yml +++ b/.custom-gcl.yml @@ -6,6 +6,8 @@ plugins: path: ./tools/fmtpercentv - module: "github.com/google/go-github/v88/tools/redundantptr" path: ./tools/redundantptr + - module: "github.com/google/go-github/v88/tools/requestbody" + path: ./tools/requestbody - module: "github.com/google/go-github/v88/tools/sliceofpointers" path: ./tools/sliceofpointers - module: "github.com/google/go-github/v88/tools/structfield" diff --git a/.golangci.yml b/.golangci.yml index a2fea56937c..e6c091e5129 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -28,6 +28,7 @@ linters: - paralleltest - perfsprint - redundantptr + - requestbody - revive - sliceofpointers - staticcheck @@ -198,6 +199,134 @@ linters: type: module description: Reports github.Ptr(x) calls that can be replaced with &x. original-url: github.com/google/go-github/v88/tools/redundantptr + requestbody: + type: module + description: Reports miscellaneous issues for request body parameters. + original-url: github.com/google/go-github/v88/tools/requestbody + settings: + # Body type names exempt from the "pass by value, not by pointer" rule. + # TODO: fix and remove these exceptions. + allowed-pointer-types: + - ActionsVariable + - AddProjectItemOptions + - AuthorizationRequest + - AutolinkOptions + - CodeScanningAlertState + - CodespaceCreateForUserOptions + - ConfigApplyOptions + - ConfigSettings + - CreateCodespaceOptions + - CreateOrUpdateCustomRepoRoleOptions + - CreateOrUpdateIssueTypesOptions + - CreateOrgInvitationOptions + - CreateUpdateEnvironment + - CreateWorkflowDispatchEventRequest + - CustomDeploymentProtectionRuleRequest + - CustomProperty + - DependabotAlertState + - DependabotEncryptedSecret + - DependencyGraphSnapshot + - DeploymentBranchPolicyRequest + - DeploymentRequest + - DeploymentStatusRequest + - EncryptedSecret + - EnterpriseSecurityAnalysisSettings + - ExternalGroup + - GenerateJITConfigRequest + - GenerateNotesOptions + - Gist + - GistComment + - Hook + - HookConfig + - ImpersonateUserOptions + - Import + - InstallationTokenListRepoOptions + - InstallationTokenOptions + - IssueComment + - IssueImportRequest + - IssueRequest + - Key + - Label + - LockIssueOptions + - MaintenanceOptions + - Milestone + - NewPullRequest + - OIDCSubjectClaimCustomTemplate + - Organization + - PagesUpdate + - PagesUpdateWithoutCNAME + - PendingDeploymentsRequest + - PreReceiveHook + - ProtectionRequest + - PublishCodespaceOptions + - PullRequestBranchUpdateOptions + - PullRequestComment + - PullRequestReviewDismissalRequest + - PullRequestReviewRequest + - PullRequestReviewsEnforcementUpdate + - ReleaseAsset + - RepoMergeUpstreamRequest + - Repository + - RepositoryAddCollaboratorOptions + - RepositoryComment + - RepositoryContentFileOptions + - RepositoryCreateForkOptions + - RepositoryMergeRequest + - RequiredStatusChecksRequest + - ReviewCustomDeploymentProtectionRuleRequest + - SCIMUserAttributes + - SarifAnalysis + - SecretScanningAlertUpdateOptions + - SecretScanningPatternConfigsUpdateOptions + - SourceImportAuthor + - Subscription + - TeamAddTeamMembershipOptions + - TeamAddTeamRepoOptions + - TeamLDAPMapping + - TeamProjectOptions + - TemplateRepoRequest + - UpdateCodespaceOptions + - UpdateDefaultSetupConfigurationOptions + - UpdateProjectItemOptions + - User + - UserLDAPMapping + - UserSuspendOptions + - WorkflowsPermissionsOpt + # Body type names exempt from the "Options" suffix rule. + # TODO: fix and remove these exceptions. + allowed-wrong-names: + - AddProjectItemOptions + - AutolinkOptions + - CheckSuitePreferenceOptions + - CodespaceCreateForUserOptions + - ConfigApplyOptions + - CreateCheckRunOptions + - CreateCheckSuiteOptions + - CreateCodespaceOptions + - CreateOrUpdateCustomRepoRoleOptions + - CreateOrUpdateIssueTypesOptions + - CreateOrgInvitationOptions + - GenerateNotesOptions + - ImpersonateUserOptions + - InstallationTokenListRepoOptions + - InstallationTokenOptions + - LockIssueOptions + - MaintenanceOptions + - PublishCodespaceOptions + - PullRequestBranchUpdateOptions + - RepositoryAddCollaboratorOptions + - RepositoryContentFileOptions + - RepositoryCreateForkOptions + - SecretScanningAlertUpdateOptions + - SecretScanningPatternConfigsUpdateOptions + - TeamAddTeamMembershipOptions + - TeamAddTeamRepoOptions + - TeamProjectOptions + - UpdateCheckRunOptions + - UpdateCodespaceOptions + - UpdateDefaultSetupConfigurationOptions + - UpdateProjectItemOptions + - UserSuspendOptions sliceofpointers: type: module description: Reports usage of []*string and slices of structs without pointers. @@ -436,6 +565,8 @@ linters: issues: max-issues-per-linter: 0 max-same-issues: 0 + # requestbody reports multiple distinct issues on the same parameter line. + uniq-by-line: false formatters: enable: - gci diff --git a/github/actions_hosted_runners.go b/github/actions_hosted_runners.go index 6b46f3a3c07..abc4decfb4d 100644 --- a/github/actions_hosted_runners.go +++ b/github/actions_hosted_runners.go @@ -140,13 +140,13 @@ func validateCreateHostedRunnerRequest(request *CreateHostedRunnerRequest) error // GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#create-a-github-hosted-runner-for-an-organization // //meta:operation POST /orgs/{org}/actions/hosted-runners -func (s *ActionsService) CreateHostedRunner(ctx context.Context, org string, request CreateHostedRunnerRequest) (*HostedRunner, *Response, error) { - if err := validateCreateHostedRunnerRequest(&request); err != nil { +func (s *ActionsService) CreateHostedRunner(ctx context.Context, org string, body CreateHostedRunnerRequest) (*HostedRunner, *Response, error) { + if err := validateCreateHostedRunnerRequest(&body); err != nil { return nil, nil, fmt.Errorf("validation failed: %w", err) } u := fmt.Sprintf("orgs/%v/actions/hosted-runners", org) - req, err := s.client.NewRequest(ctx, "POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -362,9 +362,9 @@ func (s *ActionsService) GetHostedRunner(ctx context.Context, org string, runner // GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#update-a-github-hosted-runner-for-an-organization // //meta:operation PATCH /orgs/{org}/actions/hosted-runners/{hosted_runner_id} -func (s *ActionsService) UpdateHostedRunner(ctx context.Context, org string, runnerID int64, request UpdateHostedRunnerRequest) (*HostedRunner, *Response, error) { +func (s *ActionsService) UpdateHostedRunner(ctx context.Context, org string, runnerID int64, body UpdateHostedRunnerRequest) (*HostedRunner, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/hosted-runners/%v", org, runnerID) - req, err := s.client.NewRequest(ctx, "PATCH", u, request) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/actions_oidc.go b/github/actions_oidc.go index 06ec8cec464..9b9f183be50 100644 --- a/github/actions_oidc.go +++ b/github/actions_oidc.go @@ -56,9 +56,9 @@ func (s *ActionsService) getOIDCSubjectClaimCustomTemplate(ctx context.Context, // GitHub API docs: https://docs.github.com/rest/actions/oidc?apiVersion=2022-11-28#set-the-customization-template-for-an-oidc-subject-claim-for-an-organization // //meta:operation PUT /orgs/{org}/actions/oidc/customization/sub -func (s *ActionsService) SetOrgOIDCSubjectClaimCustomTemplate(ctx context.Context, org string, template *OIDCSubjectClaimCustomTemplate) (*Response, error) { +func (s *ActionsService) SetOrgOIDCSubjectClaimCustomTemplate(ctx context.Context, org string, body *OIDCSubjectClaimCustomTemplate) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/oidc/customization/sub", org) - return s.setOIDCSubjectClaimCustomTemplate(ctx, u, template) + return s.setOIDCSubjectClaimCustomTemplate(ctx, u, body) } // SetRepoOIDCSubjectClaimCustomTemplate sets the subject claim customization for a repository. @@ -71,8 +71,8 @@ func (s *ActionsService) SetRepoOIDCSubjectClaimCustomTemplate(ctx context.Conte return s.setOIDCSubjectClaimCustomTemplate(ctx, u, template) } -func (s *ActionsService) setOIDCSubjectClaimCustomTemplate(ctx context.Context, url string, template *OIDCSubjectClaimCustomTemplate) (*Response, error) { - req, err := s.client.NewRequest(ctx, "PUT", url, template) +func (s *ActionsService) setOIDCSubjectClaimCustomTemplate(ctx context.Context, url string, body *OIDCSubjectClaimCustomTemplate) (*Response, error) { + req, err := s.client.NewRequest(ctx, "PUT", url, body) if err != nil { return nil, err } diff --git a/github/actions_permissions_enterprise.go b/github/actions_permissions_enterprise.go index 4508c430940..1f903e9bf83 100644 --- a/github/actions_permissions_enterprise.go +++ b/github/actions_permissions_enterprise.go @@ -73,9 +73,9 @@ func (s *ActionsService) GetActionsPermissionsInEnterprise(ctx context.Context, // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-github-actions-permissions-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/permissions -func (s *ActionsService) UpdateActionsPermissionsInEnterprise(ctx context.Context, enterprise string, actionsPermissionsEnterprise ActionsPermissionsEnterprise) (*ActionsPermissionsEnterprise, *Response, error) { +func (s *ActionsService) UpdateActionsPermissionsInEnterprise(ctx context.Context, enterprise string, body ActionsPermissionsEnterprise) (*ActionsPermissionsEnterprise, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise) - req, err := s.client.NewRequest(ctx, "PUT", u, actionsPermissionsEnterprise) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } @@ -207,9 +207,9 @@ func (s *ActionsService) GetActionsAllowedInEnterprise(ctx context.Context, ente // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-allowed-actions-and-reusable-workflows-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/permissions/selected-actions -func (s *ActionsService) UpdateActionsAllowedInEnterprise(ctx context.Context, enterprise string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { +func (s *ActionsService) UpdateActionsAllowedInEnterprise(ctx context.Context, enterprise string, body ActionsAllowed) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise) - req, err := s.client.NewRequest(ctx, "PUT", u, actionsAllowed) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } @@ -250,9 +250,9 @@ func (s *ActionsService) GetDefaultWorkflowPermissionsInEnterprise(ctx context.C // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-default-workflow-permissions-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/permissions/workflow -func (s *ActionsService) UpdateDefaultWorkflowPermissionsInEnterprise(ctx context.Context, enterprise string, permissions DefaultWorkflowPermissionEnterprise) (*DefaultWorkflowPermissionEnterprise, *Response, error) { +func (s *ActionsService) UpdateDefaultWorkflowPermissionsInEnterprise(ctx context.Context, enterprise string, body DefaultWorkflowPermissionEnterprise) (*DefaultWorkflowPermissionEnterprise, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/workflow", enterprise) - req, err := s.client.NewRequest(ctx, "PUT", u, permissions) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } @@ -293,9 +293,9 @@ func (s *ActionsService) GetArtifactAndLogRetentionPeriodInEnterprise(ctx contex // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-artifact-and-log-retention-settings-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/permissions/artifact-and-log-retention -func (s *ActionsService) UpdateArtifactAndLogRetentionPeriodInEnterprise(ctx context.Context, enterprise string, period ArtifactPeriodOpt) (*Response, error) { +func (s *ActionsService) UpdateArtifactAndLogRetentionPeriodInEnterprise(ctx context.Context, enterprise string, body ArtifactPeriodOpt) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/artifact-and-log-retention", enterprise) - req, err := s.client.NewRequest(ctx, "PUT", u, period) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } @@ -329,9 +329,9 @@ func (s *ActionsService) GetSelfHostedRunnerPermissionsInEnterprise(ctx context. // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-self-hosted-runners-permissions-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/permissions/self-hosted-runners -func (s *ActionsService) UpdateSelfHostedRunnerPermissionsInEnterprise(ctx context.Context, enterprise string, permissions SelfHostRunnerPermissionsEnterprise) (*Response, error) { +func (s *ActionsService) UpdateSelfHostedRunnerPermissionsInEnterprise(ctx context.Context, enterprise string, body SelfHostRunnerPermissionsEnterprise) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/self-hosted-runners", enterprise) - req, err := s.client.NewRequest(ctx, "PUT", u, permissions) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } @@ -366,9 +366,9 @@ func (s *ActionsService) GetPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx co // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-private-repo-fork-pr-workflow-settings-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/permissions/fork-pr-workflows-private-repos -func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise(ctx context.Context, enterprise string, permissions *WorkflowsPermissionsOpt) (*Response, error) { +func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise(ctx context.Context, enterprise string, body *WorkflowsPermissionsOpt) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-workflows-private-repos", enterprise) - req, err := s.client.NewRequest(ctx, "PUT", u, permissions) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } @@ -403,9 +403,9 @@ func (s *ActionsService) GetEnterpriseForkPRContributorApprovalPermissions(ctx c // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-fork-pr-contributor-approval-permissions-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/permissions/fork-pr-contributor-approval -func (s *ActionsService) UpdateEnterpriseForkPRContributorApprovalPermissions(ctx context.Context, enterprise string, policy ContributorApprovalPermissions) (*Response, error) { +func (s *ActionsService) UpdateEnterpriseForkPRContributorApprovalPermissions(ctx context.Context, enterprise string, body ContributorApprovalPermissions) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-contributor-approval", enterprise) - req, err := s.client.NewRequest(ctx, "PUT", u, policy) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } diff --git a/github/actions_permissions_orgs.go b/github/actions_permissions_orgs.go index ecf93a779af..a2efaaf59d7 100644 --- a/github/actions_permissions_orgs.go +++ b/github/actions_permissions_orgs.go @@ -93,9 +93,9 @@ func (s *ActionsService) GetActionsPermissions(ctx context.Context, org string) // GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-github-actions-permissions-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions -func (s *ActionsService) UpdateActionsPermissions(ctx context.Context, org string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error) { +func (s *ActionsService) UpdateActionsPermissions(ctx context.Context, org string, body ActionsPermissions) (*ActionsPermissions, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions", org) - req, err := s.client.NewRequest(ctx, "PUT", u, actionsPermissions) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } @@ -227,9 +227,9 @@ func (s *ActionsService) GetActionsAllowed(ctx context.Context, org string) (*Ac // GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-allowed-actions-and-reusable-workflows-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions/selected-actions -func (s *ActionsService) UpdateActionsAllowed(ctx context.Context, org string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { +func (s *ActionsService) UpdateActionsAllowed(ctx context.Context, org string, body ActionsAllowed) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org) - req, err := s.client.NewRequest(ctx, "PUT", u, actionsAllowed) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } @@ -270,9 +270,9 @@ func (s *ActionsService) GetDefaultWorkflowPermissionsInOrganization(ctx context // GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-default-workflow-permissions-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions/workflow -func (s *ActionsService) UpdateDefaultWorkflowPermissionsInOrganization(ctx context.Context, org string, permissions DefaultWorkflowPermissionOrganization) (*DefaultWorkflowPermissionOrganization, *Response, error) { +func (s *ActionsService) UpdateDefaultWorkflowPermissionsInOrganization(ctx context.Context, org string, body DefaultWorkflowPermissionOrganization) (*DefaultWorkflowPermissionOrganization, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/workflow", org) - req, err := s.client.NewRequest(ctx, "PUT", u, permissions) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } @@ -313,9 +313,9 @@ func (s *ActionsService) GetArtifactAndLogRetentionPeriodInOrganization(ctx cont // GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-artifact-and-log-retention-settings-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions/artifact-and-log-retention -func (s *ActionsService) UpdateArtifactAndLogRetentionPeriodInOrganization(ctx context.Context, org string, period ArtifactPeriodOpt) (*Response, error) { +func (s *ActionsService) UpdateArtifactAndLogRetentionPeriodInOrganization(ctx context.Context, org string, body ArtifactPeriodOpt) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/artifact-and-log-retention", org) - req, err := s.client.NewRequest(ctx, "PUT", u, period) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } @@ -350,10 +350,10 @@ func (s *ActionsService) GetSelfHostedRunnersSettingsInOrganization(ctx context. // GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-self-hosted-runners-settings-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions/self-hosted-runners -func (s *ActionsService) UpdateSelfHostedRunnersSettingsInOrganization(ctx context.Context, org string, opt SelfHostedRunnersSettingsOrganizationOpt) (*Response, error) { +func (s *ActionsService) UpdateSelfHostedRunnersSettingsInOrganization(ctx context.Context, org string, body SelfHostedRunnersSettingsOrganizationOpt) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/self-hosted-runners", org) - req, err := s.client.NewRequest(ctx, "PUT", u, opt) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } @@ -475,9 +475,9 @@ func (s *ActionsService) GetPrivateRepoForkPRWorkflowSettingsInOrganization(ctx // GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-private-repo-fork-pr-workflow-settings-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions/fork-pr-workflows-private-repos -func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInOrganization(ctx context.Context, org string, permissions *WorkflowsPermissionsOpt) (*Response, error) { +func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInOrganization(ctx context.Context, org string, body *WorkflowsPermissionsOpt) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/fork-pr-workflows-private-repos", org) - req, err := s.client.NewRequest(ctx, "PUT", u, permissions) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } @@ -512,9 +512,9 @@ func (s *ActionsService) GetOrganizationForkPRContributorApprovalPermissions(ctx // GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-fork-pr-contributor-approval-permissions-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions/fork-pr-contributor-approval -func (s *ActionsService) UpdateOrganizationForkPRContributorApprovalPermissions(ctx context.Context, org string, policy ContributorApprovalPermissions) (*Response, error) { +func (s *ActionsService) UpdateOrganizationForkPRContributorApprovalPermissions(ctx context.Context, org string, body ContributorApprovalPermissions) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/fork-pr-contributor-approval", org) - req, err := s.client.NewRequest(ctx, "PUT", u, policy) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } diff --git a/github/actions_runner_groups.go b/github/actions_runner_groups.go index fad13db6b57..40da3fd5a0b 100644 --- a/github/actions_runner_groups.go +++ b/github/actions_runner_groups.go @@ -151,9 +151,9 @@ func (s *ActionsService) DeleteOrganizationRunnerGroup(ctx context.Context, org // GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#create-a-self-hosted-runner-group-for-an-organization // //meta:operation POST /orgs/{org}/actions/runner-groups -func (s *ActionsService) CreateOrganizationRunnerGroup(ctx context.Context, org string, createReq CreateRunnerGroupRequest) (*RunnerGroup, *Response, error) { +func (s *ActionsService) CreateOrganizationRunnerGroup(ctx context.Context, org string, body CreateRunnerGroupRequest) (*RunnerGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups", org) - req, err := s.client.NewRequest(ctx, "POST", u, createReq) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -172,9 +172,9 @@ func (s *ActionsService) CreateOrganizationRunnerGroup(ctx context.Context, org // GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#update-a-self-hosted-runner-group-for-an-organization // //meta:operation PATCH /orgs/{org}/actions/runner-groups/{runner_group_id} -func (s *ActionsService) UpdateOrganizationRunnerGroup(ctx context.Context, org string, groupID int64, updateReq UpdateRunnerGroupRequest) (*RunnerGroup, *Response, error) { +func (s *ActionsService) UpdateOrganizationRunnerGroup(ctx context.Context, org string, groupID int64, body UpdateRunnerGroupRequest) (*RunnerGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v", org, groupID) - req, err := s.client.NewRequest(ctx, "PATCH", u, updateReq) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -220,10 +220,10 @@ func (s *ActionsService) ListRepositoryAccessRunnerGroup(ctx context.Context, or // GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#set-repository-access-for-a-self-hosted-runner-group-in-an-organization // //meta:operation PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories -func (s *ActionsService) SetRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID int64, ids SetRepoAccessRunnerGroupRequest) (*Response, error) { +func (s *ActionsService) SetRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID int64, body SetRepoAccessRunnerGroupRequest) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/repositories", org, groupID) - req, err := s.client.NewRequest(ctx, "PUT", u, ids) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } @@ -323,10 +323,10 @@ func (s *ActionsService) ListRunnerGroupRunners(ctx context.Context, org string, // GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#set-self-hosted-runners-in-a-group-for-an-organization // //meta:operation PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/runners -func (s *ActionsService) SetRunnerGroupRunners(ctx context.Context, org string, groupID int64, ids SetRunnerGroupRunnersRequest) (*Response, error) { +func (s *ActionsService) SetRunnerGroupRunners(ctx context.Context, org string, groupID int64, body SetRunnerGroupRunnersRequest) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/runners", org, groupID) - req, err := s.client.NewRequest(ctx, "PUT", u, ids) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } diff --git a/github/actions_runners.go b/github/actions_runners.go index 32b35c75f34..02039fc3858 100644 --- a/github/actions_runners.go +++ b/github/actions_runners.go @@ -63,9 +63,9 @@ type JITRunnerConfig struct { // GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-configuration-for-a-just-in-time-runner-for-an-organization // //meta:operation POST /orgs/{org}/actions/runners/generate-jitconfig -func (s *ActionsService) GenerateOrgJITConfig(ctx context.Context, org string, request *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) { +func (s *ActionsService) GenerateOrgJITConfig(ctx context.Context, org string, body *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/generate-jitconfig", org) - req, err := s.client.NewRequest(ctx, "POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -84,9 +84,9 @@ func (s *ActionsService) GenerateOrgJITConfig(ctx context.Context, org string, r // GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-configuration-for-a-just-in-time-runner-for-a-repository // //meta:operation POST /repos/{owner}/{repo}/actions/runners/generate-jitconfig -func (s *ActionsService) GenerateRepoJITConfig(ctx context.Context, owner, repo string, request *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) { +func (s *ActionsService) GenerateRepoJITConfig(ctx context.Context, owner, repo string, body *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/generate-jitconfig", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/actions_secrets.go b/github/actions_secrets.go index 1f5dae4e807..f77b9e7428c 100644 --- a/github/actions_secrets.go +++ b/github/actions_secrets.go @@ -232,8 +232,8 @@ type EncryptedSecret struct { SelectedRepositoryIDs SelectedRepoIDs `json:"selected_repository_ids,omitempty"` } -func (s *ActionsService) putSecret(ctx context.Context, url string, eSecret *EncryptedSecret) (*Response, error) { - req, err := s.client.NewRequest(ctx, "PUT", url, eSecret) +func (s *ActionsService) putSecret(ctx context.Context, url string, body *EncryptedSecret) (*Response, error) { + req, err := s.client.NewRequest(ctx, "PUT", url, body) if err != nil { return nil, err } @@ -246,13 +246,13 @@ func (s *ActionsService) putSecret(ctx context.Context, url string, eSecret *Enc // GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#create-or-update-a-repository-secret // //meta:operation PUT /repos/{owner}/{repo}/actions/secrets/{secret_name} -func (s *ActionsService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, eSecret *EncryptedSecret) (*Response, error) { - if eSecret == nil { +func (s *ActionsService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, body *EncryptedSecret) (*Response, error) { + if body == nil { return nil, errors.New("encrypted secret must be provided") } - url := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, eSecret.Name) - return s.putSecret(ctx, url, eSecret) + url := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, body.Name) + return s.putSecret(ctx, url, body) } // CreateOrUpdateOrgSecret creates or updates an organization secret with an encrypted value. @@ -260,13 +260,13 @@ func (s *ActionsService) CreateOrUpdateRepoSecret(ctx context.Context, owner, re // GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#create-or-update-an-organization-secret // //meta:operation PUT /orgs/{org}/actions/secrets/{secret_name} -func (s *ActionsService) CreateOrUpdateOrgSecret(ctx context.Context, org string, eSecret *EncryptedSecret) (*Response, error) { - if eSecret == nil { +func (s *ActionsService) CreateOrUpdateOrgSecret(ctx context.Context, org string, body *EncryptedSecret) (*Response, error) { + if body == nil { return nil, errors.New("encrypted secret must be provided") } - url := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, eSecret.Name) - return s.putSecret(ctx, url, eSecret) + url := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, body.Name) + return s.putSecret(ctx, url, body) } // CreateOrUpdateEnvSecret creates or updates a single environment secret with an encrypted value. @@ -274,13 +274,13 @@ func (s *ActionsService) CreateOrUpdateOrgSecret(ctx context.Context, org string // GitHub API docs: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#create-or-update-an-environment-secret // //meta:operation PUT /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} -func (s *ActionsService) CreateOrUpdateEnvSecret(ctx context.Context, repoID int, env string, eSecret *EncryptedSecret) (*Response, error) { - if eSecret == nil { +func (s *ActionsService) CreateOrUpdateEnvSecret(ctx context.Context, repoID int, env string, body *EncryptedSecret) (*Response, error) { + if body == nil { return nil, errors.New("encrypted secret must be provided") } - url := fmt.Sprintf("repositories/%v/environments/%v/secrets/%v", repoID, env, eSecret.Name) - return s.putSecret(ctx, url, eSecret) + url := fmt.Sprintf("repositories/%v/environments/%v/secrets/%v", repoID, env, body.Name) + return s.putSecret(ctx, url, body) } func (s *ActionsService) deleteSecret(ctx context.Context, url string) (*Response, error) { diff --git a/github/actions_variables.go b/github/actions_variables.go index f41384e3798..41b60e9e01f 100644 --- a/github/actions_variables.go +++ b/github/actions_variables.go @@ -135,8 +135,8 @@ func (s *ActionsService) GetEnvVariable(ctx context.Context, owner, repo, env, v return s.getVariable(ctx, url) } -func (s *ActionsService) postVariable(ctx context.Context, url string, variable *ActionsVariable) (*Response, error) { - req, err := s.client.NewRequest(ctx, "POST", url, variable) +func (s *ActionsService) postVariable(ctx context.Context, url string, body *ActionsVariable) (*Response, error) { + req, err := s.client.NewRequest(ctx, "POST", url, body) if err != nil { return nil, err } @@ -148,9 +148,9 @@ func (s *ActionsService) postVariable(ctx context.Context, url string, variable // GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#create-a-repository-variable // //meta:operation POST /repos/{owner}/{repo}/actions/variables -func (s *ActionsService) CreateRepoVariable(ctx context.Context, owner, repo string, variable *ActionsVariable) (*Response, error) { +func (s *ActionsService) CreateRepoVariable(ctx context.Context, owner, repo string, body *ActionsVariable) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/actions/variables", owner, repo) - return s.postVariable(ctx, url, variable) + return s.postVariable(ctx, url, body) } // CreateOrgVariable creates an organization variable. @@ -158,9 +158,9 @@ func (s *ActionsService) CreateRepoVariable(ctx context.Context, owner, repo str // GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#create-an-organization-variable // //meta:operation POST /orgs/{org}/actions/variables -func (s *ActionsService) CreateOrgVariable(ctx context.Context, org string, variable *ActionsVariable) (*Response, error) { +func (s *ActionsService) CreateOrgVariable(ctx context.Context, org string, body *ActionsVariable) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/variables", org) - return s.postVariable(ctx, url, variable) + return s.postVariable(ctx, url, body) } // CreateEnvVariable creates an environment variable. @@ -168,13 +168,13 @@ func (s *ActionsService) CreateOrgVariable(ctx context.Context, org string, vari // GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#create-an-environment-variable // //meta:operation POST /repos/{owner}/{repo}/environments/{environment_name}/variables -func (s *ActionsService) CreateEnvVariable(ctx context.Context, owner, repo, env string, variable *ActionsVariable) (*Response, error) { +func (s *ActionsService) CreateEnvVariable(ctx context.Context, owner, repo, env string, body *ActionsVariable) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/environments/%v/variables", owner, repo, env) - return s.postVariable(ctx, url, variable) + return s.postVariable(ctx, url, body) } -func (s *ActionsService) patchVariable(ctx context.Context, url string, variable *ActionsVariable) (*Response, error) { - req, err := s.client.NewRequest(ctx, "PATCH", url, variable) +func (s *ActionsService) patchVariable(ctx context.Context, url string, body *ActionsVariable) (*Response, error) { + req, err := s.client.NewRequest(ctx, "PATCH", url, body) if err != nil { return nil, err } diff --git a/github/actions_workflow_runs.go b/github/actions_workflow_runs.go index 6e46328dfbd..c56fa4df4f8 100644 --- a/github/actions_workflow_runs.go +++ b/github/actions_workflow_runs.go @@ -511,10 +511,10 @@ func (s *ActionsService) GetPendingDeployments(ctx context.Context, owner, repo // GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#review-pending-deployments-for-a-workflow-run // //meta:operation POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments -func (s *ActionsService) PendingDeployments(ctx context.Context, owner, repo string, runID int64, request *PendingDeploymentsRequest) ([]*Deployment, *Response, error) { +func (s *ActionsService) PendingDeployments(ctx context.Context, owner, repo string, runID int64, body *PendingDeploymentsRequest) ([]*Deployment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/pending_deployments", owner, repo, runID) - req, err := s.client.NewRequest(ctx, "POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -534,10 +534,10 @@ func (s *ActionsService) PendingDeployments(ctx context.Context, owner, repo str // GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#review-custom-deployment-protection-rules-for-a-workflow-run // //meta:operation POST /repos/{owner}/{repo}/actions/runs/{run_id}/deployment_protection_rule -func (s *ActionsService) ReviewCustomDeploymentProtectionRule(ctx context.Context, owner, repo string, runID int64, request *ReviewCustomDeploymentProtectionRuleRequest) (*Response, error) { +func (s *ActionsService) ReviewCustomDeploymentProtectionRule(ctx context.Context, owner, repo string, runID int64, body *ReviewCustomDeploymentProtectionRuleRequest) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/deployment_protection_rule", owner, repo, runID) - req, err := s.client.NewRequest(ctx, "POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, err } diff --git a/github/actions_workflows.go b/github/actions_workflows.go index bcd79c5e236..8c2610a4b02 100644 --- a/github/actions_workflows.go +++ b/github/actions_workflows.go @@ -202,10 +202,10 @@ func (s *ActionsService) getWorkflowUsage(ctx context.Context, url string) (*Wor // GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event // //meta:operation POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches -func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, owner, repo string, workflowID int64, event CreateWorkflowDispatchEventRequest) (*WorkflowDispatchRunDetails, *Response, error) { +func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, owner, repo string, workflowID int64, body CreateWorkflowDispatchEventRequest) (*WorkflowDispatchRunDetails, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/dispatches", owner, repo, workflowID) - return s.createWorkflowDispatchEvent(ctx, u, &event) + return s.createWorkflowDispatchEvent(ctx, u, &body) } // CreateWorkflowDispatchEventByFileName manually triggers a GitHub Actions workflow run. @@ -213,14 +213,14 @@ func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, ow // GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event // //meta:operation POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches -func (s *ActionsService) CreateWorkflowDispatchEventByFileName(ctx context.Context, owner, repo, workflowFileName string, event CreateWorkflowDispatchEventRequest) (*WorkflowDispatchRunDetails, *Response, error) { +func (s *ActionsService) CreateWorkflowDispatchEventByFileName(ctx context.Context, owner, repo, workflowFileName string, body CreateWorkflowDispatchEventRequest) (*WorkflowDispatchRunDetails, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/dispatches", owner, repo, workflowFileName) - return s.createWorkflowDispatchEvent(ctx, u, &event) + return s.createWorkflowDispatchEvent(ctx, u, &body) } -func (s *ActionsService) createWorkflowDispatchEvent(ctx context.Context, url string, event *CreateWorkflowDispatchEventRequest) (*WorkflowDispatchRunDetails, *Response, error) { - req, err := s.client.NewRequest(ctx, "POST", url, event) +func (s *ActionsService) createWorkflowDispatchEvent(ctx context.Context, url string, body *CreateWorkflowDispatchEventRequest) (*WorkflowDispatchRunDetails, *Response, error) { + req, err := s.client.NewRequest(ctx, "POST", url, body) if err != nil { return nil, nil, err } diff --git a/github/activity_notifications.go b/github/activity_notifications.go index 95e6cf3d8ad..edd074dd2f5 100644 --- a/github/activity_notifications.go +++ b/github/activity_notifications.go @@ -226,10 +226,10 @@ func (s *ActivityService) GetThreadSubscription(ctx context.Context, id string) // GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#set-a-thread-subscription // //meta:operation PUT /notifications/threads/{thread_id}/subscription -func (s *ActivityService) SetThreadSubscription(ctx context.Context, id string, subscription *Subscription) (*Subscription, *Response, error) { +func (s *ActivityService) SetThreadSubscription(ctx context.Context, id string, body *Subscription) (*Subscription, *Response, error) { u := fmt.Sprintf("notifications/threads/%v/subscription", id) - req, err := s.client.NewRequest(ctx, "PUT", u, subscription) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } diff --git a/github/activity_watching.go b/github/activity_watching.go index 04b64f99cb6..86cb4aa151e 100644 --- a/github/activity_watching.go +++ b/github/activity_watching.go @@ -122,10 +122,10 @@ func (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner, // GitHub API docs: https://docs.github.com/rest/activity/watching?apiVersion=2022-11-28#set-a-repository-subscription // //meta:operation PUT /repos/{owner}/{repo}/subscription -func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, repo string, subscription *Subscription) (*Subscription, *Response, error) { +func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, repo string, body *Subscription) (*Subscription, *Response, error) { u := fmt.Sprintf("repos/%v/%v/subscription", owner, repo) - req, err := s.client.NewRequest(ctx, "PUT", u, subscription) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } diff --git a/github/admin.go b/github/admin.go index b1713d5b993..ef23a95f368 100644 --- a/github/admin.go +++ b/github/admin.go @@ -85,9 +85,9 @@ func (m Enterprise) String() string { // GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user // //meta:operation PATCH /admin/ldap/users/{username}/mapping -func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, mapping *UserLDAPMapping) (*UserLDAPMapping, *Response, error) { +func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, body *UserLDAPMapping) (*UserLDAPMapping, *Response, error) { u := fmt.Sprintf("admin/ldap/users/%v/mapping", user) - req, err := s.client.NewRequest(ctx, "PATCH", u, mapping) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -106,9 +106,9 @@ func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, m // GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team // //meta:operation PATCH /admin/ldap/teams/{team_id}/mapping -func (s *AdminService) UpdateTeamLDAPMapping(ctx context.Context, team int64, mapping *TeamLDAPMapping) (*TeamLDAPMapping, *Response, error) { +func (s *AdminService) UpdateTeamLDAPMapping(ctx context.Context, team int64, body *TeamLDAPMapping) (*TeamLDAPMapping, *Response, error) { u := fmt.Sprintf("admin/ldap/teams/%v/mapping", team) - req, err := s.client.NewRequest(ctx, "PATCH", u, mapping) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/admin_users.go b/github/admin_users.go index d4077694541..9468f077f15 100644 --- a/github/admin_users.go +++ b/github/admin_users.go @@ -23,10 +23,10 @@ type CreateUserRequest struct { // GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/users#create-a-user // //meta:operation POST /admin/users -func (s *AdminService) CreateUser(ctx context.Context, userReq CreateUserRequest) (*User, *Response, error) { +func (s *AdminService) CreateUser(ctx context.Context, body CreateUserRequest) (*User, *Response, error) { u := "admin/users" - req, err := s.client.NewRequest(ctx, "POST", u, userReq) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -98,10 +98,10 @@ type UserAuthorization struct { // GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/users#create-an-impersonation-oauth-token // //meta:operation POST /admin/users/{username}/authorizations -func (s *AdminService) CreateUserImpersonation(ctx context.Context, username string, opts *ImpersonateUserOptions) (*UserAuthorization, *Response, error) { +func (s *AdminService) CreateUserImpersonation(ctx context.Context, username string, body *ImpersonateUserOptions) (*UserAuthorization, *Response, error) { u := fmt.Sprintf("admin/users/%v/authorizations", username) - req, err := s.client.NewRequest(ctx, "POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/apps.go b/github/apps.go index 75844a29ce8..4ba736390ae 100644 --- a/github/apps.go +++ b/github/apps.go @@ -383,10 +383,10 @@ func (s *AppsService) DeleteInstallation(ctx context.Context, id int64) (*Respon // GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#create-an-installation-access-token-for-an-app // //meta:operation POST /app/installations/{installation_id}/access_tokens -func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64, opts *InstallationTokenOptions) (*InstallationToken, *Response, error) { +func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64, body *InstallationTokenOptions) (*InstallationToken, *Response, error) { u := fmt.Sprintf("app/installations/%v/access_tokens", id) - req, err := s.client.NewRequest(ctx, "POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -407,10 +407,10 @@ func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64, opt // GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#create-an-installation-access-token-for-an-app // //meta:operation POST /app/installations/{installation_id}/access_tokens -func (s *AppsService) CreateInstallationTokenListRepos(ctx context.Context, id int64, opts *InstallationTokenListRepoOptions) (*InstallationToken, *Response, error) { +func (s *AppsService) CreateInstallationTokenListRepos(ctx context.Context, id int64, body *InstallationTokenListRepoOptions) (*InstallationToken, *Response, error) { u := fmt.Sprintf("app/installations/%v/access_tokens", id) - req, err := s.client.NewRequest(ctx, "POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/apps_hooks.go b/github/apps_hooks.go index fb9e31134c7..be086f5d2fd 100644 --- a/github/apps_hooks.go +++ b/github/apps_hooks.go @@ -36,8 +36,8 @@ func (s *AppsService) GetHookConfig(ctx context.Context) (*HookConfig, *Response // GitHub API docs: https://docs.github.com/rest/apps/webhooks?apiVersion=2022-11-28#update-a-webhook-configuration-for-an-app // //meta:operation PATCH /app/hook/config -func (s *AppsService) UpdateHookConfig(ctx context.Context, config *HookConfig) (*HookConfig, *Response, error) { - req, err := s.client.NewRequest(ctx, "PATCH", "app/hook/config", config) +func (s *AppsService) UpdateHookConfig(ctx context.Context, body *HookConfig) (*HookConfig, *Response, error) { + req, err := s.client.NewRequest(ctx, "PATCH", "app/hook/config", body) if err != nil { return nil, nil, err } diff --git a/github/authorizations.go b/github/authorizations.go index 1511687aa40..af59f0b3dab 100644 --- a/github/authorizations.go +++ b/github/authorizations.go @@ -260,9 +260,9 @@ func (s *AuthorizationsService) DeleteGrant(ctx context.Context, clientID, acces // GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/users#create-an-impersonation-oauth-token // //meta:operation POST /admin/users/{username}/authorizations -func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, username string, authReq *AuthorizationRequest) (*Authorization, *Response, error) { +func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, username string, body *AuthorizationRequest) (*Authorization, *Response, error) { u := fmt.Sprintf("admin/users/%v/authorizations", username) - req, err := s.client.NewRequest(ctx, "POST", u, authReq) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/checks.go b/github/checks.go index aef9d803381..83a22236987 100644 --- a/github/checks.go +++ b/github/checks.go @@ -171,9 +171,9 @@ type CheckRunAction struct { // GitHub API docs: https://docs.github.com/rest/checks/runs?apiVersion=2022-11-28#create-a-check-run // //meta:operation POST /repos/{owner}/{repo}/check-runs -func (s *ChecksService) CreateCheckRun(ctx context.Context, owner, repo string, opts CreateCheckRunOptions) (*CheckRun, *Response, error) { +func (s *ChecksService) CreateCheckRun(ctx context.Context, owner, repo string, body CreateCheckRunOptions) (*CheckRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-runs", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -206,9 +206,9 @@ type UpdateCheckRunOptions struct { // GitHub API docs: https://docs.github.com/rest/checks/runs?apiVersion=2022-11-28#update-a-check-run // //meta:operation PATCH /repos/{owner}/{repo}/check-runs/{check_run_id} -func (s *ChecksService) UpdateCheckRun(ctx context.Context, owner, repo string, checkRunID int64, opts UpdateCheckRunOptions) (*CheckRun, *Response, error) { +func (s *ChecksService) UpdateCheckRun(ctx context.Context, owner, repo string, checkRunID int64, body UpdateCheckRunOptions) (*CheckRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID) - req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -415,9 +415,9 @@ type PreferenceList struct { // GitHub API docs: https://docs.github.com/rest/checks/suites?apiVersion=2022-11-28#update-repository-preferences-for-check-suites // //meta:operation PATCH /repos/{owner}/{repo}/check-suites/preferences -func (s *ChecksService) SetCheckSuitePreferences(ctx context.Context, owner, repo string, opts CheckSuitePreferenceOptions) (*CheckSuitePreferenceResults, *Response, error) { +func (s *ChecksService) SetCheckSuitePreferences(ctx context.Context, owner, repo string, body CheckSuitePreferenceOptions) (*CheckSuitePreferenceResults, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites/preferences", owner, repo) - req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -444,9 +444,9 @@ type CreateCheckSuiteOptions struct { // GitHub API docs: https://docs.github.com/rest/checks/suites?apiVersion=2022-11-28#create-a-check-suite // //meta:operation POST /repos/{owner}/{repo}/check-suites -func (s *ChecksService) CreateCheckSuite(ctx context.Context, owner, repo string, opts CreateCheckSuiteOptions) (*CheckSuite, *Response, error) { +func (s *ChecksService) CreateCheckSuite(ctx context.Context, owner, repo string, body CreateCheckSuiteOptions) (*CheckSuite, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/code_quality.go b/github/code_quality.go index 339978edd49..43a9efaa7d8 100644 --- a/github/code_quality.go +++ b/github/code_quality.go @@ -71,10 +71,10 @@ func (s *CodeQualityService) GetSetup(ctx context.Context, owner, repo string) ( // GitHub API docs: https://docs.github.com/rest/code-quality/code-quality?apiVersion=2022-11-28#update-a-code-quality-setup-configuration // //meta:operation PATCH /repos/{owner}/{repo}/code-quality/setup -func (s *CodeQualityService) UpdateSetup(ctx context.Context, owner, repo string, req CodeQualityUpdateSetupRequest) (*CodeQualityUpdateSetupResponse, *Response, error) { +func (s *CodeQualityService) UpdateSetup(ctx context.Context, owner, repo string, body CodeQualityUpdateSetupRequest) (*CodeQualityUpdateSetupResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-quality/setup", owner, repo) - request, err := s.client.NewRequest(ctx, "PATCH", u, req) + request, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/code_scanning.go b/github/code_scanning.go index 3aeaa8b7030..0b4e4c1c7b5 100644 --- a/github/code_scanning.go +++ b/github/code_scanning.go @@ -337,10 +337,10 @@ func (s *CodeScanningService) GetAlert(ctx context.Context, owner, repo string, // GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#update-a-code-scanning-alert // //meta:operation PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number} -func (s *CodeScanningService) UpdateAlert(ctx context.Context, owner, repo string, id int64, stateInfo *CodeScanningAlertState) (*Alert, *Response, error) { +func (s *CodeScanningService) UpdateAlert(ctx context.Context, owner, repo string, id int64, body *CodeScanningAlertState) (*Alert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/alerts/%v", owner, repo, id) - req, err := s.client.NewRequest(ctx, "PATCH", u, stateInfo) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -392,10 +392,10 @@ func (s *CodeScanningService) ListAlertInstances(ctx context.Context, owner, rep // GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#upload-an-analysis-as-sarif-data // //meta:operation POST /repos/{owner}/{repo}/code-scanning/sarifs -func (s *CodeScanningService) UploadSarif(ctx context.Context, owner, repo string, sarif *SarifAnalysis) (*SarifID, *Response, error) { +func (s *CodeScanningService) UploadSarif(ctx context.Context, owner, repo string, body *SarifAnalysis) (*SarifID, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/sarifs", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, sarif) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -655,10 +655,10 @@ type UpdateDefaultSetupConfigurationResponse struct { // GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#update-a-code-scanning-default-setup-configuration // //meta:operation PATCH /repos/{owner}/{repo}/code-scanning/default-setup -func (s *CodeScanningService) UpdateDefaultSetupConfiguration(ctx context.Context, owner, repo string, options *UpdateDefaultSetupConfigurationOptions) (*UpdateDefaultSetupConfigurationResponse, *Response, error) { +func (s *CodeScanningService) UpdateDefaultSetupConfiguration(ctx context.Context, owner, repo string, body *UpdateDefaultSetupConfigurationOptions) (*UpdateDefaultSetupConfigurationResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/default-setup", owner, repo) - req, err := s.client.NewRequest(ctx, "PATCH", u, options) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/codespaces.go b/github/codespaces.go index 8a8ad888d61..b3f9097196d 100644 --- a/github/codespaces.go +++ b/github/codespaces.go @@ -273,9 +273,9 @@ type CodespacePermissions struct { // GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#create-a-codespace-in-a-repository // //meta:operation POST /repos/{owner}/{repo}/codespaces -func (s *CodespacesService) CreateInRepo(ctx context.Context, owner, repo string, request *CreateCodespaceOptions) (*Codespace, *Response, error) { +func (s *CodespacesService) CreateInRepo(ctx context.Context, owner, repo string, body *CreateCodespaceOptions) (*Codespace, *Response, error) { u := fmt.Sprintf("repos/%v/%v/codespaces", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -444,9 +444,9 @@ func (s *CodespacesService) CheckPermissions(ctx context.Context, owner, repo, r // GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#create-a-codespace-from-a-pull-request // //meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/codespaces -func (s *CodespacesService) CreateFromPullRequest(ctx context.Context, owner, repo string, pullNumber int, request *CreateCodespaceOptions) (*Codespace, *Response, error) { +func (s *CodespacesService) CreateFromPullRequest(ctx context.Context, owner, repo string, pullNumber int, body *CreateCodespaceOptions) (*Codespace, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%v/codespaces", owner, repo, pullNumber) - req, err := s.client.NewRequest(ctx, "POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -467,9 +467,9 @@ func (s *CodespacesService) CreateFromPullRequest(ctx context.Context, owner, re // GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#create-a-codespace-for-the-authenticated-user // //meta:operation POST /user/codespaces -func (s *CodespacesService) Create(ctx context.Context, opts *CodespaceCreateForUserOptions) (*Codespace, *Response, error) { +func (s *CodespacesService) Create(ctx context.Context, body *CodespaceCreateForUserOptions) (*Codespace, *Response, error) { u := "user/codespaces" - req, err := s.client.NewRequest(ctx, "POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -511,9 +511,9 @@ func (s *CodespacesService) Get(ctx context.Context, codespaceName string) (*Cod // GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#update-a-codespace-for-the-authenticated-user // //meta:operation PATCH /user/codespaces/{codespace_name} -func (s *CodespacesService) Update(ctx context.Context, codespaceName string, opts *UpdateCodespaceOptions) (*Codespace, *Response, error) { +func (s *CodespacesService) Update(ctx context.Context, codespaceName string, body *UpdateCodespaceOptions) (*Codespace, *Response, error) { u := fmt.Sprintf("user/codespaces/%v", codespaceName) - req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -574,9 +574,9 @@ func (s *CodespacesService) GetLatestCodespaceExport(ctx context.Context, codesp // GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#create-a-repository-from-an-unpublished-codespace // //meta:operation POST /user/codespaces/{codespace_name}/publish -func (s *CodespacesService) Publish(ctx context.Context, codespaceName string, opts *PublishCodespaceOptions) (*Codespace, *Response, error) { +func (s *CodespacesService) Publish(ctx context.Context, codespaceName string, body *PublishCodespaceOptions) (*Codespace, *Response, error) { u := fmt.Sprintf("user/codespaces/%v/publish", codespaceName) - req, err := s.client.NewRequest(ctx, "POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/codespaces_orgs.go b/github/codespaces_orgs.go index 176ea8fc98d..429db12b995 100644 --- a/github/codespaces_orgs.go +++ b/github/codespaces_orgs.go @@ -53,9 +53,9 @@ func (s *CodespacesService) ListInOrg(ctx context.Context, org string, opts *Lis // GitHub API docs: https://docs.github.com/rest/codespaces/organizations?apiVersion=2022-11-28#manage-access-control-for-organization-codespaces // //meta:operation PUT /orgs/{org}/codespaces/access -func (s *CodespacesService) SetOrgAccessControl(ctx context.Context, org string, request CodespacesOrgAccessControlRequest) (*Response, error) { +func (s *CodespacesService) SetOrgAccessControl(ctx context.Context, org string, body CodespacesOrgAccessControlRequest) (*Response, error) { u := fmt.Sprintf("orgs/%v/codespaces/access", org) - req, err := s.client.NewRequest(ctx, "PUT", u, request) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } diff --git a/github/codespaces_secrets.go b/github/codespaces_secrets.go index 5ac7848c747..0e5c578a66a 100644 --- a/github/codespaces_secrets.go +++ b/github/codespaces_secrets.go @@ -187,13 +187,13 @@ func (s *CodespacesService) getSecret(ctx context.Context, url string) (*Secret, // GitHub API docs: https://docs.github.com/rest/codespaces/secrets?apiVersion=2022-11-28#create-or-update-a-secret-for-the-authenticated-user // //meta:operation PUT /user/codespaces/secrets/{secret_name} -func (s *CodespacesService) CreateOrUpdateUserSecret(ctx context.Context, eSecret *EncryptedSecret) (*Response, error) { - if eSecret == nil { +func (s *CodespacesService) CreateOrUpdateUserSecret(ctx context.Context, body *EncryptedSecret) (*Response, error) { + if body == nil { return nil, errors.New("encrypted secret must be provided") } - u := fmt.Sprintf("user/codespaces/secrets/%v", eSecret.Name) - return s.createOrUpdateSecret(ctx, u, eSecret) + u := fmt.Sprintf("user/codespaces/secrets/%v", body.Name) + return s.createOrUpdateSecret(ctx, u, body) } // CreateOrUpdateOrgSecret creates or updates an orgs codespace secret @@ -203,13 +203,13 @@ func (s *CodespacesService) CreateOrUpdateUserSecret(ctx context.Context, eSecre // GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets?apiVersion=2022-11-28#create-or-update-an-organization-secret // //meta:operation PUT /orgs/{org}/codespaces/secrets/{secret_name} -func (s *CodespacesService) CreateOrUpdateOrgSecret(ctx context.Context, org string, eSecret *EncryptedSecret) (*Response, error) { - if eSecret == nil { +func (s *CodespacesService) CreateOrUpdateOrgSecret(ctx context.Context, org string, body *EncryptedSecret) (*Response, error) { + if body == nil { return nil, errors.New("encrypted secret must be provided") } - u := fmt.Sprintf("orgs/%v/codespaces/secrets/%v", org, eSecret.Name) - return s.createOrUpdateSecret(ctx, u, eSecret) + u := fmt.Sprintf("orgs/%v/codespaces/secrets/%v", org, body.Name) + return s.createOrUpdateSecret(ctx, u, body) } // CreateOrUpdateRepoSecret creates or updates a repos codespace secret @@ -219,17 +219,17 @@ func (s *CodespacesService) CreateOrUpdateOrgSecret(ctx context.Context, org str // GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets?apiVersion=2022-11-28#create-or-update-a-repository-secret // //meta:operation PUT /repos/{owner}/{repo}/codespaces/secrets/{secret_name} -func (s *CodespacesService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, eSecret *EncryptedSecret) (*Response, error) { - if eSecret == nil { +func (s *CodespacesService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, body *EncryptedSecret) (*Response, error) { + if body == nil { return nil, errors.New("encrypted secret must be provided") } - u := fmt.Sprintf("repos/%v/%v/codespaces/secrets/%v", owner, repo, eSecret.Name) - return s.createOrUpdateSecret(ctx, u, eSecret) + u := fmt.Sprintf("repos/%v/%v/codespaces/secrets/%v", owner, repo, body.Name) + return s.createOrUpdateSecret(ctx, u, body) } -func (s *CodespacesService) createOrUpdateSecret(ctx context.Context, url string, eSecret *EncryptedSecret) (*Response, error) { - req, err := s.client.NewRequest(ctx, "PUT", url, eSecret) +func (s *CodespacesService) createOrUpdateSecret(ctx context.Context, url string, body *EncryptedSecret) (*Response, error) { + req, err := s.client.NewRequest(ctx, "PUT", url, body) if err != nil { return nil, err } diff --git a/github/dependabot_alerts.go b/github/dependabot_alerts.go index dc4445dce17..ceac12e9f8c 100644 --- a/github/dependabot_alerts.go +++ b/github/dependabot_alerts.go @@ -169,9 +169,9 @@ func (s *DependabotService) GetRepoAlert(ctx context.Context, owner, repo string // GitHub API docs: https://docs.github.com/rest/dependabot/alerts?apiVersion=2022-11-28#update-a-dependabot-alert // //meta:operation PATCH /repos/{owner}/{repo}/dependabot/alerts/{alert_number} -func (s *DependabotService) UpdateAlert(ctx context.Context, owner, repo string, number int, stateInfo *DependabotAlertState) (*DependabotAlert, *Response, error) { +func (s *DependabotService) UpdateAlert(ctx context.Context, owner, repo string, number int, body *DependabotAlertState) (*DependabotAlert, *Response, error) { url := fmt.Sprintf("repos/%v/%v/dependabot/alerts/%v", owner, repo, number) - req, err := s.client.NewRequest(ctx, "PATCH", url, stateInfo) + req, err := s.client.NewRequest(ctx, "PATCH", url, body) if err != nil { return nil, nil, err } diff --git a/github/dependabot_secrets.go b/github/dependabot_secrets.go index 75e23ba5b5a..c26a92d02e4 100644 --- a/github/dependabot_secrets.go +++ b/github/dependabot_secrets.go @@ -136,8 +136,8 @@ type DependabotEncryptedSecret struct { SelectedRepositoryIDs DependabotSecretsSelectedRepoIDs `json:"selected_repository_ids,omitempty"` } -func (s *DependabotService) putSecret(ctx context.Context, url string, eSecret *DependabotEncryptedSecret) (*Response, error) { - req, err := s.client.NewRequest(ctx, "PUT", url, eSecret) +func (s *DependabotService) putSecret(ctx context.Context, url string, body *DependabotEncryptedSecret) (*Response, error) { + req, err := s.client.NewRequest(ctx, "PUT", url, body) if err != nil { return nil, err } diff --git a/github/dependency_graph_snapshots.go b/github/dependency_graph_snapshots.go index 9bf920acb2c..7786c36252a 100644 --- a/github/dependency_graph_snapshots.go +++ b/github/dependency_graph_snapshots.go @@ -106,10 +106,10 @@ type DependencyGraphSnapshotCreationData struct { // GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28#create-a-snapshot-of-dependencies-for-a-repository // //meta:operation POST /repos/{owner}/{repo}/dependency-graph/snapshots -func (s *DependencyGraphService) CreateSnapshot(ctx context.Context, owner, repo string, dependencyGraphSnapshot *DependencyGraphSnapshot) (*DependencyGraphSnapshotCreationData, *Response, error) { +func (s *DependencyGraphService) CreateSnapshot(ctx context.Context, owner, repo string, body *DependencyGraphSnapshot) (*DependencyGraphSnapshotCreationData, *Response, error) { url := fmt.Sprintf("repos/%v/%v/dependency-graph/snapshots", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", url, dependencyGraphSnapshot) + req, err := s.client.NewRequest(ctx, "POST", url, body) if err != nil { return nil, nil, err } diff --git a/github/enterprise_actions_hosted_runners.go b/github/enterprise_actions_hosted_runners.go index 08b470b31ae..7dbcc64d607 100644 --- a/github/enterprise_actions_hosted_runners.go +++ b/github/enterprise_actions_hosted_runners.go @@ -41,13 +41,13 @@ func (s *EnterpriseService) ListHostedRunners(ctx context.Context, enterprise st // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#create-a-github-hosted-runner-for-an-enterprise // //meta:operation POST /enterprises/{enterprise}/actions/hosted-runners -func (s *EnterpriseService) CreateHostedRunner(ctx context.Context, enterprise string, request CreateHostedRunnerRequest) (*HostedRunner, *Response, error) { - if err := validateCreateHostedRunnerRequest(&request); err != nil { +func (s *EnterpriseService) CreateHostedRunner(ctx context.Context, enterprise string, body CreateHostedRunnerRequest) (*HostedRunner, *Response, error) { + if err := validateCreateHostedRunnerRequest(&body); err != nil { return nil, nil, fmt.Errorf("validation failed: %w", err) } u := fmt.Sprintf("enterprises/%v/actions/hosted-runners", enterprise) - req, err := s.client.NewRequest(ctx, "POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -192,9 +192,9 @@ func (s *EnterpriseService) GetHostedRunner(ctx context.Context, enterprise stri // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#update-a-github-hosted-runner-for-an-enterprise // //meta:operation PATCH /enterprises/{enterprise}/actions/hosted-runners/{hosted_runner_id} -func (s *EnterpriseService) UpdateHostedRunner(ctx context.Context, enterprise string, runnerID int64, request UpdateHostedRunnerRequest) (*HostedRunner, *Response, error) { +func (s *EnterpriseService) UpdateHostedRunner(ctx context.Context, enterprise string, runnerID int64, body UpdateHostedRunnerRequest) (*HostedRunner, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/%v", enterprise, runnerID) - req, err := s.client.NewRequest(ctx, "PATCH", u, request) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/enterprise_actions_runner_groups.go b/github/enterprise_actions_runner_groups.go index b994814050e..7cf75c33ae3 100644 --- a/github/enterprise_actions_runner_groups.go +++ b/github/enterprise_actions_runner_groups.go @@ -150,9 +150,9 @@ func (s *EnterpriseService) DeleteEnterpriseRunnerGroup(ctx context.Context, ent // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#create-a-self-hosted-runner-group-for-an-enterprise // //meta:operation POST /enterprises/{enterprise}/actions/runner-groups -func (s *EnterpriseService) CreateEnterpriseRunnerGroup(ctx context.Context, enterprise string, createReq CreateEnterpriseRunnerGroupRequest) (*EnterpriseRunnerGroup, *Response, error) { +func (s *EnterpriseService) CreateEnterpriseRunnerGroup(ctx context.Context, enterprise string, body CreateEnterpriseRunnerGroupRequest) (*EnterpriseRunnerGroup, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups", enterprise) - req, err := s.client.NewRequest(ctx, "POST", u, createReq) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -171,9 +171,9 @@ func (s *EnterpriseService) CreateEnterpriseRunnerGroup(ctx context.Context, ent // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#update-a-self-hosted-runner-group-for-an-enterprise // //meta:operation PATCH /enterprises/{enterprise}/actions/runner-groups/{runner_group_id} -func (s *EnterpriseService) UpdateEnterpriseRunnerGroup(ctx context.Context, enterprise string, groupID int64, updateReq UpdateEnterpriseRunnerGroupRequest) (*EnterpriseRunnerGroup, *Response, error) { +func (s *EnterpriseService) UpdateEnterpriseRunnerGroup(ctx context.Context, enterprise string, groupID int64, body UpdateEnterpriseRunnerGroupRequest) (*EnterpriseRunnerGroup, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v", enterprise, groupID) - req, err := s.client.NewRequest(ctx, "PATCH", u, updateReq) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -219,10 +219,10 @@ func (s *EnterpriseService) ListOrganizationAccessRunnerGroup(ctx context.Contex // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#set-organization-access-for-a-self-hosted-runner-group-in-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations -func (s *EnterpriseService) SetOrganizationAccessRunnerGroup(ctx context.Context, enterprise string, groupID int64, ids SetOrgAccessRunnerGroupRequest) (*Response, error) { +func (s *EnterpriseService) SetOrganizationAccessRunnerGroup(ctx context.Context, enterprise string, groupID int64, body SetOrgAccessRunnerGroupRequest) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/organizations", enterprise, groupID) - req, err := s.client.NewRequest(ctx, "PUT", u, ids) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } @@ -296,10 +296,10 @@ func (s *EnterpriseService) ListRunnerGroupRunners(ctx context.Context, enterpri // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#set-self-hosted-runners-in-a-group-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners -func (s *EnterpriseService) SetRunnerGroupRunners(ctx context.Context, enterprise string, groupID int64, ids SetRunnerGroupRunnersRequest) (*Response, error) { +func (s *EnterpriseService) SetRunnerGroupRunners(ctx context.Context, enterprise string, groupID int64, body SetRunnerGroupRunnersRequest) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/runners", enterprise, groupID) - req, err := s.client.NewRequest(ctx, "PUT", u, ids) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } diff --git a/github/enterprise_actions_runners.go b/github/enterprise_actions_runners.go index c98ba62fa5b..92cf735910c 100644 --- a/github/enterprise_actions_runners.go +++ b/github/enterprise_actions_runners.go @@ -36,10 +36,10 @@ func (s *EnterpriseService) ListRunnerApplicationDownloads(ctx context.Context, // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-configuration-for-a-just-in-time-runner-for-an-enterprise // //meta:operation POST /enterprises/{enterprise}/actions/runners/generate-jitconfig -func (s *EnterpriseService) GenerateEnterpriseJITConfig(ctx context.Context, enterprise string, request *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) { +func (s *EnterpriseService) GenerateEnterpriseJITConfig(ctx context.Context, enterprise string, body *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runners/generate-jitconfig", enterprise) - req, err := s.client.NewRequest(ctx, "POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/enterprise_app_installation.go b/github/enterprise_app_installation.go index ae736ecbcd3..9f710b85319 100644 --- a/github/enterprise_app_installation.go +++ b/github/enterprise_app_installation.go @@ -122,9 +122,9 @@ func (s *EnterpriseService) ListAppInstallations(ctx context.Context, enterprise // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations?apiVersion=2022-11-28#install-a-github-app-on-an-enterprise-owned-organization // //meta:operation POST /enterprises/{enterprise}/apps/organizations/{org}/installations -func (s *EnterpriseService) InstallApp(ctx context.Context, enterprise, org string, request InstallAppRequest) (*Installation, *Response, error) { +func (s *EnterpriseService) InstallApp(ctx context.Context, enterprise, org string, body InstallAppRequest) (*Installation, *Response, error) { u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations", enterprise, org) - req, err := s.client.NewRequest(ctx, "POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -209,9 +209,9 @@ func (s *EnterpriseService) ListRepositoriesForOrgAppInstallation(ctx context.Co // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations?apiVersion=2022-11-28#toggle-installation-repository-access-between-selected-and-all-repositories // //meta:operation PATCH /enterprises/{enterprise}/apps/organizations/{org}/installations/{installation_id}/repositories -func (s *EnterpriseService) UpdateAppInstallationRepositories(ctx context.Context, enterprise, org string, installationID int64, opts UpdateAppInstallationRepositoriesRequest) (*Installation, *Response, error) { +func (s *EnterpriseService) UpdateAppInstallationRepositories(ctx context.Context, enterprise, org string, installationID int64, body UpdateAppInstallationRepositoriesRequest) (*Installation, *Response, error) { u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations/%v/repositories", enterprise, org, installationID) - req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -230,9 +230,9 @@ func (s *EnterpriseService) UpdateAppInstallationRepositories(ctx context.Contex // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations?apiVersion=2022-11-28#grant-repository-access-to-an-organization-installation // //meta:operation PATCH /enterprises/{enterprise}/apps/organizations/{org}/installations/{installation_id}/repositories/add -func (s *EnterpriseService) AddRepositoriesToAppInstallation(ctx context.Context, enterprise, org string, installationID int64, opts AppInstallationRepositoriesRequest) ([]*AccessibleRepository, *Response, error) { +func (s *EnterpriseService) AddRepositoriesToAppInstallation(ctx context.Context, enterprise, org string, installationID int64, body AppInstallationRepositoriesRequest) ([]*AccessibleRepository, *Response, error) { u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations/%v/repositories/add", enterprise, org, installationID) - req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -251,9 +251,9 @@ func (s *EnterpriseService) AddRepositoriesToAppInstallation(ctx context.Context // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations?apiVersion=2022-11-28#remove-repository-access-from-an-organization-installation // //meta:operation PATCH /enterprises/{enterprise}/apps/organizations/{org}/installations/{installation_id}/repositories/remove -func (s *EnterpriseService) RemoveRepositoriesFromAppInstallation(ctx context.Context, enterprise, org string, installationID int64, opts AppInstallationRepositoriesRequest) ([]*AccessibleRepository, *Response, error) { +func (s *EnterpriseService) RemoveRepositoriesFromAppInstallation(ctx context.Context, enterprise, org string, installationID int64, body AppInstallationRepositoriesRequest) ([]*AccessibleRepository, *Response, error) { u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations/%v/repositories/remove", enterprise, org, installationID) - req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/enterprise_audit_log_stream.go b/github/enterprise_audit_log_stream.go index 012d297548a..72e377c9d6f 100644 --- a/github/enterprise_audit_log_stream.go +++ b/github/enterprise_audit_log_stream.go @@ -230,10 +230,10 @@ func (s *EnterpriseService) GetAuditLogStream(ctx context.Context, enterprise st // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log?apiVersion=2022-11-28#create-an-audit-log-streaming-configuration-for-an-enterprise // //meta:operation POST /enterprises/{enterprise}/audit-log/streams -func (s *EnterpriseService) CreateAuditLogStream(ctx context.Context, enterprise string, config AuditLogStreamConfig) (*AuditLogStream, *Response, error) { +func (s *EnterpriseService) CreateAuditLogStream(ctx context.Context, enterprise string, body AuditLogStreamConfig) (*AuditLogStream, *Response, error) { u := fmt.Sprintf("enterprises/%v/audit-log/streams", enterprise) - req, err := s.client.NewRequest(ctx, "POST", u, config) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -253,10 +253,10 @@ func (s *EnterpriseService) CreateAuditLogStream(ctx context.Context, enterprise // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log?apiVersion=2022-11-28#update-an-existing-audit-log-stream-configuration // //meta:operation PUT /enterprises/{enterprise}/audit-log/streams/{stream_id} -func (s *EnterpriseService) UpdateAuditLogStream(ctx context.Context, enterprise string, streamID int64, config AuditLogStreamConfig) (*AuditLogStream, *Response, error) { +func (s *EnterpriseService) UpdateAuditLogStream(ctx context.Context, enterprise string, streamID int64, body AuditLogStreamConfig) (*AuditLogStream, *Response, error) { u := fmt.Sprintf("enterprises/%v/audit-log/streams/%v", enterprise, streamID) - req, err := s.client.NewRequest(ctx, "PUT", u, config) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } diff --git a/github/enterprise_billing_cost_centers.go b/github/enterprise_billing_cost_centers.go index da232c3c2de..7893e890cf9 100644 --- a/github/enterprise_billing_cost_centers.go +++ b/github/enterprise_billing_cost_centers.go @@ -105,10 +105,10 @@ func (s *EnterpriseService) ListCostCenters(ctx context.Context, enterprise stri // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/cost-centers?apiVersion=2022-11-28#create-a-new-cost-center // //meta:operation POST /enterprises/{enterprise}/settings/billing/cost-centers -func (s *EnterpriseService) CreateCostCenter(ctx context.Context, enterprise string, costCenter CostCenterRequest) (*CostCenter, *Response, error) { +func (s *EnterpriseService) CreateCostCenter(ctx context.Context, enterprise string, body CostCenterRequest) (*CostCenter, *Response, error) { u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers", enterprise) - req, err := s.client.NewRequest(ctx, "POST", u, costCenter) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -149,10 +149,10 @@ func (s *EnterpriseService) GetCostCenter(ctx context.Context, enterprise, costC // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/cost-centers?apiVersion=2022-11-28#update-a-cost-center-name // //meta:operation PATCH /enterprises/{enterprise}/settings/billing/cost-centers/{cost_center_id} -func (s *EnterpriseService) UpdateCostCenter(ctx context.Context, enterprise, costCenterID string, costCenter CostCenterRequest) (*CostCenter, *Response, error) { +func (s *EnterpriseService) UpdateCostCenter(ctx context.Context, enterprise, costCenterID string, body CostCenterRequest) (*CostCenter, *Response, error) { u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers/%v", enterprise, costCenterID) - req, err := s.client.NewRequest(ctx, "PATCH", u, costCenter) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -193,10 +193,10 @@ func (s *EnterpriseService) DeleteCostCenter(ctx context.Context, enterprise, co // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/cost-centers?apiVersion=2022-11-28#add-resources-to-a-cost-center // //meta:operation POST /enterprises/{enterprise}/settings/billing/cost-centers/{cost_center_id}/resource -func (s *EnterpriseService) AddResourcesToCostCenter(ctx context.Context, enterprise, costCenterID string, resources CostCenterResourceRequest) (*AddResourcesToCostCenterResponse, *Response, error) { +func (s *EnterpriseService) AddResourcesToCostCenter(ctx context.Context, enterprise, costCenterID string, body CostCenterResourceRequest) (*AddResourcesToCostCenterResponse, *Response, error) { u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers/%v/resource", enterprise, costCenterID) - req, err := s.client.NewRequest(ctx, "POST", u, resources) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/enterprise_budgets.go b/github/enterprise_budgets.go index d402671c46c..c0a783d8609 100644 --- a/github/enterprise_budgets.go +++ b/github/enterprise_budgets.go @@ -114,10 +114,10 @@ func (s *EnterpriseService) ListBudgets(ctx context.Context, enterprise string) // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/budgets?apiVersion=2022-11-28#create-a-budget // //meta:operation POST /enterprises/{enterprise}/settings/billing/budgets -func (s *EnterpriseService) CreateBudget(ctx context.Context, enterprise string, budget EnterpriseCreateBudget) (*EnterpriseCreateOrUpdateBudgetResponse, *Response, error) { +func (s *EnterpriseService) CreateBudget(ctx context.Context, enterprise string, body EnterpriseCreateBudget) (*EnterpriseCreateOrUpdateBudgetResponse, *Response, error) { u := fmt.Sprintf("enterprises/%v/settings/billing/budgets", enterprise) - req, err := s.client.NewRequest(ctx, "POST", u, budget) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -158,10 +158,10 @@ func (s *EnterpriseService) GetBudget(ctx context.Context, enterprise, budgetID // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/budgets?apiVersion=2022-11-28#update-a-budget // //meta:operation PATCH /enterprises/{enterprise}/settings/billing/budgets/{budget_id} -func (s *EnterpriseService) UpdateBudget(ctx context.Context, enterprise, budgetID string, budget EnterpriseUpdateBudget) (*EnterpriseCreateOrUpdateBudgetResponse, *Response, error) { +func (s *EnterpriseService) UpdateBudget(ctx context.Context, enterprise, budgetID string, body EnterpriseUpdateBudget) (*EnterpriseCreateOrUpdateBudgetResponse, *Response, error) { u := fmt.Sprintf("enterprises/%v/settings/billing/budgets/%v", enterprise, budgetID) - req, err := s.client.NewRequest(ctx, "PATCH", u, budget) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/enterprise_code_security_and_analysis.go b/github/enterprise_code_security_and_analysis.go index 0c7fdb7031b..af6f5122502 100644 --- a/github/enterprise_code_security_and_analysis.go +++ b/github/enterprise_code_security_and_analysis.go @@ -50,9 +50,9 @@ func (s *EnterpriseService) GetCodeSecurityAndAnalysis(ctx context.Context, ente // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/code-security-and-analysis?apiVersion=2022-11-28#update-code-security-and-analysis-features-for-an-enterprise // //meta:operation PATCH /enterprises/{enterprise}/code_security_and_analysis -func (s *EnterpriseService) UpdateCodeSecurityAndAnalysis(ctx context.Context, enterprise string, settings *EnterpriseSecurityAnalysisSettings) (*Response, error) { +func (s *EnterpriseService) UpdateCodeSecurityAndAnalysis(ctx context.Context, enterprise string, body *EnterpriseSecurityAnalysisSettings) (*Response, error) { u := fmt.Sprintf("enterprises/%v/code_security_and_analysis", enterprise) - req, err := s.client.NewRequest(ctx, "PATCH", u, settings) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, err } diff --git a/github/enterprise_codesecurity_configurations.go b/github/enterprise_codesecurity_configurations.go index 3036cdf6660..85619daad42 100644 --- a/github/enterprise_codesecurity_configurations.go +++ b/github/enterprise_codesecurity_configurations.go @@ -60,10 +60,10 @@ func (s *EnterpriseService) ListCodeSecurityConfigurations(ctx context.Context, // GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#create-a-code-security-configuration-for-an-enterprise // //meta:operation POST /enterprises/{enterprise}/code-security/configurations -func (s *EnterpriseService) CreateCodeSecurityConfiguration(ctx context.Context, enterprise string, config CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { +func (s *EnterpriseService) CreateCodeSecurityConfiguration(ctx context.Context, enterprise string, body CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { u := fmt.Sprintf("enterprises/%v/code-security/configurations", enterprise) - req, err := s.client.NewRequest(ctx, "POST", u, config) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -123,10 +123,10 @@ func (s *EnterpriseService) GetCodeSecurityConfiguration(ctx context.Context, en // GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#update-a-custom-code-security-configuration-for-an-enterprise // //meta:operation PATCH /enterprises/{enterprise}/code-security/configurations/{configuration_id} -func (s *EnterpriseService) UpdateCodeSecurityConfiguration(ctx context.Context, enterprise string, configurationID int64, config CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { +func (s *EnterpriseService) UpdateCodeSecurityConfiguration(ctx context.Context, enterprise string, configurationID int64, body CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v", enterprise, configurationID) - req, err := s.client.NewRequest(ctx, "PATCH", u, config) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/enterprise_manage_ghes_config.go b/github/enterprise_manage_ghes_config.go index 9770d044af3..cc823263ebb 100644 --- a/github/enterprise_manage_ghes_config.go +++ b/github/enterprise_manage_ghes_config.go @@ -460,13 +460,13 @@ func (s *EnterpriseService) Settings(ctx context.Context) (*ConfigSettings, *Res // GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#set-settings // //meta:operation PUT /manage/v1/config/settings -func (s *EnterpriseService) UpdateSettings(ctx context.Context, opts *ConfigSettings) (*Response, error) { +func (s *EnterpriseService) UpdateSettings(ctx context.Context, body *ConfigSettings) (*Response, error) { u := "manage/v1/config/settings" - if opts == nil { + if body == nil { return nil, errors.New("opts should not be nil") } - req, err := s.client.NewRequest(ctx, "PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } @@ -479,9 +479,9 @@ func (s *EnterpriseService) UpdateSettings(ctx context.Context, opts *ConfigSett // GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#trigger-a-ghe-config-apply-run // //meta:operation POST /manage/v1/config/apply -func (s *EnterpriseService) ConfigApply(ctx context.Context, opts *ConfigApplyOptions) (*ConfigApplyOptions, *Response, error) { +func (s *EnterpriseService) ConfigApply(ctx context.Context, body *ConfigApplyOptions) (*ConfigApplyOptions, *Response, error) { u := "manage/v1/config/apply" - req, err := s.client.NewRequest(ctx, "POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/enterprise_manage_ghes_maintenance.go b/github/enterprise_manage_ghes_maintenance.go index 3ee9369b06e..59a815c3615 100644 --- a/github/enterprise_manage_ghes_maintenance.go +++ b/github/enterprise_manage_ghes_maintenance.go @@ -74,12 +74,12 @@ func (s *EnterpriseService) GetMaintenanceStatus(ctx context.Context, opts *Node // GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/manage-ghes#set-the-status-of-maintenance-mode // //meta:operation POST /manage/v1/maintenance -func (s *EnterpriseService) CreateMaintenance(ctx context.Context, enable bool, opts *MaintenanceOptions) ([]*MaintenanceOperationStatus, *Response, error) { +func (s *EnterpriseService) CreateMaintenance(ctx context.Context, enable bool, body *MaintenanceOptions) ([]*MaintenanceOperationStatus, *Response, error) { u := "manage/v1/maintenance" - opts.Enabled = enable + body.Enabled = enable - req, err := s.client.NewRequest(ctx, "POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/enterprise_network_configurations.go b/github/enterprise_network_configurations.go index eaf3f05b281..5a87efdb69b 100644 --- a/github/enterprise_network_configurations.go +++ b/github/enterprise_network_configurations.go @@ -41,13 +41,13 @@ func (s *EnterpriseService) ListEnterpriseNetworkConfigurations(ctx context.Cont // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations?apiVersion=2022-11-28#create-a-hosted-compute-network-configuration-for-an-enterprise // //meta:operation POST /enterprises/{enterprise}/network-configurations -func (s *EnterpriseService) CreateEnterpriseNetworkConfiguration(ctx context.Context, enterprise string, createReq NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { - if err := validateNetworkConfigurationRequest(createReq); err != nil { +func (s *EnterpriseService) CreateEnterpriseNetworkConfiguration(ctx context.Context, enterprise string, body NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { + if err := validateNetworkConfigurationRequest(body); err != nil { return nil, nil, fmt.Errorf("validation failed: %w", err) } u := fmt.Sprintf("enterprises/%v/network-configurations", enterprise) - req, err := s.client.NewRequest(ctx, "POST", u, createReq) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -87,13 +87,13 @@ func (s *EnterpriseService) GetEnterpriseNetworkConfiguration(ctx context.Contex // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations?apiVersion=2022-11-28#update-a-hosted-compute-network-configuration-for-an-enterprise // //meta:operation PATCH /enterprises/{enterprise}/network-configurations/{network_configuration_id} -func (s *EnterpriseService) UpdateEnterpriseNetworkConfiguration(ctx context.Context, enterprise, networkID string, updateReq NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { - if err := validateNetworkConfigurationRequest(updateReq); err != nil { +func (s *EnterpriseService) UpdateEnterpriseNetworkConfiguration(ctx context.Context, enterprise, networkID string, body NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { + if err := validateNetworkConfigurationRequest(body); err != nil { return nil, nil, fmt.Errorf("validation failed: %w", err) } u := fmt.Sprintf("enterprises/%v/network-configurations/%v", enterprise, networkID) - req, err := s.client.NewRequest(ctx, "PATCH", u, updateReq) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/enterprise_organization_properties.go b/github/enterprise_organization_properties.go index fcd78209444..8468b151034 100644 --- a/github/enterprise_organization_properties.go +++ b/github/enterprise_organization_properties.go @@ -62,9 +62,9 @@ func (s *EnterpriseService) GetOrganizationCustomPropertySchema(ctx context.Cont // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs?apiVersion=2022-11-28#create-or-update-organization-custom-property-definitions-on-an-enterprise // //meta:operation PATCH /enterprises/{enterprise}/org-properties/schema -func (s *EnterpriseService) CreateOrUpdateOrganizationCustomPropertySchema(ctx context.Context, enterprise string, schema EnterpriseCustomPropertySchema) (*Response, error) { +func (s *EnterpriseService) CreateOrUpdateOrganizationCustomPropertySchema(ctx context.Context, enterprise string, body EnterpriseCustomPropertySchema) (*Response, error) { u := fmt.Sprintf("enterprises/%v/org-properties/schema", enterprise) - req, err := s.client.NewRequest(ctx, "PATCH", u, schema) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, err } @@ -104,9 +104,9 @@ func (s *EnterpriseService) GetOrganizationCustomProperty(ctx context.Context, e // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs?apiVersion=2022-11-28#create-or-update-an-organization-custom-property-definition-on-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/org-properties/schema/{custom_property_name} -func (s *EnterpriseService) CreateOrUpdateOrganizationCustomProperty(ctx context.Context, enterprise, customPropertyName string, property CustomProperty) (*Response, error) { +func (s *EnterpriseService) CreateOrUpdateOrganizationCustomProperty(ctx context.Context, enterprise, customPropertyName string, body CustomProperty) (*Response, error) { u := fmt.Sprintf("enterprises/%v/org-properties/schema/%v", enterprise, customPropertyName) - req, err := s.client.NewRequest(ctx, "PUT", u, property) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } @@ -173,9 +173,9 @@ func (s *EnterpriseService) ListOrganizationCustomPropertyValues(ctx context.Con // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs?apiVersion=2022-11-28#create-or-update-custom-property-values-for-organizations-in-an-enterprise // //meta:operation PATCH /enterprises/{enterprise}/org-properties/values -func (s *EnterpriseService) CreateOrUpdateOrganizationCustomPropertyValues(ctx context.Context, enterprise string, values EnterpriseCustomPropertyValuesRequest) (*Response, error) { +func (s *EnterpriseService) CreateOrUpdateOrganizationCustomPropertyValues(ctx context.Context, enterprise string, body EnterpriseCustomPropertyValuesRequest) (*Response, error) { u := fmt.Sprintf("enterprises/%v/org-properties/values", enterprise) - req, err := s.client.NewRequest(ctx, "PATCH", u, values) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, err } diff --git a/github/enterprise_properties.go b/github/enterprise_properties.go index 926cb6e2ff1..f8c53b6ea49 100644 --- a/github/enterprise_properties.go +++ b/github/enterprise_properties.go @@ -87,10 +87,10 @@ func (s *EnterpriseService) GetCustomProperty(ctx context.Context, enterprise, c // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties?apiVersion=2022-11-28#create-or-update-a-custom-property-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/properties/schema/{custom_property_name} -func (s *EnterpriseService) CreateOrUpdateCustomProperty(ctx context.Context, enterprise, customPropertyName string, property *CustomProperty) (*CustomProperty, *Response, error) { +func (s *EnterpriseService) CreateOrUpdateCustomProperty(ctx context.Context, enterprise, customPropertyName string, body *CustomProperty) (*CustomProperty, *Response, error) { u := fmt.Sprintf("enterprises/%v/properties/schema/%v", enterprise, customPropertyName) - req, err := s.client.NewRequest(ctx, "PUT", u, property) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } diff --git a/github/enterprise_rules.go b/github/enterprise_rules.go index 401ad94e774..b89567a344a 100644 --- a/github/enterprise_rules.go +++ b/github/enterprise_rules.go @@ -15,10 +15,10 @@ import ( // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules?apiVersion=2022-11-28#create-an-enterprise-repository-ruleset // //meta:operation POST /enterprises/{enterprise}/rulesets -func (s *EnterpriseService) CreateRepositoryRuleset(ctx context.Context, enterprise string, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { +func (s *EnterpriseService) CreateRepositoryRuleset(ctx context.Context, enterprise string, body RepositoryRuleset) (*RepositoryRuleset, *Response, error) { u := fmt.Sprintf("enterprises/%v/rulesets", enterprise) - req, err := s.client.NewRequest(ctx, "POST", u, ruleset) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -59,10 +59,10 @@ func (s *EnterpriseService) GetRepositoryRuleset(ctx context.Context, enterprise // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules?apiVersion=2022-11-28#update-an-enterprise-repository-ruleset // //meta:operation PUT /enterprises/{enterprise}/rulesets/{ruleset_id} -func (s *EnterpriseService) UpdateRepositoryRuleset(ctx context.Context, enterprise string, rulesetID int64, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { +func (s *EnterpriseService) UpdateRepositoryRuleset(ctx context.Context, enterprise string, rulesetID int64, body RepositoryRuleset) (*RepositoryRuleset, *Response, error) { u := fmt.Sprintf("enterprises/%v/rulesets/%v", enterprise, rulesetID) - req, err := s.client.NewRequest(ctx, "PUT", u, ruleset) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } diff --git a/github/enterprise_scim.go b/github/enterprise_scim.go index acc5d2e4f2d..674c9c33f61 100644 --- a/github/enterprise_scim.go +++ b/github/enterprise_scim.go @@ -239,9 +239,9 @@ func (s *EnterpriseService) ListProvisionedSCIMUsers(ctx context.Context, enterp // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#set-scim-information-for-a-provisioned-enterprise-group // //meta:operation PUT /scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} -func (s *EnterpriseService) SetProvisionedSCIMGroup(ctx context.Context, enterprise, scimGroupID string, group SCIMEnterpriseGroupAttributes) (*SCIMEnterpriseGroupAttributes, *Response, error) { +func (s *EnterpriseService) SetProvisionedSCIMGroup(ctx context.Context, enterprise, scimGroupID string, body SCIMEnterpriseGroupAttributes) (*SCIMEnterpriseGroupAttributes, *Response, error) { u := fmt.Sprintf("scim/v2/enterprises/%v/Groups/%v", enterprise, scimGroupID) - req, err := s.client.NewRequest(ctx, "PUT", u, group) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } @@ -267,9 +267,9 @@ func (s *EnterpriseService) SetProvisionedSCIMGroup(ctx context.Context, enterpr // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#set-scim-information-for-a-provisioned-enterprise-user // //meta:operation PUT /scim/v2/enterprises/{enterprise}/Users/{scim_user_id} -func (s *EnterpriseService) SetProvisionedSCIMUser(ctx context.Context, enterprise, scimUserID string, user SCIMEnterpriseUserAttributes) (*SCIMEnterpriseUserAttributes, *Response, error) { +func (s *EnterpriseService) SetProvisionedSCIMUser(ctx context.Context, enterprise, scimUserID string, body SCIMEnterpriseUserAttributes) (*SCIMEnterpriseUserAttributes, *Response, error) { u := fmt.Sprintf("scim/v2/enterprises/%v/Users/%v", enterprise, scimUserID) - req, err := s.client.NewRequest(ctx, "PUT", u, user) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } @@ -297,9 +297,9 @@ func (s *EnterpriseService) SetProvisionedSCIMUser(ctx context.Context, enterpri // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#update-an-attribute-for-a-scim-enterprise-group // //meta:operation PATCH /scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} -func (s *EnterpriseService) UpdateSCIMGroupAttribute(ctx context.Context, enterprise, scimGroupID string, attribute SCIMEnterpriseAttribute) (*SCIMEnterpriseGroupAttributes, *Response, error) { +func (s *EnterpriseService) UpdateSCIMGroupAttribute(ctx context.Context, enterprise, scimGroupID string, body SCIMEnterpriseAttribute) (*SCIMEnterpriseGroupAttributes, *Response, error) { u := fmt.Sprintf("scim/v2/enterprises/%v/Groups/%v", enterprise, scimGroupID) - req, err := s.client.NewRequest(ctx, "PATCH", u, attribute) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -329,9 +329,9 @@ func (s *EnterpriseService) UpdateSCIMGroupAttribute(ctx context.Context, enterp // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#update-an-attribute-for-a-scim-enterprise-user // //meta:operation PATCH /scim/v2/enterprises/{enterprise}/Users/{scim_user_id} -func (s *EnterpriseService) UpdateSCIMUserAttribute(ctx context.Context, enterprise, scimUserID string, attribute SCIMEnterpriseAttribute) (*SCIMEnterpriseUserAttributes, *Response, error) { +func (s *EnterpriseService) UpdateSCIMUserAttribute(ctx context.Context, enterprise, scimUserID string, body SCIMEnterpriseAttribute) (*SCIMEnterpriseUserAttributes, *Response, error) { u := fmt.Sprintf("scim/v2/enterprises/%v/Users/%v", enterprise, scimUserID) - req, err := s.client.NewRequest(ctx, "PATCH", u, attribute) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -351,9 +351,9 @@ func (s *EnterpriseService) UpdateSCIMUserAttribute(ctx context.Context, enterpr // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#provision-a-scim-enterprise-group // //meta:operation POST /scim/v2/enterprises/{enterprise}/Groups -func (s *EnterpriseService) ProvisionSCIMGroup(ctx context.Context, enterprise string, group SCIMEnterpriseGroupAttributes) (*SCIMEnterpriseGroupAttributes, *Response, error) { +func (s *EnterpriseService) ProvisionSCIMGroup(ctx context.Context, enterprise string, body SCIMEnterpriseGroupAttributes) (*SCIMEnterpriseGroupAttributes, *Response, error) { u := fmt.Sprintf("scim/v2/enterprises/%v/Groups", enterprise) - req, err := s.client.NewRequest(ctx, "POST", u, group) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -373,9 +373,9 @@ func (s *EnterpriseService) ProvisionSCIMGroup(ctx context.Context, enterprise s // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#provision-a-scim-enterprise-user // //meta:operation POST /scim/v2/enterprises/{enterprise}/Users -func (s *EnterpriseService) ProvisionSCIMUser(ctx context.Context, enterprise string, user SCIMEnterpriseUserAttributes) (*SCIMEnterpriseUserAttributes, *Response, error) { +func (s *EnterpriseService) ProvisionSCIMUser(ctx context.Context, enterprise string, body SCIMEnterpriseUserAttributes) (*SCIMEnterpriseUserAttributes, *Response, error) { u := fmt.Sprintf("scim/v2/enterprises/%v/Users", enterprise) - req, err := s.client.NewRequest(ctx, "POST", u, user) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/enterprise_team.go b/github/enterprise_team.go index 4f267b61a70..fde014d7a39 100644 --- a/github/enterprise_team.go +++ b/github/enterprise_team.go @@ -69,10 +69,10 @@ func (s *EnterpriseService) ListTeams(ctx context.Context, enterprise string, op // GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-teams?apiVersion=2022-11-28#create-an-enterprise-team // //meta:operation POST /enterprises/{enterprise}/teams -func (s *EnterpriseService) CreateTeam(ctx context.Context, enterprise string, team EnterpriseTeamCreateOrUpdateRequest) (*EnterpriseTeam, *Response, error) { +func (s *EnterpriseService) CreateTeam(ctx context.Context, enterprise string, body EnterpriseTeamCreateOrUpdateRequest) (*EnterpriseTeam, *Response, error) { u := fmt.Sprintf("enterprises/%v/teams", enterprise) - req, err := s.client.NewRequest(ctx, "POST", u, team) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -113,10 +113,10 @@ func (s *EnterpriseService) GetTeam(ctx context.Context, enterprise, teamSlug st // GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-teams?apiVersion=2022-11-28#update-an-enterprise-team // //meta:operation PATCH /enterprises/{enterprise}/teams/{team_slug} -func (s *EnterpriseService) UpdateTeam(ctx context.Context, enterprise, teamSlug string, team EnterpriseTeamCreateOrUpdateRequest) (*EnterpriseTeam, *Response, error) { +func (s *EnterpriseService) UpdateTeam(ctx context.Context, enterprise, teamSlug string, body EnterpriseTeamCreateOrUpdateRequest) (*EnterpriseTeam, *Response, error) { u := fmt.Sprintf("enterprises/%v/teams/%v", enterprise, teamSlug) - req, err := s.client.NewRequest(ctx, "PATCH", u, team) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/gists.go b/github/gists.go index 3994ea1829b..bd8553f9745 100644 --- a/github/gists.go +++ b/github/gists.go @@ -225,9 +225,9 @@ func (s *GistsService) GetRevision(ctx context.Context, id, sha string) (*Gist, // GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#create-a-gist // //meta:operation POST /gists -func (s *GistsService) Create(ctx context.Context, gist *Gist) (*Gist, *Response, error) { +func (s *GistsService) Create(ctx context.Context, body *Gist) (*Gist, *Response, error) { u := "gists" - req, err := s.client.NewRequest(ctx, "POST", u, gist) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -246,9 +246,9 @@ func (s *GistsService) Create(ctx context.Context, gist *Gist) (*Gist, *Response // GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#update-a-gist // //meta:operation PATCH /gists/{gist_id} -func (s *GistsService) Edit(ctx context.Context, id string, gist *Gist) (*Gist, *Response, error) { +func (s *GistsService) Edit(ctx context.Context, id string, body *Gist) (*Gist, *Response, error) { u := fmt.Sprintf("gists/%v", id) - req, err := s.client.NewRequest(ctx, "PATCH", u, gist) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/gists_comments.go b/github/gists_comments.go index dc3082cf0e4..27f0fa1d7a3 100644 --- a/github/gists_comments.go +++ b/github/gists_comments.go @@ -75,9 +75,9 @@ func (s *GistsService) GetComment(ctx context.Context, gistID string, commentID // GitHub API docs: https://docs.github.com/rest/gists/comments?apiVersion=2022-11-28#create-a-gist-comment // //meta:operation POST /gists/{gist_id}/comments -func (s *GistsService) CreateComment(ctx context.Context, gistID string, comment *GistComment) (*GistComment, *Response, error) { +func (s *GistsService) CreateComment(ctx context.Context, gistID string, body *GistComment) (*GistComment, *Response, error) { u := fmt.Sprintf("gists/%v/comments", gistID) - req, err := s.client.NewRequest(ctx, "POST", u, comment) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -96,9 +96,9 @@ func (s *GistsService) CreateComment(ctx context.Context, gistID string, comment // GitHub API docs: https://docs.github.com/rest/gists/comments?apiVersion=2022-11-28#update-a-gist-comment // //meta:operation PATCH /gists/{gist_id}/comments/{comment_id} -func (s *GistsService) EditComment(ctx context.Context, gistID string, commentID int64, comment *GistComment) (*GistComment, *Response, error) { +func (s *GistsService) EditComment(ctx context.Context, gistID string, commentID int64, body *GistComment) (*GistComment, *Response, error) { u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID) - req, err := s.client.NewRequest(ctx, "PATCH", u, comment) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/git_blobs.go b/github/git_blobs.go index cbba9bd7920..1db906df005 100644 --- a/github/git_blobs.go +++ b/github/git_blobs.go @@ -71,9 +71,9 @@ func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([ // GitHub API docs: https://docs.github.com/rest/git/blobs?apiVersion=2022-11-28#create-a-blob // //meta:operation POST /repos/{owner}/{repo}/git/blobs -func (s *GitService) CreateBlob(ctx context.Context, owner, repo string, blob Blob) (*Blob, *Response, error) { +func (s *GitService) CreateBlob(ctx context.Context, owner, repo string, body Blob) (*Blob, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/blobs", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, blob) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/git_refs.go b/github/git_refs.go index 36dc5293764..81561a1f8a2 100644 --- a/github/git_refs.go +++ b/github/git_refs.go @@ -113,20 +113,20 @@ func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo, ref stri // GitHub API docs: https://docs.github.com/rest/git/refs?apiVersion=2022-11-28#create-a-reference // //meta:operation POST /repos/{owner}/{repo}/git/refs -func (s *GitService) CreateRef(ctx context.Context, owner, repo string, ref CreateRef) (*Reference, *Response, error) { - if ref.Ref == "" { +func (s *GitService) CreateRef(ctx context.Context, owner, repo string, body CreateRef) (*Reference, *Response, error) { + if body.Ref == "" { return nil, nil, errors.New("ref must be provided") } - if ref.SHA == "" { + if body.SHA == "" { return nil, nil, errors.New("sha must be provided") } // ensure the 'refs/' prefix is present - ref.Ref = "refs/" + strings.TrimPrefix(ref.Ref, "refs/") + body.Ref = "refs/" + strings.TrimPrefix(body.Ref, "refs/") u := fmt.Sprintf("repos/%v/%v/git/refs", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, ref) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -145,18 +145,18 @@ func (s *GitService) CreateRef(ctx context.Context, owner, repo string, ref Crea // GitHub API docs: https://docs.github.com/rest/git/refs?apiVersion=2022-11-28#update-a-reference // //meta:operation PATCH /repos/{owner}/{repo}/git/refs/{ref} -func (s *GitService) UpdateRef(ctx context.Context, owner, repo, ref string, updateRef UpdateRef) (*Reference, *Response, error) { +func (s *GitService) UpdateRef(ctx context.Context, owner, repo, ref string, body UpdateRef) (*Reference, *Response, error) { if ref == "" { return nil, nil, errors.New("ref must be provided") } - if updateRef.SHA == "" { + if body.SHA == "" { return nil, nil, errors.New("sha must be provided") } refPath := strings.TrimPrefix(ref, "refs/") u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, refURLEscape(refPath)) - req, err := s.client.NewRequest(ctx, "PATCH", u, updateRef) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/git_tags.go b/github/git_tags.go index 13a86a3693e..8c90b7f9d82 100644 --- a/github/git_tags.go +++ b/github/git_tags.go @@ -57,10 +57,10 @@ func (s *GitService) GetTag(ctx context.Context, owner, repo, sha string) (*Tag, // GitHub API docs: https://docs.github.com/rest/git/tags?apiVersion=2022-11-28#create-a-tag-object // //meta:operation POST /repos/{owner}/{repo}/git/tags -func (s *GitService) CreateTag(ctx context.Context, owner, repo string, tag CreateTag) (*Tag, *Response, error) { +func (s *GitService) CreateTag(ctx context.Context, owner, repo string, body CreateTag) (*Tag, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/tags", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, tag) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/issue_import.go b/github/issue_import.go index 1907f02f12b..9916eb6fa17 100644 --- a/github/issue_import.go +++ b/github/issue_import.go @@ -74,9 +74,9 @@ type IssueImportError struct { // GitHub API docs: https://gist.github.com/jonmagic/5282384165e0f86ef105#start-an-issue-import // //meta:operation POST /repos/{owner}/{repo}/import/issues -func (s *IssueImportService) Create(ctx context.Context, owner, repo string, issue *IssueImportRequest) (*IssueImportResponse, *Response, error) { +func (s *IssueImportService) Create(ctx context.Context, owner, repo string, body *IssueImportRequest) (*IssueImportResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/issues", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, issue) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/issues.go b/github/issues.go index bea89912b5a..14387c0acfa 100644 --- a/github/issues.go +++ b/github/issues.go @@ -439,9 +439,9 @@ func (s *IssuesService) Get(ctx context.Context, owner, repo string, number int) // GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#create-an-issue // //meta:operation POST /repos/{owner}/{repo}/issues -func (s *IssuesService) Create(ctx context.Context, owner, repo string, issue *IssueRequest) (*Issue, *Response, error) { +func (s *IssuesService) Create(ctx context.Context, owner, repo string, body *IssueRequest) (*Issue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, issue) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -460,9 +460,9 @@ func (s *IssuesService) Create(ctx context.Context, owner, repo string, issue *I // GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#update-an-issue // //meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number} -func (s *IssuesService) Edit(ctx context.Context, owner, repo string, number int, issue *IssueRequest) (*Issue, *Response, error) { +func (s *IssuesService) Edit(ctx context.Context, owner, repo string, number int, body *IssueRequest) (*Issue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v", owner, repo, number) - req, err := s.client.NewRequest(ctx, "PATCH", u, issue) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -515,9 +515,9 @@ type LockIssueOptions struct { // GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#lock-an-issue // //meta:operation PUT /repos/{owner}/{repo}/issues/{issue_number}/lock -func (s *IssuesService) Lock(ctx context.Context, owner, repo string, number int, opts *LockIssueOptions) (*Response, error) { +func (s *IssuesService) Lock(ctx context.Context, owner, repo string, number int, body *LockIssueOptions) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/lock", owner, repo, number) - req, err := s.client.NewRequest(ctx, "PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } diff --git a/github/issues_comments.go b/github/issues_comments.go index f7ab4b80e33..453ad70ad97 100644 --- a/github/issues_comments.go +++ b/github/issues_comments.go @@ -117,9 +117,9 @@ func (s *IssuesService) GetComment(ctx context.Context, owner, repo string, comm // GitHub API docs: https://docs.github.com/rest/issues/comments?apiVersion=2022-11-28#create-an-issue-comment // //meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/comments -func (s *IssuesService) CreateComment(ctx context.Context, owner, repo string, number int, comment *IssueComment) (*IssueComment, *Response, error) { +func (s *IssuesService) CreateComment(ctx context.Context, owner, repo string, number int, body *IssueComment) (*IssueComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/comments", owner, repo, number) - req, err := s.client.NewRequest(ctx, "POST", u, comment) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -138,9 +138,9 @@ func (s *IssuesService) CreateComment(ctx context.Context, owner, repo string, n // GitHub API docs: https://docs.github.com/rest/issues/comments?apiVersion=2022-11-28#update-an-issue-comment // //meta:operation PATCH /repos/{owner}/{repo}/issues/comments/{comment_id} -func (s *IssuesService) EditComment(ctx context.Context, owner, repo string, commentID int64, comment *IssueComment) (*IssueComment, *Response, error) { +func (s *IssuesService) EditComment(ctx context.Context, owner, repo string, commentID int64, body *IssueComment) (*IssueComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/comments/%v", owner, repo, commentID) - req, err := s.client.NewRequest(ctx, "PATCH", u, comment) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/issues_labels.go b/github/issues_labels.go index c334ed660e9..2f4082ee3d3 100644 --- a/github/issues_labels.go +++ b/github/issues_labels.go @@ -77,9 +77,9 @@ func (s *IssuesService) GetLabel(ctx context.Context, owner, repo, name string) // GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#create-a-label // //meta:operation POST /repos/{owner}/{repo}/labels -func (s *IssuesService) CreateLabel(ctx context.Context, owner, repo string, label *Label) (*Label, *Response, error) { +func (s *IssuesService) CreateLabel(ctx context.Context, owner, repo string, body *Label) (*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/labels", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, label) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -98,9 +98,9 @@ func (s *IssuesService) CreateLabel(ctx context.Context, owner, repo string, lab // GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#update-a-label // //meta:operation PATCH /repos/{owner}/{repo}/labels/{name} -func (s *IssuesService) EditLabel(ctx context.Context, owner, repo, name string, label *Label) (*Label, *Response, error) { +func (s *IssuesService) EditLabel(ctx context.Context, owner, repo, name string, body *Label) (*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) - req, err := s.client.NewRequest(ctx, "PATCH", u, label) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -159,9 +159,9 @@ func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner, repo strin // GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#add-labels-to-an-issue // //meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/labels -func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner, repo string, number int, labels []string) ([]*Label, *Response, error) { +func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner, repo string, number int, body []string) ([]*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/labels", owner, repo, number) - req, err := s.client.NewRequest(ctx, "POST", u, labels) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -195,9 +195,9 @@ func (s *IssuesService) RemoveLabelForIssue(ctx context.Context, owner, repo str // GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#set-labels-for-an-issue // //meta:operation PUT /repos/{owner}/{repo}/issues/{issue_number}/labels -func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner, repo string, number int, labels []string) ([]*Label, *Response, error) { +func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner, repo string, number int, body []string) ([]*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/labels", owner, repo, number) - req, err := s.client.NewRequest(ctx, "PUT", u, labels) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } diff --git a/github/issues_milestones.go b/github/issues_milestones.go index 9365745de0f..1b188cff2ed 100644 --- a/github/issues_milestones.go +++ b/github/issues_milestones.go @@ -104,9 +104,9 @@ func (s *IssuesService) GetMilestone(ctx context.Context, owner, repo string, nu // GitHub API docs: https://docs.github.com/rest/issues/milestones?apiVersion=2022-11-28#create-a-milestone // //meta:operation POST /repos/{owner}/{repo}/milestones -func (s *IssuesService) CreateMilestone(ctx context.Context, owner, repo string, milestone *Milestone) (*Milestone, *Response, error) { +func (s *IssuesService) CreateMilestone(ctx context.Context, owner, repo string, body *Milestone) (*Milestone, *Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, milestone) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -125,9 +125,9 @@ func (s *IssuesService) CreateMilestone(ctx context.Context, owner, repo string, // GitHub API docs: https://docs.github.com/rest/issues/milestones?apiVersion=2022-11-28#update-a-milestone // //meta:operation PATCH /repos/{owner}/{repo}/milestones/{milestone_number} -func (s *IssuesService) EditMilestone(ctx context.Context, owner, repo string, number int, milestone *Milestone) (*Milestone, *Response, error) { +func (s *IssuesService) EditMilestone(ctx context.Context, owner, repo string, number int, body *Milestone) (*Milestone, *Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones/%v", owner, repo, number) - req, err := s.client.NewRequest(ctx, "PATCH", u, milestone) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/migrations_source_import.go b/github/migrations_source_import.go index 5ae9b5a1995..4454d6cc610 100644 --- a/github/migrations_source_import.go +++ b/github/migrations_source_import.go @@ -151,9 +151,9 @@ func (f LargeFile) String() string { // GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#start-an-import // //meta:operation PUT /repos/{owner}/{repo}/import -func (s *MigrationService) StartImport(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) { +func (s *MigrationService) StartImport(ctx context.Context, owner, repo string, body *Import) (*Import, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import", owner, repo) - req, err := s.client.NewRequest(ctx, "PUT", u, in) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } @@ -197,9 +197,9 @@ func (s *MigrationService) ImportProgress(ctx context.Context, owner, repo strin // GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#update-an-import // //meta:operation PATCH /repos/{owner}/{repo}/import -func (s *MigrationService) UpdateImport(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) { +func (s *MigrationService) UpdateImport(ctx context.Context, owner, repo string, body *Import) (*Import, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import", owner, repo) - req, err := s.client.NewRequest(ctx, "PATCH", u, in) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -255,9 +255,9 @@ func (s *MigrationService) CommitAuthors(ctx context.Context, owner, repo string // GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#map-a-commit-author // //meta:operation PATCH /repos/{owner}/{repo}/import/authors/{author_id} -func (s *MigrationService) MapCommitAuthor(ctx context.Context, owner, repo string, id int64, author *SourceImportAuthor) (*SourceImportAuthor, *Response, error) { +func (s *MigrationService) MapCommitAuthor(ctx context.Context, owner, repo string, id int64, body *SourceImportAuthor) (*SourceImportAuthor, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/authors/%v", owner, repo, id) - req, err := s.client.NewRequest(ctx, "PATCH", u, author) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -280,9 +280,9 @@ func (s *MigrationService) MapCommitAuthor(ctx context.Context, owner, repo stri // GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#update-git-lfs-preference // //meta:operation PATCH /repos/{owner}/{repo}/import/lfs -func (s *MigrationService) SetLFSPreference(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) { +func (s *MigrationService) SetLFSPreference(ctx context.Context, owner, repo string, body *Import) (*Import, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/lfs", owner, repo) - req, err := s.client.NewRequest(ctx, "PATCH", u, in) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/orgs.go b/github/orgs.go index d577b98b61a..d4be778e906 100644 --- a/github/orgs.go +++ b/github/orgs.go @@ -280,9 +280,9 @@ func (s *OrganizationsService) GetByID(ctx context.Context, id int64) (*Organiza // GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#update-an-organization // //meta:operation PATCH /orgs/{org} -func (s *OrganizationsService) Edit(ctx context.Context, name string, org *Organization) (*Organization, *Response, error) { +func (s *OrganizationsService) Edit(ctx context.Context, name string, body *Organization) (*Organization, *Response, error) { u := fmt.Sprintf("orgs/%v", name) - req, err := s.client.NewRequest(ctx, "PATCH", u, org) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/orgs_artifacts.go b/github/orgs_artifacts.go index ce3e04b0a3a..b9f7b50627f 100644 --- a/github/orgs_artifacts.go +++ b/github/orgs_artifacts.go @@ -112,9 +112,9 @@ type ArtifactStorageResponse struct { // GitHub API docs: https://docs.github.com/rest/orgs/artifact-metadata?apiVersion=2022-11-28#create-an-artifact-deployment-record // //meta:operation POST /orgs/{org}/artifacts/metadata/deployment-record -func (s *OrganizationsService) CreateArtifactDeploymentRecord(ctx context.Context, org string, record CreateArtifactDeploymentRequest) (*ArtifactDeploymentResponse, *Response, error) { +func (s *OrganizationsService) CreateArtifactDeploymentRecord(ctx context.Context, org string, body CreateArtifactDeploymentRequest) (*ArtifactDeploymentResponse, *Response, error) { u := fmt.Sprintf("orgs/%v/artifacts/metadata/deployment-record", org) - req, err := s.client.NewRequest(ctx, "POST", u, record) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -133,9 +133,9 @@ func (s *OrganizationsService) CreateArtifactDeploymentRecord(ctx context.Contex // GitHub API docs: https://docs.github.com/rest/orgs/artifact-metadata?apiVersion=2022-11-28#set-cluster-deployment-records // //meta:operation POST /orgs/{org}/artifacts/metadata/deployment-record/cluster/{cluster} -func (s *OrganizationsService) SetClusterDeploymentRecords(ctx context.Context, org, cluster string, request ClusterDeploymentRecordsRequest) (*ArtifactDeploymentResponse, *Response, error) { +func (s *OrganizationsService) SetClusterDeploymentRecords(ctx context.Context, org, cluster string, body ClusterDeploymentRecordsRequest) (*ArtifactDeploymentResponse, *Response, error) { u := fmt.Sprintf("orgs/%v/artifacts/metadata/deployment-record/cluster/%v", org, cluster) - req, err := s.client.NewRequest(ctx, "POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -154,9 +154,9 @@ func (s *OrganizationsService) SetClusterDeploymentRecords(ctx context.Context, // GitHub API docs: https://docs.github.com/rest/orgs/artifact-metadata?apiVersion=2022-11-28#create-artifact-metadata-storage-record // //meta:operation POST /orgs/{org}/artifacts/metadata/storage-record -func (s *OrganizationsService) CreateArtifactStorageRecord(ctx context.Context, org string, record CreateArtifactStorageRequest) (*ArtifactStorageResponse, *Response, error) { +func (s *OrganizationsService) CreateArtifactStorageRecord(ctx context.Context, org string, body CreateArtifactStorageRequest) (*ArtifactStorageResponse, *Response, error) { u := fmt.Sprintf("orgs/%v/artifacts/metadata/storage-record", org) - req, err := s.client.NewRequest(ctx, "POST", u, record) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/orgs_codesecurity_configurations.go b/github/orgs_codesecurity_configurations.go index 701e2cc8fdc..dafdf1ace01 100644 --- a/github/orgs_codesecurity_configurations.go +++ b/github/orgs_codesecurity_configurations.go @@ -172,10 +172,10 @@ func (s *OrganizationsService) ListCodeSecurityConfigurations(ctx context.Contex // GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#create-a-code-security-configuration // //meta:operation POST /orgs/{org}/code-security/configurations -func (s *OrganizationsService) CreateCodeSecurityConfiguration(ctx context.Context, org string, config CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { +func (s *OrganizationsService) CreateCodeSecurityConfiguration(ctx context.Context, org string, body CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { u := fmt.Sprintf("orgs/%v/code-security/configurations", org) - req, err := s.client.NewRequest(ctx, "POST", u, config) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -256,10 +256,10 @@ func (s *OrganizationsService) GetCodeSecurityConfiguration(ctx context.Context, // GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#update-a-code-security-configuration // //meta:operation PATCH /orgs/{org}/code-security/configurations/{configuration_id} -func (s *OrganizationsService) UpdateCodeSecurityConfiguration(ctx context.Context, org string, configurationID int64, config CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { +func (s *OrganizationsService) UpdateCodeSecurityConfiguration(ctx context.Context, org string, configurationID int64, body CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, configurationID) - req, err := s.client.NewRequest(ctx, "PATCH", u, config) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/orgs_custom_repository_roles.go b/github/orgs_custom_repository_roles.go index 001fc0329b5..7903fb22553 100644 --- a/github/orgs_custom_repository_roles.go +++ b/github/orgs_custom_repository_roles.go @@ -96,10 +96,10 @@ func (s *OrganizationsService) GetCustomRepoRole(ctx context.Context, org string // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles?apiVersion=2022-11-28#create-a-custom-repository-role // //meta:operation POST /orgs/{org}/custom-repository-roles -func (s *OrganizationsService) CreateCustomRepoRole(ctx context.Context, org string, opts *CreateOrUpdateCustomRepoRoleOptions) (*CustomRepoRoles, *Response, error) { +func (s *OrganizationsService) CreateCustomRepoRole(ctx context.Context, org string, body *CreateOrUpdateCustomRepoRoleOptions) (*CustomRepoRoles, *Response, error) { u := fmt.Sprintf("orgs/%v/custom-repository-roles", org) - req, err := s.client.NewRequest(ctx, "POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -119,10 +119,10 @@ func (s *OrganizationsService) CreateCustomRepoRole(ctx context.Context, org str // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles?apiVersion=2022-11-28#update-a-custom-repository-role // //meta:operation PATCH /orgs/{org}/custom-repository-roles/{role_id} -func (s *OrganizationsService) UpdateCustomRepoRole(ctx context.Context, org string, roleID int64, opts *CreateOrUpdateCustomRepoRoleOptions) (*CustomRepoRoles, *Response, error) { +func (s *OrganizationsService) UpdateCustomRepoRole(ctx context.Context, org string, roleID int64, body *CreateOrUpdateCustomRepoRoleOptions) (*CustomRepoRoles, *Response, error) { u := fmt.Sprintf("orgs/%v/custom-repository-roles/%v", org, roleID) - req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/orgs_hooks.go b/github/orgs_hooks.go index e0b8d29f4b0..12f03bb7455 100644 --- a/github/orgs_hooks.go +++ b/github/orgs_hooks.go @@ -100,9 +100,9 @@ func (s *OrganizationsService) CreateHook(ctx context.Context, org string, hook // GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#update-an-organization-webhook // //meta:operation PATCH /orgs/{org}/hooks/{hook_id} -func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int64, hook *Hook) (*Hook, *Response, error) { +func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int64, body *Hook) (*Hook, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%v", org, id) - req, err := s.client.NewRequest(ctx, "PATCH", u, hook) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/orgs_hooks_configuration.go b/github/orgs_hooks_configuration.go index 63eb1adb212..0f6aac15d86 100644 --- a/github/orgs_hooks_configuration.go +++ b/github/orgs_hooks_configuration.go @@ -36,9 +36,9 @@ func (s *OrganizationsService) GetHookConfiguration(ctx context.Context, org str // GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#update-a-webhook-configuration-for-an-organization // //meta:operation PATCH /orgs/{org}/hooks/{hook_id}/config -func (s *OrganizationsService) EditHookConfiguration(ctx context.Context, org string, id int64, config *HookConfig) (*HookConfig, *Response, error) { +func (s *OrganizationsService) EditHookConfiguration(ctx context.Context, org string, id int64, body *HookConfig) (*HookConfig, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%v/config", org, id) - req, err := s.client.NewRequest(ctx, "PATCH", u, config) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/orgs_immutable_releases.go b/github/orgs_immutable_releases.go index e9c3fe9c0e8..3f969f516b6 100644 --- a/github/orgs_immutable_releases.go +++ b/github/orgs_immutable_releases.go @@ -60,10 +60,10 @@ func (s *OrganizationsService) GetImmutableReleasesSettings(ctx context.Context, // GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#set-immutable-releases-settings-for-an-organization // //meta:operation PUT /orgs/{org}/settings/immutable-releases -func (s *OrganizationsService) UpdateImmutableReleasesSettings(ctx context.Context, org string, opts ImmutableReleasePolicy) (*Response, error) { +func (s *OrganizationsService) UpdateImmutableReleasesSettings(ctx context.Context, org string, body ImmutableReleasePolicy) (*Response, error) { u := fmt.Sprintf("orgs/%v/settings/immutable-releases", org) - req, err := s.client.NewRequest(ctx, "PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } diff --git a/github/orgs_issue_types.go b/github/orgs_issue_types.go index 2a1f1aa3a5d..0edc7ad5036 100644 --- a/github/orgs_issue_types.go +++ b/github/orgs_issue_types.go @@ -46,9 +46,9 @@ func (s *OrganizationsService) ListIssueTypes(ctx context.Context, org string) ( // GitHub API docs: https://docs.github.com/rest/orgs/issue-types?apiVersion=2022-11-28#create-issue-type-for-an-organization // //meta:operation POST /orgs/{org}/issue-types -func (s *OrganizationsService) CreateIssueType(ctx context.Context, org string, opts *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) { +func (s *OrganizationsService) CreateIssueType(ctx context.Context, org string, body *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) { u := fmt.Sprintf("orgs/%v/issue-types", org) - req, err := s.client.NewRequest(ctx, "POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -67,9 +67,9 @@ func (s *OrganizationsService) CreateIssueType(ctx context.Context, org string, // GitHub API docs: https://docs.github.com/rest/orgs/issue-types?apiVersion=2022-11-28#update-issue-type-for-an-organization // //meta:operation PUT /orgs/{org}/issue-types/{issue_type_id} -func (s *OrganizationsService) UpdateIssueType(ctx context.Context, org string, issueTypeID int64, opts *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) { +func (s *OrganizationsService) UpdateIssueType(ctx context.Context, org string, issueTypeID int64, body *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) { u := fmt.Sprintf("orgs/%v/issue-types/%v", org, issueTypeID) - req, err := s.client.NewRequest(ctx, "PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } diff --git a/github/orgs_members.go b/github/orgs_members.go index ab5dc65af14..5d3272e89f0 100644 --- a/github/orgs_members.go +++ b/github/orgs_members.go @@ -368,10 +368,10 @@ type CreateOrgInvitationOptions struct { // GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#create-an-organization-invitation // //meta:operation POST /orgs/{org}/invitations -func (s *OrganizationsService) CreateOrgInvitation(ctx context.Context, org string, opts *CreateOrgInvitationOptions) (*Invitation, *Response, error) { +func (s *OrganizationsService) CreateOrgInvitation(ctx context.Context, org string, body *CreateOrgInvitationOptions) (*Invitation, *Response, error) { u := fmt.Sprintf("orgs/%v/invitations", org) - req, err := s.client.NewRequest(ctx, "POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/orgs_network_configurations.go b/github/orgs_network_configurations.go index a62f34f4cc7..0de09e97bbf 100644 --- a/github/orgs_network_configurations.go +++ b/github/orgs_network_configurations.go @@ -130,13 +130,13 @@ func (s *OrganizationsService) ListNetworkConfigurations(ctx context.Context, or // GitHub API docs: https://docs.github.com/rest/orgs/network-configurations?apiVersion=2022-11-28#create-a-hosted-compute-network-configuration-for-an-organization // //meta:operation POST /orgs/{org}/settings/network-configurations -func (s *OrganizationsService) CreateNetworkConfiguration(ctx context.Context, org string, createReq NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { - if err := validateNetworkConfigurationRequest(createReq); err != nil { +func (s *OrganizationsService) CreateNetworkConfiguration(ctx context.Context, org string, body NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { + if err := validateNetworkConfigurationRequest(body); err != nil { return nil, nil, fmt.Errorf("validation failed: %w", err) } u := fmt.Sprintf("orgs/%v/settings/network-configurations", org) - req, err := s.client.NewRequest(ctx, "POST", u, createReq) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -176,13 +176,13 @@ func (s *OrganizationsService) GetNetworkConfiguration(ctx context.Context, org, // GitHub API docs: https://docs.github.com/rest/orgs/network-configurations?apiVersion=2022-11-28#update-a-hosted-compute-network-configuration-for-an-organization // //meta:operation PATCH /orgs/{org}/settings/network-configurations/{network_configuration_id} -func (s *OrganizationsService) UpdateNetworkConfiguration(ctx context.Context, org, networkID string, updateReq NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { - if err := validateNetworkConfigurationRequest(updateReq); err != nil { +func (s *OrganizationsService) UpdateNetworkConfiguration(ctx context.Context, org, networkID string, body NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { + if err := validateNetworkConfigurationRequest(body); err != nil { return nil, nil, fmt.Errorf("validation failed: %w", err) } u := fmt.Sprintf("orgs/%v/settings/network-configurations/%v", org, networkID) - req, err := s.client.NewRequest(ctx, "PATCH", u, updateReq) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/orgs_organization_properties.go b/github/orgs_organization_properties.go index aa6faa6375f..c5954e2d0a3 100644 --- a/github/orgs_organization_properties.go +++ b/github/orgs_organization_properties.go @@ -44,9 +44,9 @@ func (s *OrganizationsService) GetOrganizationCustomPropertyValues(ctx context.C // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-properties-for-orgs?apiVersion=2022-11-28#create-or-update-custom-property-values-for-an-organization // //meta:operation PATCH /organizations/{org}/org-properties/values -func (s *OrganizationsService) CreateOrUpdateOrganizationCustomPropertyValues(ctx context.Context, org string, values OrganizationCustomPropertyValues) (*Response, error) { +func (s *OrganizationsService) CreateOrUpdateOrganizationCustomPropertyValues(ctx context.Context, org string, body OrganizationCustomPropertyValues) (*Response, error) { u := fmt.Sprintf("organizations/%v/org-properties/values", org) - req, err := s.client.NewRequest(ctx, "PATCH", u, values) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, err } diff --git a/github/orgs_organization_roles.go b/github/orgs_organization_roles.go index c0503ce0de8..36cf57b66f3 100644 --- a/github/orgs_organization_roles.go +++ b/github/orgs_organization_roles.go @@ -103,10 +103,10 @@ func (s *OrganizationsService) GetOrgRole(ctx context.Context, org string, roleI // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/organization-roles?apiVersion=2022-11-28#create-a-custom-organization-role // //meta:operation POST /orgs/{org}/organization-roles -func (s *OrganizationsService) CreateCustomOrgRole(ctx context.Context, org string, request CreateCustomOrgRoleRequest) (*CustomOrgRole, *Response, error) { +func (s *OrganizationsService) CreateCustomOrgRole(ctx context.Context, org string, body CreateCustomOrgRoleRequest) (*CustomOrgRole, *Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles", org) - req, err := s.client.NewRequest(ctx, "POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -126,10 +126,10 @@ func (s *OrganizationsService) CreateCustomOrgRole(ctx context.Context, org stri // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/organization-roles?apiVersion=2022-11-28#update-a-custom-organization-role // //meta:operation PATCH /orgs/{org}/organization-roles/{role_id} -func (s *OrganizationsService) UpdateCustomOrgRole(ctx context.Context, org string, roleID int64, request UpdateCustomOrgRoleRequest) (*CustomOrgRole, *Response, error) { +func (s *OrganizationsService) UpdateCustomOrgRole(ctx context.Context, org string, roleID int64, body UpdateCustomOrgRoleRequest) (*CustomOrgRole, *Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles/%v", org, roleID) - req, err := s.client.NewRequest(ctx, "PATCH", u, request) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/orgs_properties.go b/github/orgs_properties.go index d45ba463a6d..f3492c47e87 100644 --- a/github/orgs_properties.go +++ b/github/orgs_properties.go @@ -231,10 +231,10 @@ func (s *OrganizationsService) GetCustomProperty(ctx context.Context, org, name // GitHub API docs: https://docs.github.com/rest/orgs/custom-properties?apiVersion=2022-11-28#create-or-update-a-custom-property-for-an-organization // //meta:operation PUT /orgs/{org}/properties/schema/{custom_property_name} -func (s *OrganizationsService) CreateOrUpdateCustomProperty(ctx context.Context, org, customPropertyName string, property *CustomProperty) (*CustomProperty, *Response, error) { +func (s *OrganizationsService) CreateOrUpdateCustomProperty(ctx context.Context, org, customPropertyName string, body *CustomProperty) (*CustomProperty, *Response, error) { u := fmt.Sprintf("orgs/%v/properties/schema/%v", org, customPropertyName) - req, err := s.client.NewRequest(ctx, "PUT", u, property) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } diff --git a/github/orgs_rules.go b/github/orgs_rules.go index 308afe2a13d..fde484ab21c 100644 --- a/github/orgs_rules.go +++ b/github/orgs_rules.go @@ -42,10 +42,10 @@ func (s *OrganizationsService) ListAllRepositoryRulesets(ctx context.Context, or // GitHub API docs: https://docs.github.com/rest/orgs/rules?apiVersion=2022-11-28#create-an-organization-repository-ruleset // //meta:operation POST /orgs/{org}/rulesets -func (s *OrganizationsService) CreateRepositoryRuleset(ctx context.Context, org string, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { +func (s *OrganizationsService) CreateRepositoryRuleset(ctx context.Context, org string, body RepositoryRuleset) (*RepositoryRuleset, *Response, error) { u := fmt.Sprintf("orgs/%v/rulesets", org) - req, err := s.client.NewRequest(ctx, "POST", u, ruleset) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -86,10 +86,10 @@ func (s *OrganizationsService) GetRepositoryRuleset(ctx context.Context, org str // GitHub API docs: https://docs.github.com/rest/orgs/rules?apiVersion=2022-11-28#update-an-organization-repository-ruleset // //meta:operation PUT /orgs/{org}/rulesets/{ruleset_id} -func (s *OrganizationsService) UpdateRepositoryRuleset(ctx context.Context, org string, rulesetID int64, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { +func (s *OrganizationsService) UpdateRepositoryRuleset(ctx context.Context, org string, rulesetID int64, body RepositoryRuleset) (*RepositoryRuleset, *Response, error) { u := fmt.Sprintf("orgs/%v/rulesets/%v", org, rulesetID) - req, err := s.client.NewRequest(ctx, "PUT", u, ruleset) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } diff --git a/github/private_registries.go b/github/private_registries.go index e22f1e47f17..192cb086186 100644 --- a/github/private_registries.go +++ b/github/private_registries.go @@ -262,10 +262,10 @@ func (s *PrivateRegistriesService) ListOrganizationPrivateRegistries(ctx context // GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations?apiVersion=2026-03-10#create-a-private-registry-for-an-organization // //meta:operation POST /orgs/{org}/private-registries -func (s *PrivateRegistriesService) CreateOrganizationPrivateRegistry(ctx context.Context, org string, privateRegistry CreateOrganizationPrivateRegistry) (*PrivateRegistry, *Response, error) { +func (s *PrivateRegistriesService) CreateOrganizationPrivateRegistry(ctx context.Context, org string, body CreateOrganizationPrivateRegistry) (*PrivateRegistry, *Response, error) { u := fmt.Sprintf("orgs/%v/private-registries", org) - req, err := s.client.NewRequest(ctx, "POST", u, privateRegistry, WithVersion(api20260310)) + req, err := s.client.NewRequest(ctx, "POST", u, body, WithVersion(api20260310)) if err != nil { return nil, nil, err } @@ -328,10 +328,10 @@ func (s *PrivateRegistriesService) GetOrganizationPrivateRegistry(ctx context.Co // GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations?apiVersion=2026-03-10#update-a-private-registry-for-an-organization // //meta:operation PATCH /orgs/{org}/private-registries/{secret_name} -func (s *PrivateRegistriesService) UpdateOrganizationPrivateRegistry(ctx context.Context, org, secretName string, privateRegistry UpdateOrganizationPrivateRegistry) (*Response, error) { +func (s *PrivateRegistriesService) UpdateOrganizationPrivateRegistry(ctx context.Context, org, secretName string, body UpdateOrganizationPrivateRegistry) (*Response, error) { u := fmt.Sprintf("orgs/%v/private-registries/%v", org, secretName) - req, err := s.client.NewRequest(ctx, "PATCH", u, privateRegistry, WithVersion(api20260310)) + req, err := s.client.NewRequest(ctx, "PATCH", u, body, WithVersion(api20260310)) if err != nil { return nil, err } diff --git a/github/projects.go b/github/projects.go index 98574148b50..79d6262db2d 100644 --- a/github/projects.go +++ b/github/projects.go @@ -542,9 +542,9 @@ func (s *ProjectsService) ListOrganizationProjectItems(ctx context.Context, org // GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#add-item-to-organization-owned-project // //meta:operation POST /orgs/{org}/projectsV2/{project_number}/items -func (s *ProjectsService) AddOrganizationProjectItem(ctx context.Context, org string, projectNumber int, opts *AddProjectItemOptions) (*ProjectV2Item, *Response, error) { +func (s *ProjectsService) AddOrganizationProjectItem(ctx context.Context, org string, projectNumber int, body *AddProjectItemOptions) (*ProjectV2Item, *Response, error) { u := fmt.Sprintf("orgs/%v/projectsV2/%v/items", org, projectNumber) - req, err := s.client.NewRequest(ctx, "POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -589,9 +589,9 @@ func (s *ProjectsService) GetOrganizationProjectItem(ctx context.Context, org st // GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#update-project-item-for-organization // //meta:operation PATCH /orgs/{org}/projectsV2/{project_number}/items/{item_id} -func (s *ProjectsService) UpdateOrganizationProjectItem(ctx context.Context, org string, projectNumber int, itemID int64, opts *UpdateProjectItemOptions) (*ProjectV2Item, *Response, error) { +func (s *ProjectsService) UpdateOrganizationProjectItem(ctx context.Context, org string, projectNumber int, itemID int64, body *UpdateProjectItemOptions) (*ProjectV2Item, *Response, error) { u := fmt.Sprintf("orgs/%v/projectsV2/%v/items/%v", org, projectNumber, itemID) - req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -651,9 +651,9 @@ func (s *ProjectsService) ListUserProjectItems(ctx context.Context, username str // GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#add-item-to-user-owned-project // //meta:operation POST /users/{username}/projectsV2/{project_number}/items -func (s *ProjectsService) AddUserProjectItem(ctx context.Context, username string, projectNumber int, opts *AddProjectItemOptions) (*ProjectV2Item, *Response, error) { +func (s *ProjectsService) AddUserProjectItem(ctx context.Context, username string, projectNumber int, body *AddProjectItemOptions) (*ProjectV2Item, *Response, error) { u := fmt.Sprintf("users/%v/projectsV2/%v/items", username, projectNumber) - req, err := s.client.NewRequest(ctx, "POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -698,9 +698,9 @@ func (s *ProjectsService) GetUserProjectItem(ctx context.Context, username strin // GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#update-project-item-for-user // //meta:operation PATCH /users/{username}/projectsV2/{project_number}/items/{item_id} -func (s *ProjectsService) UpdateUserProjectItem(ctx context.Context, username string, projectNumber int, itemID int64, opts *UpdateProjectItemOptions) (*ProjectV2Item, *Response, error) { +func (s *ProjectsService) UpdateUserProjectItem(ctx context.Context, username string, projectNumber int, itemID int64, body *UpdateProjectItemOptions) (*ProjectV2Item, *Response, error) { u := fmt.Sprintf("users/%v/projectsV2/%v/items/%v", username, projectNumber, itemID) - req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/pulls.go b/github/pulls.go index d701679802e..eb14039fdb6 100644 --- a/github/pulls.go +++ b/github/pulls.go @@ -282,9 +282,9 @@ type NewPullRequest struct { // GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#create-a-pull-request // //meta:operation POST /repos/{owner}/{repo}/pulls -func (s *PullRequestsService) Create(ctx context.Context, owner, repo string, pull *NewPullRequest) (*PullRequest, *Response, error) { +func (s *PullRequestsService) Create(ctx context.Context, owner, repo string, body *NewPullRequest) (*PullRequest, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, pull) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -323,10 +323,10 @@ type PullRequestBranchUpdateResponse struct { // GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#update-a-pull-request-branch // //meta:operation PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch -func (s *PullRequestsService) UpdateBranch(ctx context.Context, owner, repo string, number int, opts *PullRequestBranchUpdateOptions) (*PullRequestBranchUpdateResponse, *Response, error) { +func (s *PullRequestsService) UpdateBranch(ctx context.Context, owner, repo string, number int, body *PullRequestBranchUpdateOptions) (*PullRequestBranchUpdateResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%v/update-branch", owner, repo, number) - req, err := s.client.NewRequest(ctx, "PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } diff --git a/github/pulls_comments.go b/github/pulls_comments.go index e85d45a55c6..1a8016f7272 100644 --- a/github/pulls_comments.go +++ b/github/pulls_comments.go @@ -136,9 +136,9 @@ func (s *PullRequestsService) GetComment(ctx context.Context, owner, repo string // GitHub API docs: https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#create-a-review-comment-for-a-pull-request // //meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/comments -func (s *PullRequestsService) CreateComment(ctx context.Context, owner, repo string, number int, comment *PullRequestComment) (*PullRequestComment, *Response, error) { +func (s *PullRequestsService) CreateComment(ctx context.Context, owner, repo string, number int, body *PullRequestComment) (*PullRequestComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%v/comments", owner, repo, number) - req, err := s.client.NewRequest(ctx, "POST", u, comment) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -188,9 +188,9 @@ func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner, // GitHub API docs: https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#update-a-review-comment-for-a-pull-request // //meta:operation PATCH /repos/{owner}/{repo}/pulls/comments/{comment_id} -func (s *PullRequestsService) EditComment(ctx context.Context, owner, repo string, commentID int64, comment *PullRequestComment) (*PullRequestComment, *Response, error) { +func (s *PullRequestsService) EditComment(ctx context.Context, owner, repo string, commentID int64, body *PullRequestComment) (*PullRequestComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v", owner, repo, commentID) - req, err := s.client.NewRequest(ctx, "PATCH", u, comment) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/pulls_reviews.go b/github/pulls_reviews.go index 716ddc9a22d..9e299fd11e8 100644 --- a/github/pulls_reviews.go +++ b/github/pulls_reviews.go @@ -237,16 +237,16 @@ func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, rep // GitHub API docs: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#create-a-review-for-a-pull-request // //meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews -func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo string, number int, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { +func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo string, number int, body *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews", owner, repo, number) - req, err := s.client.NewRequest(ctx, "POST", u, review) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } // Detect which style of review comment is being used. - if isCF, err := review.isComfortFadePreview(); err != nil { + if isCF, err := body.isComfortFadePreview(); err != nil { return nil, nil, err } else if isCF { // If the review comments are using the comfort fade preview fields, @@ -293,10 +293,10 @@ func (s *PullRequestsService) UpdateReview(ctx context.Context, owner, repo stri // GitHub API docs: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#submit-a-review-for-a-pull-request // //meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events -func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { +func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo string, number int, reviewID int64, body *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v/events", owner, repo, number, reviewID) - req, err := s.client.NewRequest(ctx, "POST", u, review) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -315,10 +315,10 @@ func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo stri // GitHub API docs: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#dismiss-a-review-for-a-pull-request // //meta:operation PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals -func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewDismissalRequest) (*PullRequestReview, *Response, error) { +func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo string, number int, reviewID int64, body *PullRequestReviewDismissalRequest) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v/dismissals", owner, repo, number, reviewID) - req, err := s.client.NewRequest(ctx, "PUT", u, review) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } diff --git a/github/repos.go b/github/repos.go index df4979979c8..f1217533d36 100644 --- a/github/repos.go +++ b/github/repos.go @@ -634,10 +634,10 @@ type TemplateRepoRequest struct { // GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#create-a-repository-using-a-template // //meta:operation POST /repos/{template_owner}/{template_repo}/generate -func (s *RepositoriesService) CreateFromTemplate(ctx context.Context, templateOwner, templateRepo string, templateRepoReq *TemplateRepoRequest) (*Repository, *Response, error) { +func (s *RepositoriesService) CreateFromTemplate(ctx context.Context, templateOwner, templateRepo string, body *TemplateRepoRequest) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/generate", templateOwner, templateRepo) - req, err := s.client.NewRequest(ctx, "POST", u, templateRepoReq) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -733,9 +733,9 @@ func (s *RepositoriesService) GetByID(ctx context.Context, id int64) (*Repositor // GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#update-a-repository // //meta:operation PATCH /repos/{owner}/{repo} -func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repository *Repository) (*Repository, *Response, error) { +func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, body *Repository) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v", owner, repo) - req, err := s.client.NewRequest(ctx, "PATCH", u, repository) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -1600,9 +1600,9 @@ func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Conte // GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#update-branch-protection // //meta:operation PUT /repos/{owner}/{repo}/branches/{branch}/protection -func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, preq *ProtectionRequest) (*Protection, *Response, error) { +func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, body *ProtectionRequest) (*Protection, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest(ctx, "PUT", u, preq) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } @@ -1715,9 +1715,9 @@ func (s *RepositoriesService) OptionalSignaturesOnProtectedBranch(ctx context.Co // GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#update-status-check-protection // //meta:operation PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks -func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, owner, repo, branch string, sreq *RequiredStatusChecksRequest) (*RequiredStatusChecks, *Response, error) { +func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, owner, repo, branch string, body *RequiredStatusChecksRequest) (*RequiredStatusChecks, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest(ctx, "PATCH", u, sreq) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -1802,9 +1802,9 @@ func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Contex // GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#update-pull-request-review-protection // //meta:operation PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews -func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string, patch *PullRequestReviewsEnforcementUpdate) (*PullRequestReviewsEnforcement, *Response, error) { +func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string, body *PullRequestReviewsEnforcementUpdate) (*PullRequestReviewsEnforcement, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest(ctx, "PATCH", u, patch) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -2043,9 +2043,9 @@ func (s *RepositoriesService) ListAppRestrictions(ctx context.Context, owner, re // GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#set-app-access-restrictions // //meta:operation PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps -func (s *RepositoriesService) ReplaceAppRestrictions(ctx context.Context, owner, repo, branch string, apps []string) ([]*App, *Response, error) { +func (s *RepositoriesService) ReplaceAppRestrictions(ctx context.Context, owner, repo, branch string, body []string) ([]*App, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest(ctx, "PUT", u, apps) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } @@ -2069,9 +2069,9 @@ func (s *RepositoriesService) ReplaceAppRestrictions(ctx context.Context, owner, // GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#add-app-access-restrictions // //meta:operation POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps -func (s *RepositoriesService) AddAppRestrictions(ctx context.Context, owner, repo, branch string, apps []string) ([]*App, *Response, error) { +func (s *RepositoriesService) AddAppRestrictions(ctx context.Context, owner, repo, branch string, body []string) ([]*App, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest(ctx, "POST", u, apps) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -2146,9 +2146,9 @@ func (s *RepositoriesService) ListTeamRestrictions(ctx context.Context, owner, r // GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#set-team-access-restrictions // //meta:operation PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams -func (s *RepositoriesService) ReplaceTeamRestrictions(ctx context.Context, owner, repo, branch string, teams []string) ([]*Team, *Response, error) { +func (s *RepositoriesService) ReplaceTeamRestrictions(ctx context.Context, owner, repo, branch string, body []string) ([]*Team, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest(ctx, "PUT", u, teams) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } @@ -2172,9 +2172,9 @@ func (s *RepositoriesService) ReplaceTeamRestrictions(ctx context.Context, owner // GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#add-team-access-restrictions // //meta:operation POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams -func (s *RepositoriesService) AddTeamRestrictions(ctx context.Context, owner, repo, branch string, teams []string) ([]*Team, *Response, error) { +func (s *RepositoriesService) AddTeamRestrictions(ctx context.Context, owner, repo, branch string, body []string) ([]*Team, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest(ctx, "POST", u, teams) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -2249,9 +2249,9 @@ func (s *RepositoriesService) ListUserRestrictions(ctx context.Context, owner, r // GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#set-user-access-restrictions // //meta:operation PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users -func (s *RepositoriesService) ReplaceUserRestrictions(ctx context.Context, owner, repo, branch string, users []string) ([]*User, *Response, error) { +func (s *RepositoriesService) ReplaceUserRestrictions(ctx context.Context, owner, repo, branch string, body []string) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest(ctx, "PUT", u, users) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } @@ -2275,9 +2275,9 @@ func (s *RepositoriesService) ReplaceUserRestrictions(ctx context.Context, owner // GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#add-user-access-restrictions // //meta:operation POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users -func (s *RepositoriesService) AddUserRestrictions(ctx context.Context, owner, repo, branch string, users []string) ([]*User, *Response, error) { +func (s *RepositoriesService) AddUserRestrictions(ctx context.Context, owner, repo, branch string, body []string) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest(ctx, "POST", u, users) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/repos_actions_access.go b/github/repos_actions_access.go index 42739999fc6..705d868d2b7 100644 --- a/github/repos_actions_access.go +++ b/github/repos_actions_access.go @@ -48,9 +48,9 @@ func (s *RepositoriesService) GetActionsAccessLevel(ctx context.Context, owner, // GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-the-level-of-access-for-workflows-outside-of-the-repository // //meta:operation PUT /repos/{owner}/{repo}/actions/permissions/access -func (s *RepositoriesService) EditActionsAccessLevel(ctx context.Context, owner, repo string, repositoryActionsAccessLevel RepositoryActionsAccessLevel) (*Response, error) { +func (s *RepositoriesService) EditActionsAccessLevel(ctx context.Context, owner, repo string, body RepositoryActionsAccessLevel) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/access", owner, repo) - req, err := s.client.NewRequest(ctx, "PUT", u, repositoryActionsAccessLevel) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } diff --git a/github/repos_actions_allowed.go b/github/repos_actions_allowed.go index d8a019e67bf..c1536d0c7e5 100644 --- a/github/repos_actions_allowed.go +++ b/github/repos_actions_allowed.go @@ -36,9 +36,9 @@ func (s *RepositoriesService) GetActionsAllowed(ctx context.Context, org, repo s // GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-allowed-actions-and-reusable-workflows-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/actions/permissions/selected-actions -func (s *RepositoriesService) EditActionsAllowed(ctx context.Context, org, repo string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { +func (s *RepositoriesService) EditActionsAllowed(ctx context.Context, org, repo string, body ActionsAllowed) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/selected-actions", org, repo) - req, err := s.client.NewRequest(ctx, "PUT", u, actionsAllowed) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } diff --git a/github/repos_actions_permissions.go b/github/repos_actions_permissions.go index ea4bed00a89..20e21b06d0a 100644 --- a/github/repos_actions_permissions.go +++ b/github/repos_actions_permissions.go @@ -59,9 +59,9 @@ func (s *RepositoriesService) GetActionsPermissions(ctx context.Context, owner, // GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-github-actions-permissions-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/actions/permissions -func (s *RepositoriesService) UpdateActionsPermissions(ctx context.Context, owner, repo string, actionsPermissionsRepository ActionsPermissionsRepository) (*ActionsPermissionsRepository, *Response, error) { +func (s *RepositoriesService) UpdateActionsPermissions(ctx context.Context, owner, repo string, body ActionsPermissionsRepository) (*ActionsPermissionsRepository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions", owner, repo) - req, err := s.client.NewRequest(ctx, "PUT", u, actionsPermissionsRepository) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } @@ -102,9 +102,9 @@ func (s *RepositoriesService) GetDefaultWorkflowPermissions(ctx context.Context, // GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-default-workflow-permissions-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/actions/permissions/workflow -func (s *RepositoriesService) UpdateDefaultWorkflowPermissions(ctx context.Context, owner, repo string, permissions DefaultWorkflowPermissionRepository) (*DefaultWorkflowPermissionRepository, *Response, error) { +func (s *RepositoriesService) UpdateDefaultWorkflowPermissions(ctx context.Context, owner, repo string, body DefaultWorkflowPermissionRepository) (*DefaultWorkflowPermissionRepository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/workflow", owner, repo) - req, err := s.client.NewRequest(ctx, "PUT", u, permissions) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } @@ -145,9 +145,9 @@ func (s *RepositoriesService) GetArtifactAndLogRetentionPeriod(ctx context.Conte // GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-artifact-and-log-retention-settings-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/actions/permissions/artifact-and-log-retention -func (s *RepositoriesService) UpdateArtifactAndLogRetentionPeriod(ctx context.Context, owner, repo string, period ArtifactPeriodOpt) (*Response, error) { +func (s *RepositoriesService) UpdateArtifactAndLogRetentionPeriod(ctx context.Context, owner, repo string, body ArtifactPeriodOpt) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/artifact-and-log-retention", owner, repo) - req, err := s.client.NewRequest(ctx, "PUT", u, period) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } @@ -182,9 +182,9 @@ func (s *RepositoriesService) GetPrivateRepoForkPRWorkflowSettings(ctx context.C // GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-private-repo-fork-pr-workflow-settings-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/actions/permissions/fork-pr-workflows-private-repos -func (s *RepositoriesService) UpdatePrivateRepoForkPRWorkflowSettings(ctx context.Context, owner, repo string, permissions *WorkflowsPermissionsOpt) (*Response, error) { +func (s *RepositoriesService) UpdatePrivateRepoForkPRWorkflowSettings(ctx context.Context, owner, repo string, body *WorkflowsPermissionsOpt) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/fork-pr-workflows-private-repos", owner, repo) - req, err := s.client.NewRequest(ctx, "PUT", u, permissions) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } @@ -219,9 +219,9 @@ func (s *ActionsService) GetForkPRContributorApprovalPermissions(ctx context.Con // GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-fork-pr-contributor-approval-permissions-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/actions/permissions/fork-pr-contributor-approval -func (s *ActionsService) UpdateForkPRContributorApprovalPermissions(ctx context.Context, owner, repo string, policy ContributorApprovalPermissions) (*Response, error) { +func (s *ActionsService) UpdateForkPRContributorApprovalPermissions(ctx context.Context, owner, repo string, body ContributorApprovalPermissions) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/fork-pr-contributor-approval", owner, repo) - req, err := s.client.NewRequest(ctx, "PUT", u, policy) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } diff --git a/github/repos_autolinks.go b/github/repos_autolinks.go index 91656c51f5a..3aecef71e26 100644 --- a/github/repos_autolinks.go +++ b/github/repos_autolinks.go @@ -54,9 +54,9 @@ func (s *RepositoriesService) ListAutolinks(ctx context.Context, owner, repo str // GitHub API docs: https://docs.github.com/rest/repos/autolinks?apiVersion=2022-11-28#create-an-autolink-reference-for-a-repository // //meta:operation POST /repos/{owner}/{repo}/autolinks -func (s *RepositoriesService) AddAutolink(ctx context.Context, owner, repo string, opts *AutolinkOptions) (*Autolink, *Response, error) { +func (s *RepositoriesService) AddAutolink(ctx context.Context, owner, repo string, body *AutolinkOptions) (*Autolink, *Response, error) { u := fmt.Sprintf("repos/%v/%v/autolinks", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/repos_collaborators.go b/github/repos_collaborators.go index 582f47b23af..451381bf47c 100644 --- a/github/repos_collaborators.go +++ b/github/repos_collaborators.go @@ -145,9 +145,9 @@ type RepositoryAddCollaboratorOptions struct { // GitHub API docs: https://docs.github.com/rest/collaborators/collaborators?apiVersion=2022-11-28#add-a-repository-collaborator // //meta:operation PUT /repos/{owner}/{repo}/collaborators/{username} -func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo, user string, opts *RepositoryAddCollaboratorOptions) (*CollaboratorInvitation, *Response, error) { +func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo, user string, body *RepositoryAddCollaboratorOptions) (*CollaboratorInvitation, *Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user) - req, err := s.client.NewRequest(ctx, "PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } diff --git a/github/repos_comments.go b/github/repos_comments.go index b943375890f..e5da15f02a4 100644 --- a/github/repos_comments.go +++ b/github/repos_comments.go @@ -95,9 +95,9 @@ func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, rep // GitHub API docs: https://docs.github.com/rest/commits/comments?apiVersion=2022-11-28#create-a-commit-comment // //meta:operation POST /repos/{owner}/{repo}/commits/{commit_sha}/comments -func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sha string, comment *RepositoryComment) (*RepositoryComment, *Response, error) { +func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sha string, body *RepositoryComment) (*RepositoryComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha) - req, err := s.client.NewRequest(ctx, "POST", u, comment) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -139,9 +139,9 @@ func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string // GitHub API docs: https://docs.github.com/rest/commits/comments?apiVersion=2022-11-28#update-a-commit-comment // //meta:operation PATCH /repos/{owner}/{repo}/comments/{comment_id} -func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo string, id int64, comment *RepositoryComment) (*RepositoryComment, *Response, error) { +func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo string, id int64, body *RepositoryComment) (*RepositoryComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id) - req, err := s.client.NewRequest(ctx, "PATCH", u, comment) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/repos_contents.go b/github/repos_contents.go index 024496fe596..4c9cb27f5b7 100644 --- a/github/repos_contents.go +++ b/github/repos_contents.go @@ -253,9 +253,9 @@ func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path // GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#create-or-update-file-contents // //meta:operation PUT /repos/{owner}/{repo}/contents/{path} -func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { +func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path string, body *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/contents/%v", owner, repo, path) - req, err := s.client.NewRequest(ctx, "PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } @@ -275,9 +275,9 @@ func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path // GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#create-or-update-file-contents // //meta:operation PUT /repos/{owner}/{repo}/contents/{path} -func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { +func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path string, body *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/contents/%v", owner, repo, path) - req, err := s.client.NewRequest(ctx, "PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } diff --git a/github/repos_deployment_branch_policies.go b/github/repos_deployment_branch_policies.go index e4760f22e59..7b5aba6170e 100644 --- a/github/repos_deployment_branch_policies.go +++ b/github/repos_deployment_branch_policies.go @@ -83,10 +83,10 @@ func (s *RepositoriesService) GetDeploymentBranchPolicy(ctx context.Context, own // GitHub API docs: https://docs.github.com/rest/deployments/branch-policies?apiVersion=2022-11-28#create-a-deployment-branch-policy // //meta:operation POST /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies -func (s *RepositoriesService) CreateDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, request *DeploymentBranchPolicyRequest) (*DeploymentBranchPolicy, *Response, error) { +func (s *RepositoriesService) CreateDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, body *DeploymentBranchPolicyRequest) (*DeploymentBranchPolicy, *Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies", owner, repo, environment) - req, err := s.client.NewRequest(ctx, "POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -105,10 +105,10 @@ func (s *RepositoriesService) CreateDeploymentBranchPolicy(ctx context.Context, // GitHub API docs: https://docs.github.com/rest/deployments/branch-policies?apiVersion=2022-11-28#update-a-deployment-branch-policy // //meta:operation PUT /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} -func (s *RepositoriesService) UpdateDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, branchPolicyID int64, request *DeploymentBranchPolicyRequest) (*DeploymentBranchPolicy, *Response, error) { +func (s *RepositoriesService) UpdateDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, branchPolicyID int64, body *DeploymentBranchPolicyRequest) (*DeploymentBranchPolicy, *Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies/%v", owner, repo, environment, branchPolicyID) - req, err := s.client.NewRequest(ctx, "PUT", u, request) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } diff --git a/github/repos_deployment_protection_rules.go b/github/repos_deployment_protection_rules.go index 50c3901d751..10b0f86e579 100644 --- a/github/repos_deployment_protection_rules.go +++ b/github/repos_deployment_protection_rules.go @@ -70,10 +70,10 @@ func (s *RepositoriesService) GetAllDeploymentProtectionRules(ctx context.Contex // GitHub API docs: https://docs.github.com/rest/deployments/protection-rules?apiVersion=2022-11-28#create-a-custom-deployment-protection-rule-on-an-environment // //meta:operation POST /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules -func (s *RepositoriesService) CreateCustomDeploymentProtectionRule(ctx context.Context, owner, repo, environment string, request *CustomDeploymentProtectionRuleRequest) (*CustomDeploymentProtectionRule, *Response, error) { +func (s *RepositoriesService) CreateCustomDeploymentProtectionRule(ctx context.Context, owner, repo, environment string, body *CustomDeploymentProtectionRuleRequest) (*CustomDeploymentProtectionRule, *Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules", owner, repo, environment) - req, err := s.client.NewRequest(ctx, "POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/repos_deployments.go b/github/repos_deployments.go index 541436df5c8..544759d96dc 100644 --- a/github/repos_deployments.go +++ b/github/repos_deployments.go @@ -114,10 +114,10 @@ func (s *RepositoriesService) GetDeployment(ctx context.Context, owner, repo str // GitHub API docs: https://docs.github.com/rest/deployments/deployments?apiVersion=2022-11-28#create-a-deployment // //meta:operation POST /repos/{owner}/{repo}/deployments -func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo string, request *DeploymentRequest) (*Deployment, *Response, error) { +func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo string, body *DeploymentRequest) (*Deployment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -239,10 +239,10 @@ func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, re // GitHub API docs: https://docs.github.com/rest/deployments/statuses?apiVersion=2022-11-28#create-a-deployment-status // //meta:operation POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses -func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, repo string, deployment int64, request *DeploymentStatusRequest) (*DeploymentStatus, *Response, error) { +func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, repo string, deployment int64, body *DeploymentStatusRequest) (*DeploymentStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deployment) - req, err := s.client.NewRequest(ctx, "POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/repos_environments.go b/github/repos_environments.go index 34a25cd6bf9..5e892e5f59c 100644 --- a/github/repos_environments.go +++ b/github/repos_environments.go @@ -197,9 +197,9 @@ type createUpdateEnvironmentNoEnterprise struct { // GitHub API docs: https://docs.github.com/rest/deployments/environments?apiVersion=2022-11-28#create-or-update-an-environment // //meta:operation PUT /repos/{owner}/{repo}/environments/{environment_name} -func (s *RepositoriesService) CreateUpdateEnvironment(ctx context.Context, owner, repo, name string, environment *CreateUpdateEnvironment) (*Environment, *Response, error) { +func (s *RepositoriesService) CreateUpdateEnvironment(ctx context.Context, owner, repo, name string, body *CreateUpdateEnvironment) (*Environment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v", owner, repo, name) - req, err := s.client.NewRequest(ctx, "PUT", u, environment) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } @@ -213,8 +213,8 @@ func (s *RepositoriesService) CreateUpdateEnvironment(ctx context.Context, owner // For Free plan private repos the returned error code is 404. // We are checking that the user didn't try to send a value for unsupported fields, // and return an error if they did. - if resp != nil && resp.StatusCode == http.StatusUnprocessableEntity && environment != nil && len(environment.Reviewers) == 0 && environment.GetWaitTimer() == 0 { - return s.createNewEnvNoEnterprise(ctx, u, environment) + if resp != nil && resp.StatusCode == http.StatusUnprocessableEntity && body != nil && len(body.Reviewers) == 0 && body.GetWaitTimer() == 0 { + return s.createNewEnvNoEnterprise(ctx, u, body) } return nil, resp, err } diff --git a/github/repos_forks.go b/github/repos_forks.go index dca0b7f7c88..b4f2e226417 100644 --- a/github/repos_forks.go +++ b/github/repos_forks.go @@ -71,10 +71,10 @@ type RepositoryCreateForkOptions struct { // GitHub API docs: https://docs.github.com/rest/repos/forks?apiVersion=2022-11-28#create-a-fork // //meta:operation POST /repos/{owner}/{repo}/forks -func (s *RepositoriesService) CreateFork(ctx context.Context, owner, repo string, opts *RepositoryCreateForkOptions) (*Repository, *Response, error) { +func (s *RepositoriesService) CreateFork(ctx context.Context, owner, repo string, body *RepositoryCreateForkOptions) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/forks", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/repos_hooks.go b/github/repos_hooks.go index 9bdd8428b65..baf410eb8a8 100644 --- a/github/repos_hooks.go +++ b/github/repos_hooks.go @@ -163,9 +163,9 @@ func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, i // GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#update-a-repository-webhook // //meta:operation PATCH /repos/{owner}/{repo}/hooks/{hook_id} -func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, id int64, hook *Hook) (*Hook, *Response, error) { +func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, id int64, body *Hook) (*Hook, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%v", owner, repo, id) - req, err := s.client.NewRequest(ctx, "PATCH", u, hook) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/repos_hooks_configuration.go b/github/repos_hooks_configuration.go index 37880922bc1..ab9b221987f 100644 --- a/github/repos_hooks_configuration.go +++ b/github/repos_hooks_configuration.go @@ -51,9 +51,9 @@ func (s *RepositoriesService) GetHookConfiguration(ctx context.Context, owner, r // GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#update-a-webhook-configuration-for-a-repository // //meta:operation PATCH /repos/{owner}/{repo}/hooks/{hook_id}/config -func (s *RepositoriesService) EditHookConfiguration(ctx context.Context, owner, repo string, id int64, config *HookConfig) (*HookConfig, *Response, error) { +func (s *RepositoriesService) EditHookConfiguration(ctx context.Context, owner, repo string, id int64, body *HookConfig) (*HookConfig, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%v/config", owner, repo, id) - req, err := s.client.NewRequest(ctx, "PATCH", u, config) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/repos_keys.go b/github/repos_keys.go index 0635c4a206f..ec456c4e6b2 100644 --- a/github/repos_keys.go +++ b/github/repos_keys.go @@ -65,10 +65,10 @@ func (s *RepositoriesService) GetKey(ctx context.Context, owner, repo string, id // GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys?apiVersion=2022-11-28#create-a-deploy-key // //meta:operation POST /repos/{owner}/{repo}/keys -func (s *RepositoriesService) CreateKey(ctx context.Context, owner, repo string, key *Key) (*Key, *Response, error) { +func (s *RepositoriesService) CreateKey(ctx context.Context, owner, repo string, body *Key) (*Key, *Response, error) { u := fmt.Sprintf("repos/%v/%v/keys", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, key) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/repos_merging.go b/github/repos_merging.go index 2ec93ebc1bd..d94ea2914df 100644 --- a/github/repos_merging.go +++ b/github/repos_merging.go @@ -37,9 +37,9 @@ type RepoMergeUpstreamResult struct { // GitHub API docs: https://docs.github.com/rest/branches/branches?apiVersion=2022-11-28#merge-a-branch // //meta:operation POST /repos/{owner}/{repo}/merges -func (s *RepositoriesService) Merge(ctx context.Context, owner, repo string, request *RepositoryMergeRequest) (*RepositoryCommit, *Response, error) { +func (s *RepositoriesService) Merge(ctx context.Context, owner, repo string, body *RepositoryMergeRequest) (*RepositoryCommit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/merges", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -59,9 +59,9 @@ func (s *RepositoriesService) Merge(ctx context.Context, owner, repo string, req // GitHub API docs: https://docs.github.com/rest/branches/branches?apiVersion=2022-11-28#sync-a-fork-branch-with-the-upstream-repository // //meta:operation POST /repos/{owner}/{repo}/merge-upstream -func (s *RepositoriesService) MergeUpstream(ctx context.Context, owner, repo string, request *RepoMergeUpstreamRequest) (*RepoMergeUpstreamResult, *Response, error) { +func (s *RepositoriesService) MergeUpstream(ctx context.Context, owner, repo string, body *RepoMergeUpstreamRequest) (*RepoMergeUpstreamResult, *Response, error) { u := fmt.Sprintf("repos/%v/%v/merge-upstream", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/repos_pages.go b/github/repos_pages.go index 9064bcf6556..49b01a6baf8 100644 --- a/github/repos_pages.go +++ b/github/repos_pages.go @@ -163,10 +163,10 @@ type PagesUpdate struct { // GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#update-information-about-a-github-pages-site // //meta:operation PUT /repos/{owner}/{repo}/pages -func (s *RepositoriesService) UpdatePages(ctx context.Context, owner, repo string, opts *PagesUpdate) (*Response, error) { +func (s *RepositoriesService) UpdatePages(ctx context.Context, owner, repo string, body *PagesUpdate) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) - req, err := s.client.NewRequest(ctx, "PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } @@ -192,10 +192,10 @@ type PagesUpdateWithoutCNAME struct { // GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#update-information-about-a-github-pages-site // //meta:operation PUT /repos/{owner}/{repo}/pages -func (s *RepositoriesService) UpdatePagesGHES(ctx context.Context, owner, repo string, opts *PagesUpdateWithoutCNAME) (*Response, error) { +func (s *RepositoriesService) UpdatePagesGHES(ctx context.Context, owner, repo string, body *PagesUpdateWithoutCNAME) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) - req, err := s.client.NewRequest(ctx, "PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } diff --git a/github/repos_prereceive_hooks.go b/github/repos_prereceive_hooks.go index 7119fd60eb2..7e1afe84764 100644 --- a/github/repos_prereceive_hooks.go +++ b/github/repos_prereceive_hooks.go @@ -78,9 +78,9 @@ func (s *RepositoriesService) GetPreReceiveHook(ctx context.Context, owner, repo // GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/repo-pre-receive-hooks#update-pre-receive-hook-enforcement-for-a-repository // //meta:operation PATCH /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} -func (s *RepositoriesService) UpdatePreReceiveHook(ctx context.Context, owner, repo string, id int64, hook *PreReceiveHook) (*PreReceiveHook, *Response, error) { +func (s *RepositoriesService) UpdatePreReceiveHook(ctx context.Context, owner, repo string, id int64, body *PreReceiveHook) (*PreReceiveHook, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%v", owner, repo, id) - req, err := s.client.NewRequest(ctx, "PATCH", u, hook) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/repos_releases.go b/github/repos_releases.go index cedd0a7e469..73c314d299e 100644 --- a/github/repos_releases.go +++ b/github/repos_releases.go @@ -148,9 +148,9 @@ func (s *RepositoriesService) GetReleaseByTag(ctx context.Context, owner, repo, // GitHub API docs: https://docs.github.com/rest/releases/releases?apiVersion=2022-11-28#generate-release-notes-content-for-a-release // //meta:operation POST /repos/{owner}/{repo}/releases/generate-notes -func (s *RepositoriesService) GenerateReleaseNotes(ctx context.Context, owner, repo string, opts *GenerateNotesOptions) (*RepositoryReleaseNotes, *Response, error) { +func (s *RepositoriesService) GenerateReleaseNotes(ctx context.Context, owner, repo string, body *GenerateNotesOptions) (*RepositoryReleaseNotes, *Response, error) { u := fmt.Sprintf("repos/%v/%v/releases/generate-notes", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -410,10 +410,10 @@ func (s *RepositoriesService) downloadReleaseAssetFromURL(ctx context.Context, f // GitHub API docs: https://docs.github.com/rest/releases/assets?apiVersion=2022-11-28#update-a-release-asset // //meta:operation PATCH /repos/{owner}/{repo}/releases/assets/{asset_id} -func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo string, id int64, release *ReleaseAsset) (*ReleaseAsset, *Response, error) { +func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo string, id int64, body *ReleaseAsset) (*ReleaseAsset, *Response, error) { u := fmt.Sprintf("repos/%v/%v/releases/assets/%v", owner, repo, id) - req, err := s.client.NewRequest(ctx, "PATCH", u, release) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/repos_rules.go b/github/repos_rules.go index ddf8929e23b..3baf0f64992 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -221,10 +221,10 @@ func (s *RepositoriesService) GetAllRulesets(ctx context.Context, owner, repo st // GitHub API docs: https://docs.github.com/rest/repos/rules?apiVersion=2022-11-28#create-a-repository-ruleset // //meta:operation POST /repos/{owner}/{repo}/rulesets -func (s *RepositoriesService) CreateRuleset(ctx context.Context, owner, repo string, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { +func (s *RepositoriesService) CreateRuleset(ctx context.Context, owner, repo string, body RepositoryRuleset) (*RepositoryRuleset, *Response, error) { u := fmt.Sprintf("repos/%v/%v/rulesets", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, ruleset) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -266,10 +266,10 @@ func (s *RepositoriesService) GetRuleset(ctx context.Context, owner, repo string // GitHub API docs: https://docs.github.com/rest/repos/rules?apiVersion=2022-11-28#update-a-repository-ruleset // //meta:operation PUT /repos/{owner}/{repo}/rulesets/{ruleset_id} -func (s *RepositoriesService) UpdateRuleset(ctx context.Context, owner, repo string, rulesetID int64, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { +func (s *RepositoriesService) UpdateRuleset(ctx context.Context, owner, repo string, rulesetID int64, body RepositoryRuleset) (*RepositoryRuleset, *Response, error) { u := fmt.Sprintf("repos/%v/%v/rulesets/%v", owner, repo, rulesetID) - req, err := s.client.NewRequest(ctx, "PUT", u, ruleset) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } diff --git a/github/scim.go b/github/scim.go index f82b6bc3880..8e4b0fd5d11 100644 --- a/github/scim.go +++ b/github/scim.go @@ -124,10 +124,10 @@ func (s *SCIMService) ListSCIMProvisionedIdentities(ctx context.Context, org str // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim?apiVersion=2022-11-28#provision-and-invite-a-scim-user // //meta:operation POST /scim/v2/organizations/{org}/Users -func (s *SCIMService) ProvisionAndInviteSCIMUser(ctx context.Context, org string, opts *SCIMUserAttributes) (*SCIMUserAttributes, *Response, error) { +func (s *SCIMService) ProvisionAndInviteSCIMUser(ctx context.Context, org string, body *SCIMUserAttributes) (*SCIMUserAttributes, *Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users", org) - req, err := s.client.NewRequest(ctx, "POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/secret_scanning.go b/github/secret_scanning.go index 74a7dfb3dd6..e0013593de6 100644 --- a/github/secret_scanning.go +++ b/github/secret_scanning.go @@ -287,10 +287,10 @@ func (s *SecretScanningService) GetAlert(ctx context.Context, owner, repo string // GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning?apiVersion=2022-11-28#update-a-secret-scanning-alert // //meta:operation PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} -func (s *SecretScanningService) UpdateAlert(ctx context.Context, owner, repo string, number int64, opts *SecretScanningAlertUpdateOptions) (*SecretScanningAlert, *Response, error) { +func (s *SecretScanningService) UpdateAlert(ctx context.Context, owner, repo string, number int64, body *SecretScanningAlertUpdateOptions) (*SecretScanningAlert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts/%v", owner, repo, number) - req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -341,10 +341,10 @@ func (s *SecretScanningService) ListLocationsForAlert(ctx context.Context, owner // GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning?apiVersion=2022-11-28#create-a-push-protection-bypass // //meta:operation POST /repos/{owner}/{repo}/secret-scanning/push-protection-bypasses -func (s *SecretScanningService) CreatePushProtectionBypass(ctx context.Context, owner, repo string, request PushProtectionBypassRequest) (*PushProtectionBypass, *Response, error) { +func (s *SecretScanningService) CreatePushProtectionBypass(ctx context.Context, owner, repo string, body PushProtectionBypassRequest) (*PushProtectionBypass, *Response, error) { u := fmt.Sprintf("repos/%v/%v/secret-scanning/push-protection-bypasses", owner, repo) - req, err := s.client.NewRequest(ctx, "POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/secret_scanning_pattern_configs.go b/github/secret_scanning_pattern_configs.go index 4599b0faf40..fe880700ff8 100644 --- a/github/secret_scanning_pattern_configs.go +++ b/github/secret_scanning_pattern_configs.go @@ -125,10 +125,10 @@ func (s *SecretScanningService) ListPatternConfigsForOrg(ctx context.Context, or // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/secret-scanning/push-protection?apiVersion=2022-11-28#update-enterprise-pattern-configurations // //meta:operation PATCH /enterprises/{enterprise}/secret-scanning/pattern-configurations -func (s *SecretScanningService) UpdatePatternConfigsForEnterprise(ctx context.Context, enterprise string, opts *SecretScanningPatternConfigsUpdateOptions) (*SecretScanningPatternConfigsUpdate, *Response, error) { +func (s *SecretScanningService) UpdatePatternConfigsForEnterprise(ctx context.Context, enterprise string, body *SecretScanningPatternConfigsUpdateOptions) (*SecretScanningPatternConfigsUpdate, *Response, error) { u := fmt.Sprintf("enterprises/%v/secret-scanning/pattern-configurations", enterprise) - req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -147,10 +147,10 @@ func (s *SecretScanningService) UpdatePatternConfigsForEnterprise(ctx context.Co // GitHub API docs: https://docs.github.com/rest/secret-scanning/push-protection?apiVersion=2022-11-28#update-organization-pattern-configurations // //meta:operation PATCH /orgs/{org}/secret-scanning/pattern-configurations -func (s *SecretScanningService) UpdatePatternConfigsForOrg(ctx context.Context, org string, opts *SecretScanningPatternConfigsUpdateOptions) (*SecretScanningPatternConfigsUpdate, *Response, error) { +func (s *SecretScanningService) UpdatePatternConfigsForOrg(ctx context.Context, org string, body *SecretScanningPatternConfigsUpdateOptions) (*SecretScanningPatternConfigsUpdate, *Response, error) { u := fmt.Sprintf("orgs/%v/secret-scanning/pattern-configurations", org) - req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/sub_issue.go b/github/sub_issue.go index f56980f89a3..210cee501ba 100644 --- a/github/sub_issue.go +++ b/github/sub_issue.go @@ -100,9 +100,9 @@ func (s *SubIssueService) ListByIssue(ctx context.Context, owner, repo string, i // GitHub API docs: https://docs.github.com/rest/issues/sub-issues?apiVersion=2022-11-28#add-sub-issue // //meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/sub_issues -func (s *SubIssueService) Add(ctx context.Context, owner, repo string, issueNumber int64, subIssue SubIssueRequest) (*SubIssue, *Response, error) { +func (s *SubIssueService) Add(ctx context.Context, owner, repo string, issueNumber int64, body SubIssueRequest) (*SubIssue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/sub_issues", owner, repo, issueNumber) - req, err := s.client.NewRequest(ctx, "POST", u, subIssue) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -123,9 +123,9 @@ func (s *SubIssueService) Add(ctx context.Context, owner, repo string, issueNumb // GitHub API docs: https://docs.github.com/rest/issues/sub-issues?apiVersion=2022-11-28#reprioritize-sub-issue // //meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number}/sub_issues/priority -func (s *SubIssueService) Reprioritize(ctx context.Context, owner, repo string, issueNumber int64, subIssue SubIssueRequest) (*SubIssue, *Response, error) { +func (s *SubIssueService) Reprioritize(ctx context.Context, owner, repo string, issueNumber int64, body SubIssueRequest) (*SubIssue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/sub_issues/priority", owner, repo, issueNumber) - req, err := s.client.NewRequest(ctx, "PATCH", u, subIssue) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/teams.go b/github/teams.go index 9944919eb3d..b108137a9a3 100644 --- a/github/teams.go +++ b/github/teams.go @@ -199,9 +199,9 @@ func (s NewTeam) String() string { // GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#create-a-team // //meta:operation POST /orgs/{org}/teams -func (s *TeamsService) CreateTeam(ctx context.Context, org string, team NewTeam) (*Team, *Response, error) { +func (s *TeamsService) CreateTeam(ctx context.Context, org string, body NewTeam) (*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/teams", org) - req, err := s.client.NewRequest(ctx, "POST", u, team) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -251,16 +251,16 @@ func copyNewTeamWithoutParent(team *NewTeam) *newTeamNoParent { // GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#update-a-team // //meta:operation PATCH /orgs/{org}/teams/{team_slug} -func (s *TeamsService) EditTeamByID(ctx context.Context, orgID, teamID int64, team NewTeam, removeParent bool) (*Team, *Response, error) { +func (s *TeamsService) EditTeamByID(ctx context.Context, orgID, teamID int64, body NewTeam, removeParent bool) (*Team, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v", orgID, teamID) var req *http.Request var err error if removeParent { - teamRemoveParent := copyNewTeamWithoutParent(&team) + teamRemoveParent := copyNewTeamWithoutParent(&body) req, err = s.client.NewRequest(ctx, "PATCH", u, teamRemoveParent) } else { - req, err = s.client.NewRequest(ctx, "PATCH", u, team) + req, err = s.client.NewRequest(ctx, "PATCH", u, body) } if err != nil { return nil, nil, err @@ -280,16 +280,16 @@ func (s *TeamsService) EditTeamByID(ctx context.Context, orgID, teamID int64, te // GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#update-a-team // //meta:operation PATCH /orgs/{org}/teams/{team_slug} -func (s *TeamsService) EditTeamBySlug(ctx context.Context, org, slug string, team NewTeam, removeParent bool) (*Team, *Response, error) { +func (s *TeamsService) EditTeamBySlug(ctx context.Context, org, slug string, body NewTeam, removeParent bool) (*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v", org, slug) var req *http.Request var err error if removeParent { - teamRemoveParent := copyNewTeamWithoutParent(&team) + teamRemoveParent := copyNewTeamWithoutParent(&body) req, err = s.client.NewRequest(ctx, "PATCH", u, teamRemoveParent) } else { - req, err = s.client.NewRequest(ctx, "PATCH", u, team) + req, err = s.client.NewRequest(ctx, "PATCH", u, body) } if err != nil { return nil, nil, err @@ -524,9 +524,9 @@ type TeamAddTeamRepoOptions struct { // GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#add-or-update-team-repository-permissions // //meta:operation PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} -func (s *TeamsService) AddTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string, opts *TeamAddTeamRepoOptions) (*Response, error) { +func (s *TeamsService) AddTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string, body *TeamAddTeamRepoOptions) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/repos/%v/%v", orgID, teamID, owner, repo) - req, err := s.client.NewRequest(ctx, "PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } @@ -541,9 +541,9 @@ func (s *TeamsService) AddTeamRepoByID(ctx context.Context, orgID, teamID int64, // GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#add-or-update-team-repository-permissions // //meta:operation PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} -func (s *TeamsService) AddTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string, opts *TeamAddTeamRepoOptions) (*Response, error) { +func (s *TeamsService) AddTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string, body *TeamAddTeamRepoOptions) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/repos/%v/%v", org, slug, owner, repo) - req, err := s.client.NewRequest(ctx, "PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } @@ -738,9 +738,9 @@ type TeamProjectOptions struct { // GitHub API docs: https://docs.github.com/enterprise-server@3.16/rest/teams/teams#add-or-update-team-project-permissions // //meta:operation PUT /orgs/{org}/teams/{team_slug}/projects/{project_id} -func (s *TeamsService) AddTeamProjectByID(ctx context.Context, orgID, teamID, projectID int64, opts *TeamProjectOptions) (*Response, error) { +func (s *TeamsService) AddTeamProjectByID(ctx context.Context, orgID, teamID, projectID int64, body *TeamProjectOptions) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/projects/%v", orgID, teamID, projectID) - req, err := s.client.NewRequest(ctx, "PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } @@ -759,9 +759,9 @@ func (s *TeamsService) AddTeamProjectByID(ctx context.Context, orgID, teamID, pr // GitHub API docs: https://docs.github.com/enterprise-server@3.16/rest/teams/teams#add-or-update-team-project-permissions // //meta:operation PUT /orgs/{org}/teams/{team_slug}/projects/{project_id} -func (s *TeamsService) AddTeamProjectBySlug(ctx context.Context, org, slug string, projectID int64, opts *TeamProjectOptions) (*Response, error) { +func (s *TeamsService) AddTeamProjectBySlug(ctx context.Context, org, slug string, projectID int64, body *TeamProjectOptions) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/projects/%v", org, slug, projectID) - req, err := s.client.NewRequest(ctx, "PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } @@ -921,10 +921,10 @@ func (s *TeamsService) ListIDPGroupsForTeamBySlug(ctx context.Context, org, slug // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync?apiVersion=2022-11-28#create-or-update-idp-group-connections // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/team-sync/group-mappings -func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsByID(ctx context.Context, orgID, teamID int64, opts IDPGroupList) (*IDPGroupList, *Response, error) { +func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsByID(ctx context.Context, orgID, teamID int64, body IDPGroupList) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/team-sync/group-mappings", orgID, teamID) - req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -944,10 +944,10 @@ func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsByID(ctx context.Context // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync?apiVersion=2022-11-28#create-or-update-idp-group-connections // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/team-sync/group-mappings -func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsBySlug(ctx context.Context, org, slug string, opts IDPGroupList) (*IDPGroupList, *Response, error) { +func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsBySlug(ctx context.Context, org, slug string, body IDPGroupList) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/team-sync/group-mappings", org, slug) - req, err := s.client.NewRequest(ctx, "PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -1071,10 +1071,10 @@ func (s *TeamsService) ListExternalGroupsForTeamBySlug(ctx context.Context, org, // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups?apiVersion=2022-11-28#update-the-connection-between-an-external-group-and-a-team // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/external-groups -func (s *TeamsService) UpdateConnectedExternalGroup(ctx context.Context, org, slug string, eg *ExternalGroup) (*ExternalGroup, *Response, error) { +func (s *TeamsService) UpdateConnectedExternalGroup(ctx context.Context, org, slug string, body *ExternalGroup) (*ExternalGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/external-groups", org, slug) - req, err := s.client.NewRequest(ctx, "PATCH", u, eg) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/teams_discussion_comments.go b/github/teams_discussion_comments.go index fe9ea1770ea..c178ed12090 100644 --- a/github/teams_discussion_comments.go +++ b/github/teams_discussion_comments.go @@ -145,9 +145,9 @@ func (s *TeamsService) GetCommentBySlug(ctx context.Context, org, slug string, d // GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#create-a-discussion-comment // //meta:operation POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments -func (s *TeamsService) CreateCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { +func (s *TeamsService) CreateCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber int, body DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments", orgID, teamID, discussionNumber) - req, err := s.client.NewRequest(ctx, "POST", u, comment) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -167,9 +167,9 @@ func (s *TeamsService) CreateCommentByID(ctx context.Context, orgID, teamID int6 // GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#create-a-discussion-comment // //meta:operation POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments -func (s *TeamsService) CreateCommentBySlug(ctx context.Context, org, slug string, discussionNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { +func (s *TeamsService) CreateCommentBySlug(ctx context.Context, org, slug string, discussionNumber int, body DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments", org, slug, discussionNumber) - req, err := s.client.NewRequest(ctx, "POST", u, comment) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -190,9 +190,9 @@ func (s *TeamsService) CreateCommentBySlug(ctx context.Context, org, slug string // GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#update-a-discussion-comment // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} -func (s *TeamsService) EditCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { +func (s *TeamsService) EditCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int, body DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v", orgID, teamID, discussionNumber, commentNumber) - req, err := s.client.NewRequest(ctx, "PATCH", u, comment) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -213,9 +213,9 @@ func (s *TeamsService) EditCommentByID(ctx context.Context, orgID, teamID int64, // GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#update-a-discussion-comment // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} -func (s *TeamsService) EditCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { +func (s *TeamsService) EditCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int, body DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v", org, slug, discussionNumber, commentNumber) - req, err := s.client.NewRequest(ctx, "PATCH", u, comment) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/teams_discussions.go b/github/teams_discussions.go index 22440906857..5a5c44c3ed1 100644 --- a/github/teams_discussions.go +++ b/github/teams_discussions.go @@ -150,9 +150,9 @@ func (s *TeamsService) GetDiscussionBySlug(ctx context.Context, org, slug string // GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#create-a-discussion // //meta:operation POST /orgs/{org}/teams/{team_slug}/discussions -func (s *TeamsService) CreateDiscussionByID(ctx context.Context, orgID, teamID int64, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { +func (s *TeamsService) CreateDiscussionByID(ctx context.Context, orgID, teamID int64, body TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions", orgID, teamID) - req, err := s.client.NewRequest(ctx, "POST", u, discussion) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -172,9 +172,9 @@ func (s *TeamsService) CreateDiscussionByID(ctx context.Context, orgID, teamID i // GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#create-a-discussion // //meta:operation POST /orgs/{org}/teams/{team_slug}/discussions -func (s *TeamsService) CreateDiscussionBySlug(ctx context.Context, org, slug string, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { +func (s *TeamsService) CreateDiscussionBySlug(ctx context.Context, org, slug string, body TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions", org, slug) - req, err := s.client.NewRequest(ctx, "POST", u, discussion) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } @@ -195,9 +195,9 @@ func (s *TeamsService) CreateDiscussionBySlug(ctx context.Context, org, slug str // GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#update-a-discussion // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} -func (s *TeamsService) EditDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { +func (s *TeamsService) EditDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int, body TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v", orgID, teamID, discussionNumber) - req, err := s.client.NewRequest(ctx, "PATCH", u, discussion) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -218,9 +218,9 @@ func (s *TeamsService) EditDiscussionByID(ctx context.Context, orgID, teamID int // GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#update-a-discussion // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} -func (s *TeamsService) EditDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { +func (s *TeamsService) EditDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int, body TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v", org, slug, discussionNumber) - req, err := s.client.NewRequest(ctx, "PATCH", u, discussion) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/teams_members.go b/github/teams_members.go index bbea6850407..d7092630427 100644 --- a/github/teams_members.go +++ b/github/teams_members.go @@ -138,9 +138,9 @@ type TeamAddTeamMembershipOptions struct { // GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#add-or-update-team-membership-for-a-user // //meta:operation PUT /orgs/{org}/teams/{team_slug}/memberships/{username} -func (s *TeamsService) AddTeamMembershipByID(ctx context.Context, orgID, teamID int64, user string, opts *TeamAddTeamMembershipOptions) (*Membership, *Response, error) { +func (s *TeamsService) AddTeamMembershipByID(ctx context.Context, orgID, teamID int64, user string, body *TeamAddTeamMembershipOptions) (*Membership, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/memberships/%v", orgID, teamID, user) - req, err := s.client.NewRequest(ctx, "PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } @@ -160,9 +160,9 @@ func (s *TeamsService) AddTeamMembershipByID(ctx context.Context, orgID, teamID // GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#add-or-update-team-membership-for-a-user // //meta:operation PUT /orgs/{org}/teams/{team_slug}/memberships/{username} -func (s *TeamsService) AddTeamMembershipBySlug(ctx context.Context, org, slug, user string, opts *TeamAddTeamMembershipOptions) (*Membership, *Response, error) { +func (s *TeamsService) AddTeamMembershipBySlug(ctx context.Context, org, slug, user string, body *TeamAddTeamMembershipOptions) (*Membership, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/memberships/%v", org, slug, user) - req, err := s.client.NewRequest(ctx, "PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } diff --git a/github/users.go b/github/users.go index 00108a9ba5a..e1078329f86 100644 --- a/github/users.go +++ b/github/users.go @@ -143,9 +143,9 @@ func (s *UsersService) GetByID(ctx context.Context, id int64) (*User, *Response, // GitHub API docs: https://docs.github.com/rest/users/users?apiVersion=2022-11-28#update-the-authenticated-user // //meta:operation PATCH /user -func (s *UsersService) Edit(ctx context.Context, user *User) (*User, *Response, error) { +func (s *UsersService) Edit(ctx context.Context, body *User) (*User, *Response, error) { u := "user" - req, err := s.client.NewRequest(ctx, "PATCH", u, user) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } diff --git a/github/users_administration.go b/github/users_administration.go index 2f09e408ad2..5a5b8edb875 100644 --- a/github/users_administration.go +++ b/github/users_administration.go @@ -52,10 +52,10 @@ type UserSuspendOptions struct { // GitHub API docs: https://docs.github.com/enterprise-server@3.21/rest/enterprise-admin/users#suspend-a-user // //meta:operation PUT /users/{username}/suspended -func (s *UsersService) Suspend(ctx context.Context, user string, opts *UserSuspendOptions) (*Response, error) { +func (s *UsersService) Suspend(ctx context.Context, user string, body *UserSuspendOptions) (*Response, error) { u := fmt.Sprintf("users/%v/suspended", user) - req, err := s.client.NewRequest(ctx, "PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } diff --git a/github/users_emails.go b/github/users_emails.go index 33e0f261c81..bccaa28c4b7 100644 --- a/github/users_emails.go +++ b/github/users_emails.go @@ -46,9 +46,9 @@ func (s *UsersService) ListEmails(ctx context.Context, opts *ListOptions) ([]*Us // GitHub API docs: https://docs.github.com/rest/users/emails?apiVersion=2022-11-28#add-an-email-address-for-the-authenticated-user // //meta:operation POST /user/emails -func (s *UsersService) AddEmails(ctx context.Context, emails []string) ([]*UserEmail, *Response, error) { +func (s *UsersService) AddEmails(ctx context.Context, body []string) ([]*UserEmail, *Response, error) { u := "user/emails" - req, err := s.client.NewRequest(ctx, "POST", u, emails) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/users_keys.go b/github/users_keys.go index 0c981d7128b..c8952fbdb5f 100644 --- a/github/users_keys.go +++ b/github/users_keys.go @@ -89,10 +89,10 @@ func (s *UsersService) GetKey(ctx context.Context, id int64) (*Key, *Response, e // GitHub API docs: https://docs.github.com/rest/users/keys?apiVersion=2022-11-28#create-a-public-ssh-key-for-the-authenticated-user // //meta:operation POST /user/keys -func (s *UsersService) CreateKey(ctx context.Context, key *Key) (*Key, *Response, error) { +func (s *UsersService) CreateKey(ctx context.Context, body *Key) (*Key, *Response, error) { u := "user/keys" - req, err := s.client.NewRequest(ctx, "POST", u, key) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/github/users_ssh_signing_keys.go b/github/users_ssh_signing_keys.go index 1ddda7fd803..a25deabdc21 100644 --- a/github/users_ssh_signing_keys.go +++ b/github/users_ssh_signing_keys.go @@ -84,10 +84,10 @@ func (s *UsersService) GetSSHSigningKey(ctx context.Context, id int64) (*SSHSign // GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys?apiVersion=2022-11-28#create-a-ssh-signing-key-for-the-authenticated-user // //meta:operation POST /user/ssh_signing_keys -func (s *UsersService) CreateSSHSigningKey(ctx context.Context, key *Key) (*SSHSigningKey, *Response, error) { +func (s *UsersService) CreateSSHSigningKey(ctx context.Context, body *Key) (*SSHSigningKey, *Response, error) { u := "user/ssh_signing_keys" - req, err := s.client.NewRequest(ctx, "POST", u, key) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } diff --git a/tools/requestbody/go.mod b/tools/requestbody/go.mod new file mode 100644 index 00000000000..063c009d47b --- /dev/null +++ b/tools/requestbody/go.mod @@ -0,0 +1,13 @@ +module tools/requestbody + +go 1.25.0 + +require ( + github.com/golangci/plugin-module-register v0.1.2 + golang.org/x/tools v0.45.0 +) + +require ( + golang.org/x/mod v0.36.0 // indirect + golang.org/x/sync v0.20.0 // indirect +) diff --git a/tools/requestbody/go.sum b/tools/requestbody/go.sum new file mode 100644 index 00000000000..fd1fd4c392c --- /dev/null +++ b/tools/requestbody/go.sum @@ -0,0 +1,10 @@ +github.com/golangci/plugin-module-register v0.1.2 h1:e5WM6PO6NIAEcij3B053CohVp3HIYbzSuP53UAYgOpg= +github.com/golangci/plugin-module-register v0.1.2/go.mod h1:1+QGTsKBvAIvPvoY/os+G5eoqxWn70HYDm2uvUyGuVw= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +golang.org/x/mod v0.36.0 h1:JJjpVx6myfUsUdAzZuOSTTmRE0PfZeNWzzvKrP7amb4= +golang.org/x/mod v0.36.0/go.mod h1:moc6ELqsWcOw5Ef3xVprK5ul/MvtVvkIXLziUOICjUQ= +golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= +golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/tools v0.45.0 h1:18qN3FAooORvApf5XjCXgsuayZOEtXf6JK18I3+ONa8= +golang.org/x/tools v0.45.0/go.mod h1:LuUGqqaXcXMEFEruIVJVm5mgDD8vww/z/SR1gQ4uE/0= diff --git a/tools/requestbody/requestbody.go b/tools/requestbody/requestbody.go new file mode 100644 index 00000000000..adabfae38eb --- /dev/null +++ b/tools/requestbody/requestbody.go @@ -0,0 +1,275 @@ +// Copyright 2026 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 requestbody is a custom linter for client.NewRequest body parameters. +// +// For client.NewRequest calls using the PATCH, POST, or PUT methods it: +// - suggests renaming a body parameter to "body" +// - reports body parameters passed by pointer, which should be passed by value +// - reports body parameter types with an "Options" suffix, which should use a "Request" suffix instead. +package requestbody + +import ( + "fmt" + "go/ast" + "go/token" + "strings" + + "github.com/golangci/plugin-module-register/register" + "golang.org/x/tools/go/analysis" +) + +func init() { + register.Plugin("requestbody", New) +} + +// RequestBodyPlugin is a custom linter plugin for golangci-lint. +type RequestBodyPlugin struct { + // allowedPointerTypes are body type names exempt from the by-value rule. + allowedPointerTypes map[string]bool + // allowedWrongNames are body type names exempt from the "Options" suffix rule. + allowedWrongNames map[string]bool +} + +// New returns an analysis.Analyzer to use with golangci-lint. +func New(cfg any) (register.LinterPlugin, error) { + allowedPointerTypes := map[string]bool{} + allowedWrongNames := map[string]bool{} + + if cfg != nil { + if settingsMap, ok := cfg.(map[string]any); ok { + if exceptionsRaw, ok := settingsMap["allowed-pointer-types"]; ok { + if exceptionsList, ok := exceptionsRaw.([]any); ok { + for _, item := range exceptionsList { + if exception, ok := item.(string); ok { + allowedPointerTypes[exception] = true + } + } + } + } + + if exceptionsRaw, ok := settingsMap["allowed-wrong-names"]; ok { + if exceptionsList, ok := exceptionsRaw.([]any); ok { + for _, item := range exceptionsList { + if exception, ok := item.(string); ok { + allowedWrongNames[exception] = true + } + } + } + } + } + } + return &RequestBodyPlugin{ + allowedPointerTypes: allowedPointerTypes, + allowedWrongNames: allowedWrongNames, + }, nil +} + +// BuildAnalyzers builds the analyzers for the RequestBodyPlugin. +func (p *RequestBodyPlugin) BuildAnalyzers() ([]*analysis.Analyzer, error) { + return []*analysis.Analyzer{ + { + Name: "requestbody", + Doc: "Reports issues with request body parameters in client.NewRequest PATCH/POST/PUT calls.", + Run: p.run, + }, + }, nil +} + +// GetLoadMode returns the load mode for the RequestBodyPlugin. +func (p *RequestBodyPlugin) GetLoadMode() string { + return register.LoadModeSyntax +} + +func (p *RequestBodyPlugin) run(pass *analysis.Pass) (any, error) { + for _, file := range pass.Files { + for _, decl := range file.Decls { + fn, ok := decl.(*ast.FuncDecl) + if !ok || fn.Body == nil { + continue + } + p.analyzeFunc(pass, fn) + } + } + return nil, nil +} + +func (p *RequestBodyPlugin) analyzeFunc(pass *analysis.Pass, fn *ast.FuncDecl) { + ast.Inspect(fn.Body, func(n ast.Node) bool { + call, ok := n.(*ast.CallExpr) + if !ok || !isClientNewRequest(call) || !isMutatingMethod(call) { + return true + } + + bodyIdent, ok := call.Args[3].(*ast.Ident) + if !ok { + return true + } + + field, name := findParam(fn, bodyIdent.Name) + if field == nil { + return true + } + + reportRename(pass, fn, name) + p.reportByValue(pass, field, name) + p.reportTypeSuffix(pass, field) + return true + }) +} + +func reportRename(pass *analysis.Pass, fn *ast.FuncDecl, name *ast.Ident) { + if name.Name == "body" { + return + } + + diag := analysis.Diagnostic{ + Pos: name.Pos(), + End: name.End(), + Message: fmt.Sprintf("rename request body parameter %q to \"body\"", name.Name), + } + if edits := renameEdits(fn, name.Name); edits != nil { + diag.SuggestedFixes = []analysis.SuggestedFix{ + { + Message: `Rename to "body"`, + TextEdits: edits, + }, + } + } + pass.Report(diag) +} + +func (p *RequestBodyPlugin) reportByValue(pass *analysis.Pass, field *ast.Field, name *ast.Ident) { + if _, ok := field.Type.(*ast.StarExpr); !ok { + return + } + if ident := typeNameIdent(field.Type); ident != nil && p.allowedPointerTypes[ident.Name] { + return + } + pass.Report(analysis.Diagnostic{ + Pos: name.Pos(), + End: name.End(), + Message: fmt.Sprintf("pass request body %q by value, not by pointer", name.Name), + }) +} + +// reportTypeSuffix reports body parameter types whose name ends with "Options", which should use a "Request" suffix instead +// (e.g. UserSuspendOptions -> UserSuspendRequest). +// It is report-only because renaming a type affects its declaration and every use across the codebase. +func (p *RequestBodyPlugin) reportTypeSuffix(pass *analysis.Pass, field *ast.Field) { + ident := typeNameIdent(field.Type) + if ident == nil || !strings.HasSuffix(ident.Name, "Options") { + return + } + if p.allowedWrongNames[ident.Name] { + return + } + pass.Report(analysis.Diagnostic{ + Pos: ident.Pos(), + End: ident.End(), + Message: fmt.Sprintf("request body type %q should use a \"Request\" suffix, not \"Options\"", ident.Name), + }) +} + +// isClientNewRequest reports whether call is of the form x.client.NewRequest(...) or client.NewRequest(...). +func isClientNewRequest(call *ast.CallExpr) bool { + sel, ok := call.Fun.(*ast.SelectorExpr) + if !ok || sel.Sel.Name != "NewRequest" { + return false + } + switch x := sel.X.(type) { + case *ast.SelectorExpr: + return x.Sel.Name == "client" + case *ast.Ident: + return x.Name == "client" + default: + return false + } +} + +// isMutatingMethod reports whether the call's method argument is "PATCH", "POST", or "PUT" and a body argument is present. +func isMutatingMethod(call *ast.CallExpr) bool { + if len(call.Args) < 4 { + return false + } + lit, ok := call.Args[1].(*ast.BasicLit) + if !ok || lit.Kind != token.STRING { + return false + } + switch lit.Value { + case `"PATCH"`, `"POST"`, `"PUT"`: + return true + default: + return false + } +} + +func findParam(fn *ast.FuncDecl, name string) (*ast.Field, *ast.Ident) { + if fn.Type.Params == nil { + return nil, nil + } + for _, field := range fn.Type.Params.List { + for _, ident := range field.Names { + if ident.Name == name { + return field, ident + } + } + } + return nil, nil +} + +// typeNameIdent returns the base type name identifier of expr, unwrapping a pointer and resolving a qualified (pkg.Type) selector. +func typeNameIdent(expr ast.Expr) *ast.Ident { + switch t := expr.(type) { + case *ast.StarExpr: + return typeNameIdent(t.X) + case *ast.Ident: + return t + case *ast.SelectorExpr: + return t.Sel + default: + return nil + } +} + +// renameEdits builds the text edits that rename every reference to the old parameter within fn to "body". +// It returns nil (no auto-fix) when "body" is already used as an identifier in fn or when old is shadowed by a local declaration, +// since either case could make the rename incorrect. +func renameEdits(fn *ast.FuncDecl, old string) []analysis.TextEdit { + const newName = "body" + + // Idents that are the selector field (x.old) must not be renamed. + skip := map[*ast.Ident]bool{} + ast.Inspect(fn, func(n ast.Node) bool { + if sel, ok := n.(*ast.SelectorExpr); ok { + skip[sel.Sel] = true + } + return true + }) + + var edits []analysis.TextEdit + conflict := false + ast.Inspect(fn, func(n ast.Node) bool { + ident, ok := n.(*ast.Ident) + if !ok || skip[ident] { + return true + } + switch ident.Name { + case newName: + conflict = true + case old: + edits = append(edits, analysis.TextEdit{ + Pos: ident.Pos(), + End: ident.End(), + NewText: []byte(newName), + }) + } + return true + }) + if conflict { + return nil + } + return edits +} diff --git a/tools/requestbody/requestbody_test.go b/tools/requestbody/requestbody_test.go new file mode 100644 index 00000000000..b33e104944a --- /dev/null +++ b/tools/requestbody/requestbody_test.go @@ -0,0 +1,23 @@ +// Copyright 2026 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 requestbody + +import ( + "testing" + + "golang.org/x/tools/go/analysis/analysistest" +) + +func TestRun(t *testing.T) { + t.Parallel() + testdata := analysistest.TestData() + plugin, _ := New(map[string]any{ + "allowed-pointer-types": []any{"AllowedPtr"}, + "allowed-wrong-names": []any{"AllowedOptions"}, + }) + analyzers, _ := plugin.BuildAnalyzers() + analysistest.Run(t, testdata, analyzers[0], "has-warnings", "no-warnings") +} diff --git a/tools/requestbody/testdata/src/has-warnings/github.go b/tools/requestbody/testdata/src/has-warnings/github.go new file mode 100644 index 00000000000..10be21b894c --- /dev/null +++ b/tools/requestbody/testdata/src/has-warnings/github.go @@ -0,0 +1,54 @@ +// Copyright 2026 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" + +type Client struct{} + +func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body any) error { + return nil +} + +type service struct { + client *Client +} + +type CreateRequest struct { + Name string +} + +type UpdateRequest struct { + Name string +} + +type SuspendOptions struct { + Reason string +} + +type ServerOptions struct { + Host string +} + +// opts named, value, good type: rename only. +func (s *service) Create(ctx context.Context, opts CreateRequest) error { // want `rename request body parameter "opts" to "body"` + return s.client.NewRequest(ctx, "POST", "u", opts) +} + +// request named, pointer, good type: rename and by-value. +func (s *service) Update(ctx context.Context, request *UpdateRequest) error { // want `rename request body parameter "request" to "body"` `pass request body "request" by value, not by pointer` + return s.client.NewRequest(ctx, "PATCH", "u", request) +} + +// opts named, pointer, Options-suffixed type: rename, by-value, and type suffix. +func (s *service) Suspend(ctx context.Context, opts *SuspendOptions) error { // want `rename request body parameter "opts" to "body"` `pass request body "opts" by value, not by pointer` `request body type "SuspendOptions" should use a "Request" suffix, not "Options"` + return s.client.NewRequest(ctx, "PUT", "u", opts) +} + +// Domain-specific name, value, Options-suffixed type: rename and type suffix. +func (s *service) Save(ctx context.Context, settings ServerOptions) error { // want `rename request body parameter "settings" to "body"` `request body type "ServerOptions" should use a "Request" suffix, not "Options"` + return s.client.NewRequest(ctx, "POST", "u", settings) +} diff --git a/tools/requestbody/testdata/src/no-warnings/github.go b/tools/requestbody/testdata/src/no-warnings/github.go new file mode 100644 index 00000000000..8f4d0008f25 --- /dev/null +++ b/tools/requestbody/testdata/src/no-warnings/github.go @@ -0,0 +1,76 @@ +// Copyright 2026 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" + +type Client struct{} + +func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body any) error { + return nil +} + +type service struct { + client *Client +} + +type CreateRequest struct { + Name string +} + +type ListOptions struct { + Page int +} + +type AllowedPtr struct { + Name string +} + +type AllowedOptions struct { + Name string +} + +// Already named body, value, good type: no warning. +func (s *service) Create(ctx context.Context, body CreateRequest) error { + return s.client.NewRequest(ctx, "POST", "u", body) +} + +// No body: no warning. +func (s *service) Delete(ctx context.Context, id string) error { + return s.client.NewRequest(ctx, "DELETE", "u", nil) +} + +// GET with an Options-suffixed pointer must not fire any rule. +func (s *service) List(ctx context.Context, opts *ListOptions) error { + return s.client.NewRequest(ctx, "GET", "u", opts) +} + +// Named body, value, good type: no warning. +func (s *service) Save(ctx context.Context, body CreateRequest) error { + return s.client.NewRequest(ctx, "PUT", "u", body) +} + +// Not a client.NewRequest receiver: no warning. +type other struct{} + +func (o *other) NewRequest(ctx context.Context, method, urlStr string, body any) error { + return nil +} + +func (s *service) Other(ctx context.Context, opts *ListOptions) error { + var o other + return o.NewRequest(ctx, "POST", "u", opts) +} + +// Pointer body whose type is in allowed-pointer-types: by-value rule suppressed. +func (s *service) IgnoredPointer(ctx context.Context, body *AllowedPtr) error { + return s.client.NewRequest(ctx, "PUT", "u", body) +} + +// Options-suffixed body whose type is in allowed-wrong-names: suffix rule suppressed. +func (s *service) IgnoredOptions(ctx context.Context, body AllowedOptions) error { + return s.client.NewRequest(ctx, "POST", "u", body) +}