From a4a6b2d63d2e9e8ebdb728c97e7358480eadcae0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 Mar 2026 06:34:05 +0000 Subject: [PATCH] Bump github.com/bradleyfalzon/ghinstallation/v2 from 2.17.0 to 2.18.0 Bumps [github.com/bradleyfalzon/ghinstallation/v2](https://github.com/bradleyfalzon/ghinstallation) from 2.17.0 to 2.18.0. - [Release notes](https://github.com/bradleyfalzon/ghinstallation/releases) - [Commits](https://github.com/bradleyfalzon/ghinstallation/compare/v2.17.0...v2.18.0) --- updated-dependencies: - dependency-name: github.com/bradleyfalzon/ghinstallation/v2 dependency-version: 2.18.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 4 +- go.sum | 8 +- .../ghinstallation/v2/appsTransport.go | 1 + .../ghinstallation/v2/transport.go | 3 +- .../google/go-github/v75/github/billing.go | 314 - .../google/go-github/v75/github/classroom.go | 82 - .../google/go-github/v75/github/codespaces.go | 266 - .../google/go-github/{v75 => v84}/AUTHORS | 21 + .../google/go-github/{v75 => v84}/LICENSE | 0 .../go-github/{v75 => v84}/github/actions.go | 0 .../{v75 => v84}/github/actions_artifacts.go | 0 .../{v75 => v84}/github/actions_cache.go | 2 +- .../github/actions_hosted_runners.go | 84 +- .../{v75 => v84}/github/actions_oidc.go | 0 .../github/actions_permissions_enterprise.go | 57 +- .../github/actions_permissions_orgs.go | 58 +- .../github/actions_runner_groups.go | 5 + .../{v75 => v84}/github/actions_runners.go | 0 .../{v75 => v84}/github/actions_secrets.go | 0 .../{v75 => v84}/github/actions_variables.go | 0 .../github/actions_workflow_jobs.go | 4 +- .../github/actions_workflow_runs.go | 10 +- .../{v75 => v84}/github/actions_workflows.go | 41 +- .../go-github/{v75 => v84}/github/activity.go | 0 .../{v75 => v84}/github/activity_events.go | 2 + .../github/activity_notifications.go | 4 +- .../{v75 => v84}/github/activity_star.go | 5 +- .../{v75 => v84}/github/activity_watching.go | 9 +- .../go-github/{v75 => v84}/github/admin.go | 4 +- .../{v75 => v84}/github/admin_orgs.go | 6 +- .../{v75 => v84}/github/admin_stats.go | 2 +- .../{v75 => v84}/github/admin_users.go | 12 +- .../go-github/{v75 => v84}/github/apps.go | 6 +- .../{v75 => v84}/github/apps_hooks.go | 0 .../github/apps_hooks_deliveries.go | 0 .../{v75 => v84}/github/apps_installation.go | 0 .../{v75 => v84}/github/apps_manifest.go | 2 +- .../{v75 => v84}/github/apps_marketplace.go | 4 + .../{v75 => v84}/github/attestations.go | 0 .../{v75 => v84}/github/authorizations.go | 4 +- .../google/go-github/v84/github/billing.go | 394 + .../go-github/{v75 => v84}/github/checks.go | 0 .../google/go-github/v84/github/classroom.go | 256 + .../{v75 => v84}/github/code_scanning.go | 4 +- .../{v75 => v84}/github/codesofconduct.go | 4 +- .../google/go-github/v84/github/codespaces.go | 591 ++ .../v84/github/codespaces_machines.go | 74 + .../go-github/v84/github/codespaces_orgs.go | 173 + .../{v75 => v84}/github/codespaces_secrets.go | 0 .../go-github/{v75 => v84}/github/copilot.go | 210 + .../go-github/v84/github/credentials.go | 37 + .../{v75 => v84}/github/dependabot.go | 0 .../{v75 => v84}/github/dependabot_alerts.go | 0 .../{v75 => v84}/github/dependabot_secrets.go | 0 .../{v75 => v84}/github/dependency_graph.go | 0 .../github/dependency_graph_snapshots.go | 0 .../go-github/{v75 => v84}/github/doc.go | 13 +- .../go-github/{v75 => v84}/github/emojis.go | 0 .../{v75 => v84}/github/enterprise.go | 0 .../enterprise_actions_hosted_runners.go | 12 +- .../enterprise_actions_runner_groups.go | 0 .../github/enterprise_actions_runners.go | 2 +- .../v84/github/enterprise_app_installation.go | 159 + .../go-github/v84/github/enterprise_apps.go | 116 + .../github/enterprise_audit_log.go | 0 .../github/enterprise_billing_cost_centers.go | 233 + .../enterprise_code_security_and_analysis.go | 0 .../enterprise_codesecurity_configurations.go | 232 + .../v84/github/enterprise_licenses.go | 138 + .../github/enterprise_manage_ghes.go | 8 +- .../github/enterprise_manage_ghes_config.go | 30 +- .../enterprise_manage_ghes_maintenance.go | 4 +- .../github/enterprise_manage_ghes_ssh.go | 6 +- .../enterprise_network_configurations.go | 0 .../enterprise_organization_properties.go | 189 + .../github/enterprise_properties.go | 0 .../{v75 => v84}/github/enterprise_rules.go | 25 - .../go-github/v84/github/enterprise_scim.go | 481 ++ .../go-github/v84/github/enterprise_team.go | 420 + .../go-github/{v75 => v84}/github/event.go | 0 .../{v75 => v84}/github/event_types.go | 54 +- .../go-github/{v75 => v84}/github/gists.go | 1 + .../{v75 => v84}/github/gists_comments.go | 0 .../go-github/{v75 => v84}/github/git.go | 0 .../{v75 => v84}/github/git_blobs.go | 0 .../{v75 => v84}/github/git_commits.go | 8 +- .../go-github/{v75 => v84}/github/git_refs.go | 22 +- .../go-github/{v75 => v84}/github/git_tags.go | 0 .../{v75 => v84}/github/git_trees.go | 13 + .../{v75 => v84}/github/github-accessors.go | 2956 ++++++- .../go-github/v84/github/github-iterators.go | 7390 +++++++++++++++++ .../go-github/{v75 => v84}/github/github.go | 173 +- .../{v75 => v84}/github/gitignore.go | 0 .../{v75 => v84}/github/interactions.go | 0 .../{v75 => v84}/github/interactions_orgs.go | 3 - .../{v75 => v84}/github/interactions_repos.go | 3 - .../{v75 => v84}/github/issue_import.go | 8 +- .../go-github/{v75 => v84}/github/issues.go | 198 +- .../{v75 => v84}/github/issues_assignees.go | 0 .../{v75 => v84}/github/issues_comments.go | 13 +- .../{v75 => v84}/github/issues_events.go | 0 .../{v75 => v84}/github/issues_labels.go | 12 +- .../{v75 => v84}/github/issues_milestones.go | 6 +- .../{v75 => v84}/github/issues_timeline.go | 1 - .../go-github/{v75 => v84}/github/licenses.go | 19 +- .../go-github/{v75 => v84}/github/markdown.go | 0 .../go-github/{v75 => v84}/github/messages.go | 10 +- .../go-github/{v75 => v84}/github/meta.go | 17 +- .../{v75 => v84}/github/migrations.go | 6 - .../github/migrations_source_import.go | 0 .../{v75 => v84}/github/migrations_user.go | 6 - .../go-github/{v75 => v84}/github/orgs.go | 15 +- .../github/orgs_actions_allowed.go | 8 +- .../github/orgs_actions_permissions.go | 8 +- .../go-github/v84/github/orgs_artifacts.go | 211 + .../{v75 => v84}/github/orgs_attestations.go | 2 +- .../{v75 => v84}/github/orgs_audit_log.go | 0 .../orgs_codesecurity_configurations.go | 158 +- .../github/orgs_credential_authorizations.go | 5 +- .../github/orgs_custom_repository_roles.go | 29 + .../{v75 => v84}/github/orgs_hooks.go | 8 +- .../github/orgs_hooks_configuration.go | 0 .../github/orgs_hooks_deliveries.go | 0 .../v84/github/orgs_immutable_releases.go | 174 + .../{v75 => v84}/github/orgs_issue_types.go | 10 +- .../{v75 => v84}/github/orgs_members.go | 5 +- .../github/orgs_network_configurations.go | 5 +- .../github/orgs_organization_properties.go | 60 + .../github/orgs_organization_roles.go | 0 .../github/orgs_outside_collaborators.go | 0 .../{v75 => v84}/github/orgs_packages.go | 0 .../github/orgs_personal_access_tokens.go | 104 +- .../{v75 => v84}/github/orgs_properties.go | 71 +- .../{v75 => v84}/github/orgs_rules.go | 25 - .../github/orgs_security_managers.go | 0 .../github/orgs_users_blocking.go | 4 - .../go-github/{v75 => v84}/github/packages.go | 2 +- .../v84/github/private_registries.go | 263 + .../google/go-github/v84/github/projects.go | 703 ++ .../go-github/{v75 => v84}/github/pulls.go | 22 +- .../{v75 => v84}/github/pulls_comments.go | 16 +- .../{v75 => v84}/github/pulls_reviewers.go | 12 +- .../{v75 => v84}/github/pulls_reviews.go | 16 +- .../{v75 => v84}/github/pulls_threads.go | 0 .../{v75 => v84}/github/rate_limit.go | 4 + .../{v75 => v84}/github/reactions.go | 29 +- .../go-github/{v75 => v84}/github/repos.go | 187 +- .../github/repos_actions_access.go | 0 .../github/repos_actions_allowed.go | 0 .../github/repos_actions_permissions.go | 50 +- .../{v75 => v84}/github/repos_attestations.go | 2 +- .../{v75 => v84}/github/repos_autolinks.go | 8 +- .../{v75 => v84}/github/repos_codeowners.go | 0 .../github/repos_collaborators.go | 2 +- .../{v75 => v84}/github/repos_comments.go | 3 - .../{v75 => v84}/github/repos_commits.go | 5 +- .../github/repos_community_health.go | 0 .../{v75 => v84}/github/repos_contents.go | 29 +- .../repos_deployment_branch_policies.go | 6 +- .../repos_deployment_protection_rules.go | 6 +- .../{v75 => v84}/github/repos_deployments.go | 4 - .../{v75 => v84}/github/repos_environments.go | 8 +- .../{v75 => v84}/github/repos_forks.go | 5 +- .../{v75 => v84}/github/repos_hooks.go | 12 +- .../github/repos_hooks_configuration.go | 2 +- .../github/repos_hooks_deliveries.go | 0 .../{v75 => v84}/github/repos_invitations.go | 0 .../{v75 => v84}/github/repos_keys.go | 0 .../{v75 => v84}/github/repos_lfs.go | 0 .../{v75 => v84}/github/repos_merging.go | 0 .../{v75 => v84}/github/repos_pages.go | 1 - .../github/repos_prereceive_hooks.go | 18 +- .../{v75 => v84}/github/repos_properties.go | 0 .../{v75 => v84}/github/repos_releases.go | 109 +- .../{v75 => v84}/github/repos_rules.go | 88 - .../{v75 => v84}/github/repos_stats.go | 2 +- .../{v75 => v84}/github/repos_statuses.go | 4 +- .../{v75 => v84}/github/repos_tags.go | 6 +- .../{v75 => v84}/github/repos_traffic.go | 0 .../go-github/{v75 => v84}/github/rules.go | 342 +- .../go-github/{v75 => v84}/github/scim.go | 91 +- .../go-github/{v75 => v84}/github/search.go | 14 +- .../{v75 => v84}/github/secret_scanning.go | 98 +- .../github/secret_scanning_pattern_configs.go | 2 +- .../github/security_advisories.go | 16 +- .../go-github/{v75 => v84}/github/strings.go | 43 +- .../{v75 => v84}/github/sub_issue.go | 2 +- .../go-github/{v75 => v84}/github/teams.go | 34 +- .../github/teams_discussion_comments.go | 20 +- .../{v75 => v84}/github/teams_discussions.go | 20 +- .../{v75 => v84}/github/teams_members.go | 0 .../{v75 => v84}/github/timestamp.go | 2 +- .../go-github/{v75 => v84}/github/users.go | 17 +- .../github/users_administration.go | 10 +- .../{v75 => v84}/github/users_attestations.go | 0 .../{v75 => v84}/github/users_blocking.go | 4 - .../{v75 => v84}/github/users_emails.go | 0 .../{v75 => v84}/github/users_followers.go | 3 + .../{v75 => v84}/github/users_gpg_keys.go | 1 + .../{v75 => v84}/github/users_keys.go | 1 + .../{v75 => v84}/github/users_packages.go | 51 +- .../github/users_social_accounts.go | 9 +- .../github/users_ssh_signing_keys.go | 1 + .../{v75 => v84}/github/with_appengine.go | 0 .../{v75 => v84}/github/without_appengine.go | 0 vendor/modules.txt | 10 +- 206 files changed, 16946 insertions(+), 2121 deletions(-) delete mode 100644 vendor/github.com/google/go-github/v75/github/billing.go delete mode 100644 vendor/github.com/google/go-github/v75/github/classroom.go delete mode 100644 vendor/github.com/google/go-github/v75/github/codespaces.go rename vendor/github.com/google/go-github/{v75 => v84}/AUTHORS (96%) rename vendor/github.com/google/go-github/{v75 => v84}/LICENSE (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/actions.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/actions_artifacts.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/actions_cache.go (99%) rename vendor/github.com/google/go-github/{v75 => v84}/github/actions_hosted_runners.go (84%) rename vendor/github.com/google/go-github/{v75 => v84}/github/actions_oidc.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/actions_permissions_enterprise.go (81%) rename vendor/github.com/google/go-github/{v75 => v84}/github/actions_permissions_orgs.go (85%) rename vendor/github.com/google/go-github/{v75 => v84}/github/actions_runner_groups.go (97%) rename vendor/github.com/google/go-github/{v75 => v84}/github/actions_runners.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/actions_secrets.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/actions_variables.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/actions_workflow_jobs.go (98%) rename vendor/github.com/google/go-github/{v75 => v84}/github/actions_workflow_runs.go (98%) rename vendor/github.com/google/go-github/{v75 => v84}/github/actions_workflows.go (88%) rename vendor/github.com/google/go-github/{v75 => v84}/github/activity.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/activity_events.go (99%) rename vendor/github.com/google/go-github/{v75 => v84}/github/activity_notifications.go (97%) rename vendor/github.com/google/go-github/{v75 => v84}/github/activity_star.go (97%) rename vendor/github.com/google/go-github/{v75 => v84}/github/activity_watching.go (95%) rename vendor/github.com/google/go-github/{v75 => v84}/github/admin.go (97%) rename vendor/github.com/google/go-github/{v75 => v84}/github/admin_orgs.go (94%) rename vendor/github.com/google/go-github/{v75 => v84}/github/admin_stats.go (98%) rename vendor/github.com/google/go-github/{v75 => v84}/github/admin_users.go (91%) rename vendor/github.com/google/go-github/{v75 => v84}/github/apps.go (98%) rename vendor/github.com/google/go-github/{v75 => v84}/github/apps_hooks.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/apps_hooks_deliveries.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/apps_installation.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/apps_manifest.go (96%) rename vendor/github.com/google/go-github/{v75 => v84}/github/apps_marketplace.go (99%) rename vendor/github.com/google/go-github/{v75 => v84}/github/attestations.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/authorizations.go (98%) create mode 100644 vendor/github.com/google/go-github/v84/github/billing.go rename vendor/github.com/google/go-github/{v75 => v84}/github/checks.go (100%) create mode 100644 vendor/github.com/google/go-github/v84/github/classroom.go rename vendor/github.com/google/go-github/{v75 => v84}/github/code_scanning.go (99%) rename vendor/github.com/google/go-github/{v75 => v84}/github/codesofconduct.go (92%) create mode 100644 vendor/github.com/google/go-github/v84/github/codespaces.go create mode 100644 vendor/github.com/google/go-github/v84/github/codespaces_machines.go create mode 100644 vendor/github.com/google/go-github/v84/github/codespaces_orgs.go rename vendor/github.com/google/go-github/{v75 => v84}/github/codespaces_secrets.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/copilot.go (73%) create mode 100644 vendor/github.com/google/go-github/v84/github/credentials.go rename vendor/github.com/google/go-github/{v75 => v84}/github/dependabot.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/dependabot_alerts.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/dependabot_secrets.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/dependency_graph.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/dependency_graph_snapshots.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/doc.go (93%) rename vendor/github.com/google/go-github/{v75 => v84}/github/emojis.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/enterprise.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/enterprise_actions_hosted_runners.go (94%) rename vendor/github.com/google/go-github/{v75 => v84}/github/enterprise_actions_runner_groups.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/enterprise_actions_runners.go (98%) create mode 100644 vendor/github.com/google/go-github/v84/github/enterprise_app_installation.go create mode 100644 vendor/github.com/google/go-github/v84/github/enterprise_apps.go rename vendor/github.com/google/go-github/{v75 => v84}/github/enterprise_audit_log.go (100%) create mode 100644 vendor/github.com/google/go-github/v84/github/enterprise_billing_cost_centers.go rename vendor/github.com/google/go-github/{v75 => v84}/github/enterprise_code_security_and_analysis.go (100%) create mode 100644 vendor/github.com/google/go-github/v84/github/enterprise_codesecurity_configurations.go create mode 100644 vendor/github.com/google/go-github/v84/github/enterprise_licenses.go rename vendor/github.com/google/go-github/{v75 => v84}/github/enterprise_manage_ghes.go (95%) rename vendor/github.com/google/go-github/{v75 => v84}/github/enterprise_manage_ghes_config.go (96%) rename vendor/github.com/google/go-github/{v75 => v84}/github/enterprise_manage_ghes_maintenance.go (96%) rename vendor/github.com/google/go-github/{v75 => v84}/github/enterprise_manage_ghes_ssh.go (93%) rename vendor/github.com/google/go-github/{v75 => v84}/github/enterprise_network_configurations.go (100%) create mode 100644 vendor/github.com/google/go-github/v84/github/enterprise_organization_properties.go rename vendor/github.com/google/go-github/{v75 => v84}/github/enterprise_properties.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/enterprise_rules.go (76%) create mode 100644 vendor/github.com/google/go-github/v84/github/enterprise_scim.go create mode 100644 vendor/github.com/google/go-github/v84/github/enterprise_team.go rename vendor/github.com/google/go-github/{v75 => v84}/github/event.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/event_types.go (97%) rename vendor/github.com/google/go-github/{v75 => v84}/github/gists.go (99%) rename vendor/github.com/google/go-github/{v75 => v84}/github/gists_comments.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/git.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/git_blobs.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/git_commits.go (96%) rename vendor/github.com/google/go-github/{v75 => v84}/github/git_refs.go (90%) rename vendor/github.com/google/go-github/{v75 => v84}/github/git_tags.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/git_trees.go (85%) rename vendor/github.com/google/go-github/{v75 => v84}/github/github-accessors.go (91%) create mode 100644 vendor/github.com/google/go-github/v84/github/github-iterators.go rename vendor/github.com/google/go-github/{v75 => v84}/github/github.go (93%) rename vendor/github.com/google/go-github/{v75 => v84}/github/gitignore.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/interactions.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/interactions_orgs.go (93%) rename vendor/github.com/google/go-github/{v75 => v84}/github/interactions_repos.go (93%) rename vendor/github.com/google/go-github/{v75 => v84}/github/issue_import.go (95%) rename vendor/github.com/google/go-github/{v75 => v84}/github/issues.go (75%) rename vendor/github.com/google/go-github/{v75 => v84}/github/issues_assignees.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/issues_comments.go (92%) rename vendor/github.com/google/go-github/{v75 => v84}/github/issues_events.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/issues_labels.go (94%) rename vendor/github.com/google/go-github/{v75 => v84}/github/issues_milestones.go (96%) rename vendor/github.com/google/go-github/{v75 => v84}/github/issues_timeline.go (99%) rename vendor/github.com/google/go-github/{v75 => v84}/github/licenses.go (84%) rename vendor/github.com/google/go-github/{v75 => v84}/github/markdown.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/messages.go (98%) rename vendor/github.com/google/go-github/{v75 => v84}/github/meta.go (89%) rename vendor/github.com/google/go-github/{v75 => v84}/github/migrations.go (95%) rename vendor/github.com/google/go-github/{v75 => v84}/github/migrations_source_import.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/migrations_user.go (94%) rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs.go (97%) rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_actions_allowed.go (73%) rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_actions_permissions.go (70%) create mode 100644 vendor/github.com/google/go-github/v84/github/orgs_artifacts.go rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_attestations.go (92%) rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_audit_log.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_codesecurity_configurations.go (57%) rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_credential_authorizations.go (96%) rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_custom_repository_roles.go (83%) rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_hooks.go (95%) rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_hooks_configuration.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_hooks_deliveries.go (100%) create mode 100644 vendor/github.com/google/go-github/v84/github/orgs_immutable_releases.go rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_issue_types.go (89%) rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_members.go (99%) rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_network_configurations.go (98%) create mode 100644 vendor/github.com/google/go-github/v84/github/orgs_organization_properties.go rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_organization_roles.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_outside_collaborators.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_packages.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_personal_access_tokens.go (60%) rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_properties.go (80%) rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_rules.go (80%) rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_security_managers.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/orgs_users_blocking.go (90%) rename vendor/github.com/google/go-github/{v75 => v84}/github/packages.go (99%) create mode 100644 vendor/github.com/google/go-github/v84/github/private_registries.go create mode 100644 vendor/github.com/google/go-github/v84/github/projects.go rename vendor/github.com/google/go-github/{v75 => v84}/github/pulls.go (95%) rename vendor/github.com/google/go-github/{v75 => v84}/github/pulls_comments.go (93%) rename vendor/github.com/google/go-github/{v75 => v84}/github/pulls_reviewers.go (90%) rename vendor/github.com/google/go-github/{v75 => v84}/github/pulls_reviews.go (95%) rename vendor/github.com/google/go-github/{v75 => v84}/github/pulls_threads.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/rate_limit.go (96%) rename vendor/github.com/google/go-github/{v75 => v84}/github/reactions.go (93%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos.go (93%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_actions_access.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_actions_allowed.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_actions_permissions.go (72%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_attestations.go (92%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_autolinks.go (94%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_codeowners.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_collaborators.go (99%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_comments.go (96%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_commits.go (98%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_community_health.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_contents.go (94%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_deployment_branch_policies.go (96%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_deployment_protection_rules.go (96%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_deployments.go (97%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_environments.go (97%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_forks.go (96%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_hooks.go (96%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_hooks_configuration.go (96%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_hooks_deliveries.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_invitations.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_keys.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_lfs.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_merging.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_pages.go (99%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_prereceive_hooks.go (82%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_properties.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_releases.go (82%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_rules.go (58%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_stats.go (99%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_statuses.go (97%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_tags.go (87%) rename vendor/github.com/google/go-github/{v75 => v84}/github/repos_traffic.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/rules.go (81%) rename vendor/github.com/google/go-github/{v75 => v84}/github/scim.go (71%) rename vendor/github.com/google/go-github/{v75 => v84}/github/search.go (95%) rename vendor/github.com/google/go-github/{v75 => v84}/github/secret_scanning.go (76%) rename vendor/github.com/google/go-github/{v75 => v84}/github/secret_scanning_pattern_configs.go (98%) rename vendor/github.com/google/go-github/{v75 => v84}/github/security_advisories.go (95%) rename vendor/github.com/google/go-github/{v75 => v84}/github/strings.go (57%) rename vendor/github.com/google/go-github/{v75 => v84}/github/sub_issue.go (98%) rename vendor/github.com/google/go-github/{v75 => v84}/github/teams.go (95%) rename vendor/github.com/google/go-github/{v75 => v84}/github/teams_discussion_comments.go (88%) rename vendor/github.com/google/go-github/{v75 => v84}/github/teams_discussions.go (89%) rename vendor/github.com/google/go-github/{v75 => v84}/github/teams_members.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/timestamp.go (99%) rename vendor/github.com/google/go-github/{v75 => v84}/github/users.go (96%) rename vendor/github.com/google/go-github/{v75 => v84}/github/users_administration.go (88%) rename vendor/github.com/google/go-github/{v75 => v84}/github/users_attestations.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/users_blocking.go (90%) rename vendor/github.com/google/go-github/{v75 => v84}/github/users_emails.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/users_followers.go (99%) rename vendor/github.com/google/go-github/{v75 => v84}/github/users_gpg_keys.go (99%) rename vendor/github.com/google/go-github/{v75 => v84}/github/users_keys.go (99%) rename vendor/github.com/google/go-github/{v75 => v84}/github/users_packages.go (88%) rename vendor/github.com/google/go-github/{v75 => v84}/github/users_social_accounts.go (88%) rename vendor/github.com/google/go-github/{v75 => v84}/github/users_ssh_signing_keys.go (99%) rename vendor/github.com/google/go-github/{v75 => v84}/github/with_appengine.go (100%) rename vendor/github.com/google/go-github/{v75 => v84}/github/without_appengine.go (100%) diff --git a/go.mod b/go.mod index b8b1f669e..62a04aaf3 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.25.0 require ( github.com/BurntSushi/toml v1.6.0 - github.com/bradleyfalzon/ghinstallation/v2 v2.17.0 + github.com/bradleyfalzon/ghinstallation/v2 v2.18.0 github.com/cloudbase/garm-provider-common v0.1.8-0.20260304133539-3e3d10fe78b8 github.com/felixge/httpsnoop v1.0.4 github.com/gdamore/tcell/v2 v2.13.8 @@ -72,7 +72,7 @@ require ( github.com/go-sql-driver/mysql v1.9.3 // indirect github.com/go-viper/mapstructure/v2 v2.5.0 // indirect github.com/golang-jwt/jwt/v4 v4.5.2 // indirect - github.com/google/go-github/v75 v75.0.0 // indirect + github.com/google/go-github/v84 v84.0.0 // indirect github.com/google/go-querystring v1.2.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect diff --git a/go.sum b/go.sum index 703cab54b..df1819fc2 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bradleyfalzon/ghinstallation/v2 v2.17.0 h1:SmbUK/GxpAspRjSQbB6ARvH+ArzlNzTtHydNyXUQ6zg= -github.com/bradleyfalzon/ghinstallation/v2 v2.17.0/go.mod h1:vuD/xvJT9Y+ZVZRv4HQ42cMyPFIYqpc7AbB4Gvt/DlY= +github.com/bradleyfalzon/ghinstallation/v2 v2.18.0 h1:WPqnN6NS9XvYlOgZQAIseN7Z1uAiE+UxgDKlW7FvFuU= +github.com/bradleyfalzon/ghinstallation/v2 v2.18.0/go.mod h1:gpoSwwWc4biE49F7n+roCcpkEkZ1Qr9soZ2ESvMiouU= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -103,8 +103,8 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/go-github/v72 v72.0.0 h1:FcIO37BLoVPBO9igQQ6tStsv2asG4IPcYFi655PPvBM= github.com/google/go-github/v72 v72.0.0/go.mod h1:WWtw8GMRiL62mvIquf1kO3onRHeWWKmK01qdCY8c5fg= -github.com/google/go-github/v75 v75.0.0 h1:k7q8Bvg+W5KxRl9Tjq16a9XEgVY1pwuiG5sIL7435Ic= -github.com/google/go-github/v75 v75.0.0/go.mod h1:H3LUJEA1TCrzuUqtdAQniBNwuKiQIqdGKgBo1/M/uqI= +github.com/google/go-github/v84 v84.0.0 h1:I/0Xn5IuChMe8TdmI2bbim5nyhaRFJ7DEdzmD2w+yVA= +github.com/google/go-github/v84 v84.0.0/go.mod h1:WwYL1z1ajRdlaPszjVu/47x1L0PXukJBn73xsiYrRRQ= github.com/google/go-querystring v1.2.0 h1:yhqkPbu2/OH+V9BfpCVPZkNmUXhb2gBxJArfhIxNtP0= github.com/google/go-querystring v1.2.0/go.mod h1:8IFJqpSRITyJ8QhQ13bmbeMBDfmeEJZD5A0egEOmkqU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= diff --git a/vendor/github.com/bradleyfalzon/ghinstallation/v2/appsTransport.go b/vendor/github.com/bradleyfalzon/ghinstallation/v2/appsTransport.go index ada64bcf3..f7403b593 100644 --- a/vendor/github.com/bradleyfalzon/ghinstallation/v2/appsTransport.go +++ b/vendor/github.com/bradleyfalzon/ghinstallation/v2/appsTransport.go @@ -30,6 +30,7 @@ type AppsTransport struct { // NewAppsTransportKeyFromFile returns a AppsTransport using a private key from file. func NewAppsTransportKeyFromFile(tr http.RoundTripper, appID int64, privateKeyFile string) (*AppsTransport, error) { + //nolint:gosec // G703: Path is controlled by library user privateKey, err := os.ReadFile(privateKeyFile) if err != nil { return nil, fmt.Errorf("could not read private key: %s", err) diff --git a/vendor/github.com/bradleyfalzon/ghinstallation/v2/transport.go b/vendor/github.com/bradleyfalzon/ghinstallation/v2/transport.go index 3bd2fec03..324239549 100644 --- a/vendor/github.com/bradleyfalzon/ghinstallation/v2/transport.go +++ b/vendor/github.com/bradleyfalzon/ghinstallation/v2/transport.go @@ -13,7 +13,7 @@ import ( "sync" "time" - "github.com/google/go-github/v75/github" + "github.com/google/go-github/v84/github" ) const ( @@ -73,6 +73,7 @@ var _ http.RoundTripper = &Transport{} // NewKeyFromFile returns a Transport using a private key from file. func NewKeyFromFile(tr http.RoundTripper, appID, installationID int64, privateKeyFile string) (*Transport, error) { + //nolint:gosec // G703: Path is controlled by library user privateKey, err := os.ReadFile(privateKeyFile) if err != nil { return nil, fmt.Errorf("could not read private key: %s", err) diff --git a/vendor/github.com/google/go-github/v75/github/billing.go b/vendor/github.com/google/go-github/v75/github/billing.go deleted file mode 100644 index 0776358cd..000000000 --- a/vendor/github.com/google/go-github/v75/github/billing.go +++ /dev/null @@ -1,314 +0,0 @@ -// Copyright 2021 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" -) - -// BillingService provides access to the billing related functions -// in the GitHub API. -// -// GitHub API docs: https://docs.github.com/rest/billing -type BillingService service - -// ActionBilling represents a GitHub Action billing. -type ActionBilling struct { - TotalMinutesUsed float64 `json:"total_minutes_used"` - TotalPaidMinutesUsed float64 `json:"total_paid_minutes_used"` - IncludedMinutes float64 `json:"included_minutes"` - MinutesUsedBreakdown MinutesUsedBreakdown `json:"minutes_used_breakdown"` -} - -// MinutesUsedBreakdown counts the actions minutes used by machine type (e.g. UBUNTU, WINDOWS, MACOS). -type MinutesUsedBreakdown = map[string]int - -// PackageBilling represents a GitHub Package billing. -type PackageBilling struct { - TotalGigabytesBandwidthUsed int `json:"total_gigabytes_bandwidth_used"` - TotalPaidGigabytesBandwidthUsed int `json:"total_paid_gigabytes_bandwidth_used"` - IncludedGigabytesBandwidth float64 `json:"included_gigabytes_bandwidth"` -} - -// StorageBilling represents a GitHub Storage billing. -type StorageBilling struct { - DaysLeftInBillingCycle int `json:"days_left_in_billing_cycle"` - EstimatedPaidStorageForMonth float64 `json:"estimated_paid_storage_for_month"` - EstimatedStorageForMonth float64 `json:"estimated_storage_for_month"` -} - -// ActiveCommitters represents the total active committers across all repositories in an Organization. -type ActiveCommitters struct { - TotalAdvancedSecurityCommitters int `json:"total_advanced_security_committers"` - TotalCount int `json:"total_count"` - MaximumAdvancedSecurityCommitters int `json:"maximum_advanced_security_committers"` - PurchasedAdvancedSecurityCommitters int `json:"purchased_advanced_security_committers"` - Repositories []*RepositoryActiveCommitters `json:"repositories,omitempty"` -} - -// RepositoryActiveCommitters represents active committers on each repository. -type RepositoryActiveCommitters struct { - Name *string `json:"name,omitempty"` - AdvancedSecurityCommitters *int `json:"advanced_security_committers,omitempty"` - AdvancedSecurityCommittersBreakdown []*AdvancedSecurityCommittersBreakdown `json:"advanced_security_committers_breakdown,omitempty"` -} - -// AdvancedSecurityCommittersBreakdown represents the user activity breakdown for ActiveCommitters. -type AdvancedSecurityCommittersBreakdown struct { - UserLogin *string `json:"user_login,omitempty"` - LastPushedDate *string `json:"last_pushed_date,omitempty"` -} - -// UsageReportOptions specifies optional parameters for the enhanced billing platform usage report. -type UsageReportOptions struct { - // If specified, only return results for a single year. The value of year is an integer with four digits representing a year. For example, 2025. - // Default value is the current year. - Year *int `url:"year,omitempty"` - - // If specified, only return results for a single month. The value of month is an integer between 1 and 12. - // If no year is specified the default year is used. - Month *int `url:"month,omitempty"` - - // If specified, only return results for a single day. The value of day is an integer between 1 and 31. - // If no year or month is specified, the default year and month are used. - Day *int `url:"day,omitempty"` - - // If specified, only return results for a single hour. The value of hour is an integer between 0 and 23. - // If no year, month, or day is specified, the default year, month, and day are used. - Hour *int `url:"hour,omitempty"` -} - -// UsageItem represents a single usage item in the enhanced billing platform report. -type UsageItem struct { - Date *string `json:"date"` - Product *string `json:"product"` - SKU *string `json:"sku"` - Quantity *float64 `json:"quantity"` - UnitType *string `json:"unitType"` - PricePerUnit *float64 `json:"pricePerUnit"` - GrossAmount *float64 `json:"grossAmount"` - DiscountAmount *float64 `json:"discountAmount"` - NetAmount *float64 `json:"netAmount"` - RepositoryName *string `json:"repositoryName,omitempty"` - // Organization name is only used for organization-level reports. - OrganizationName *string `json:"organizationName,omitempty"` -} - -// UsageReport represents the enhanced billing platform usage report response. -type UsageReport struct { - UsageItems []*UsageItem `json:"usageItems,omitempty"` -} - -// GetActionsBillingOrg returns the summary of the free and paid GitHub Actions minutes used for an Org. -// -// GitHub API docs: https://docs.github.com/rest/billing/billing#get-github-actions-billing-for-an-organization -// -//meta:operation GET /orgs/{org}/settings/billing/actions -func (s *BillingService) GetActionsBillingOrg(ctx context.Context, org string) (*ActionBilling, *Response, error) { - u := fmt.Sprintf("orgs/%v/settings/billing/actions", org) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - actionsOrgBilling := new(ActionBilling) - resp, err := s.client.Do(ctx, req, actionsOrgBilling) - if err != nil { - return nil, resp, err - } - - return actionsOrgBilling, resp, nil -} - -// GetPackagesBillingOrg returns the free and paid storage used for GitHub Packages in gigabytes for an Org. -// -// GitHub API docs: https://docs.github.com/rest/billing/billing#get-github-packages-billing-for-an-organization -// -//meta:operation GET /orgs/{org}/settings/billing/packages -func (s *BillingService) GetPackagesBillingOrg(ctx context.Context, org string) (*PackageBilling, *Response, error) { - u := fmt.Sprintf("orgs/%v/settings/billing/packages", org) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - packagesOrgBilling := new(PackageBilling) - resp, err := s.client.Do(ctx, req, packagesOrgBilling) - if err != nil { - return nil, resp, err - } - - return packagesOrgBilling, resp, nil -} - -// GetStorageBillingOrg returns the estimated paid and estimated total storage used for GitHub Actions -// and GitHub Packages in gigabytes for an Org. -// -// GitHub API docs: https://docs.github.com/rest/billing/billing#get-shared-storage-billing-for-an-organization -// -//meta:operation GET /orgs/{org}/settings/billing/shared-storage -func (s *BillingService) GetStorageBillingOrg(ctx context.Context, org string) (*StorageBilling, *Response, error) { - u := fmt.Sprintf("orgs/%v/settings/billing/shared-storage", org) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - storageOrgBilling := new(StorageBilling) - resp, err := s.client.Do(ctx, req, storageOrgBilling) - if err != nil { - return nil, resp, err - } - - return storageOrgBilling, resp, nil -} - -// GetAdvancedSecurityActiveCommittersOrg returns the GitHub Advanced Security active committers for an organization per repository. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/billing#get-github-advanced-security-active-committers-for-an-organization -// -//meta:operation GET /orgs/{org}/settings/billing/advanced-security -func (s *BillingService) GetAdvancedSecurityActiveCommittersOrg(ctx context.Context, org string, opts *ListOptions) (*ActiveCommitters, *Response, error) { - u := fmt.Sprintf("orgs/%v/settings/billing/advanced-security", org) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - activeOrgCommitters := new(ActiveCommitters) - resp, err := s.client.Do(ctx, req, activeOrgCommitters) - if err != nil { - return nil, resp, err - } - - return activeOrgCommitters, resp, nil -} - -// GetActionsBillingUser returns the summary of the free and paid GitHub Actions minutes used for a user. -// -// GitHub API docs: https://docs.github.com/rest/billing/billing#get-github-actions-billing-for-a-user -// -//meta:operation GET /users/{username}/settings/billing/actions -func (s *BillingService) GetActionsBillingUser(ctx context.Context, user string) (*ActionBilling, *Response, error) { - u := fmt.Sprintf("users/%v/settings/billing/actions", user) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - actionsUserBilling := new(ActionBilling) - resp, err := s.client.Do(ctx, req, actionsUserBilling) - if err != nil { - return nil, resp, err - } - - return actionsUserBilling, resp, nil -} - -// GetPackagesBillingUser returns the free and paid storage used for GitHub Packages in gigabytes for a user. -// -// GitHub API docs: https://docs.github.com/rest/billing/billing#get-github-packages-billing-for-a-user -// -//meta:operation GET /users/{username}/settings/billing/packages -func (s *BillingService) GetPackagesBillingUser(ctx context.Context, user string) (*PackageBilling, *Response, error) { - u := fmt.Sprintf("users/%v/settings/billing/packages", user) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - packagesUserBilling := new(PackageBilling) - resp, err := s.client.Do(ctx, req, packagesUserBilling) - if err != nil { - return nil, resp, err - } - - return packagesUserBilling, resp, nil -} - -// GetStorageBillingUser returns the estimated paid and estimated total storage used for GitHub Actions -// and GitHub Packages in gigabytes for a user. -// -// GitHub API docs: https://docs.github.com/rest/billing/billing#get-shared-storage-billing-for-a-user -// -//meta:operation GET /users/{username}/settings/billing/shared-storage -func (s *BillingService) GetStorageBillingUser(ctx context.Context, user string) (*StorageBilling, *Response, error) { - u := fmt.Sprintf("users/%v/settings/billing/shared-storage", user) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - storageUserBilling := new(StorageBilling) - resp, err := s.client.Do(ctx, req, storageUserBilling) - if err != nil { - return nil, resp, err - } - - return storageUserBilling, resp, nil -} - -// GetUsageReportOrg returns a report of the total usage for an organization using the enhanced billing platform. -// -// Note: This endpoint is only available to organizations with access to the enhanced billing platform. -// -// GitHub API docs: https://docs.github.com/rest/billing/enhanced-billing#get-billing-usage-report-for-an-organization -// -//meta:operation GET /organizations/{org}/settings/billing/usage -func (s *BillingService) GetUsageReportOrg(ctx context.Context, org string, opts *UsageReportOptions) (*UsageReport, *Response, error) { - u := fmt.Sprintf("organizations/%v/settings/billing/usage", org) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - usageReport := new(UsageReport) - resp, err := s.client.Do(ctx, req, usageReport) - if err != nil { - return nil, resp, err - } - - return usageReport, resp, nil -} - -// GetUsageReportUser returns a report of the total usage for a user using the enhanced billing platform. -// -// Note: This endpoint is only available to users with access to the enhanced billing platform. -// -// GitHub API docs: https://docs.github.com/rest/billing/enhanced-billing#get-billing-usage-report-for-a-user -// -//meta:operation GET /users/{username}/settings/billing/usage -func (s *BillingService) GetUsageReportUser(ctx context.Context, user string, opts *UsageReportOptions) (*UsageReport, *Response, error) { - u := fmt.Sprintf("users/%v/settings/billing/usage", user) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - usageReport := new(UsageReport) - resp, err := s.client.Do(ctx, req, usageReport) - if err != nil { - return nil, resp, err - } - - return usageReport, resp, nil -} diff --git a/vendor/github.com/google/go-github/v75/github/classroom.go b/vendor/github.com/google/go-github/v75/github/classroom.go deleted file mode 100644 index 8f6ce1451..000000000 --- a/vendor/github.com/google/go-github/v75/github/classroom.go +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2025 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" - "net/http" -) - -// ClassroomService handles communication with the GitHub Classroom related -// methods of the GitHub API. -// -// GitHub API docs: https://docs.github.com/rest/classroom/classroom -type ClassroomService service - -// Classroom represents a GitHub Classroom. -type Classroom struct { - ID *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Archived *bool `json:"archived,omitempty"` - Organization *Organization `json:"organization,omitempty"` - URL *string `json:"url,omitempty"` -} - -func (c Classroom) String() string { - return Stringify(c) -} - -// ClassroomAssignment represents a GitHub Classroom assignment. -type ClassroomAssignment struct { - ID *int64 `json:"id,omitempty"` - PublicRepo *bool `json:"public_repo,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - InviteLink *string `json:"invite_link,omitempty"` - InvitationsEnabled *bool `json:"invitations_enabled,omitempty"` - Slug *string `json:"slug,omitempty"` - StudentsAreRepoAdmins *bool `json:"students_are_repo_admins,omitempty"` - FeedbackPullRequestsEnabled *bool `json:"feedback_pull_requests_enabled,omitempty"` - MaxTeams *int `json:"max_teams,omitempty"` - MaxMembers *int `json:"max_members,omitempty"` - Editor *string `json:"editor,omitempty"` - Accepted *int `json:"accepted,omitempty"` - Submitted *int `json:"submitted,omitempty"` - Passing *int `json:"passing,omitempty"` - Language *string `json:"language,omitempty"` - Deadline *Timestamp `json:"deadline,omitempty"` - StarterCodeRepository *Repository `json:"starter_code_repository,omitempty"` - Classroom *Classroom `json:"classroom,omitempty"` -} - -func (a ClassroomAssignment) String() string { - return Stringify(a) -} - -// GetAssignment gets a GitHub Classroom assignment. Assignment will only be -// returned if the current user is an administrator of the GitHub Classroom -// for the assignment. -// -// GitHub API docs: https://docs.github.com/rest/classroom/classroom#get-an-assignment -// -//meta:operation GET /assignments/{assignment_id} -func (s *ClassroomService) GetAssignment(ctx context.Context, assignmentID int64) (*ClassroomAssignment, *Response, error) { - u := fmt.Sprintf("assignments/%v", assignmentID) - - req, err := s.client.NewRequest(http.MethodGet, u, nil) - if err != nil { - return nil, nil, err - } - - assignment := new(ClassroomAssignment) - resp, err := s.client.Do(ctx, req, assignment) - if err != nil { - return nil, resp, err - } - - return assignment, resp, nil -} diff --git a/vendor/github.com/google/go-github/v75/github/codespaces.go b/vendor/github.com/google/go-github/v75/github/codespaces.go deleted file mode 100644 index 608370503..000000000 --- a/vendor/github.com/google/go-github/v75/github/codespaces.go +++ /dev/null @@ -1,266 +0,0 @@ -// Copyright 2023 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" -) - -// CodespacesService handles communication with the Codespaces related -// methods of the GitHub API. -// -// GitHub API docs: https://docs.github.com/rest/codespaces/ -type CodespacesService service - -// Codespace represents a codespace. -// -// GitHub API docs: https://docs.github.com/rest/codespaces -type Codespace struct { - ID *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - DisplayName *string `json:"display_name,omitempty"` - EnvironmentID *string `json:"environment_id,omitempty"` - Owner *User `json:"owner,omitempty"` - BillableOwner *User `json:"billable_owner,omitempty"` - Repository *Repository `json:"repository,omitempty"` - Machine *CodespacesMachine `json:"machine,omitempty"` - DevcontainerPath *string `json:"devcontainer_path,omitempty"` - Prebuild *bool `json:"prebuild,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - LastUsedAt *Timestamp `json:"last_used_at,omitempty"` - State *string `json:"state,omitempty"` - URL *string `json:"url,omitempty"` - GitStatus *CodespacesGitStatus `json:"git_status,omitempty"` - Location *string `json:"location,omitempty"` - IdleTimeoutMinutes *int `json:"idle_timeout_minutes,omitempty"` - WebURL *string `json:"web_url,omitempty"` - MachinesURL *string `json:"machines_url,omitempty"` - StartURL *string `json:"start_url,omitempty"` - StopURL *string `json:"stop_url,omitempty"` - PullsURL *string `json:"pulls_url,omitempty"` - RecentFolders []string `json:"recent_folders,omitempty"` - RuntimeConstraints *CodespacesRuntimeConstraints `json:"runtime_constraints,omitempty"` - PendingOperation *bool `json:"pending_operation,omitempty"` - PendingOperationDisabledReason *string `json:"pending_operation_disabled_reason,omitempty"` - IdleTimeoutNotice *string `json:"idle_timeout_notice,omitempty"` - RetentionPeriodMinutes *int `json:"retention_period_minutes,omitempty"` - RetentionExpiresAt *Timestamp `json:"retention_expires_at,omitempty"` - LastKnownStopNotice *string `json:"last_known_stop_notice,omitempty"` -} - -// CodespacesGitStatus represents the git status of a codespace. -type CodespacesGitStatus struct { - Ahead *int `json:"ahead,omitempty"` - Behind *int `json:"behind,omitempty"` - HasUnpushedChanges *bool `json:"has_unpushed_changes,omitempty"` - HasUncommittedChanges *bool `json:"has_uncommitted_changes,omitempty"` - Ref *string `json:"ref,omitempty"` -} - -// CodespacesMachine represents the machine type of a codespace. -type CodespacesMachine struct { - Name *string `json:"name,omitempty"` - DisplayName *string `json:"display_name,omitempty"` - OperatingSystem *string `json:"operating_system,omitempty"` - StorageInBytes *int64 `json:"storage_in_bytes,omitempty"` - MemoryInBytes *int64 `json:"memory_in_bytes,omitempty"` - CPUs *int `json:"cpus,omitempty"` - PrebuildAvailability *string `json:"prebuild_availability,omitempty"` -} - -// CodespacesRuntimeConstraints represents the runtime constraints of a codespace. -type CodespacesRuntimeConstraints struct { - AllowedPortPrivacySettings []string `json:"allowed_port_privacy_settings,omitempty"` -} - -// ListCodespaces represents the response from the list codespaces endpoints. -type ListCodespaces struct { - TotalCount *int `json:"total_count,omitempty"` - Codespaces []*Codespace `json:"codespaces"` -} - -// ListInRepo lists codespaces for a user in a repository. -// -// Lists the codespaces associated with a specified repository and the authenticated user. -// You must authenticate using an access token with the codespace scope to use this endpoint. -// GitHub Apps must have read access to the codespaces repository permission to use this endpoint. -// -// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#list-codespaces-in-a-repository-for-the-authenticated-user -// -//meta:operation GET /repos/{owner}/{repo}/codespaces -func (s *CodespacesService) ListInRepo(ctx context.Context, owner, repo string, opts *ListOptions) (*ListCodespaces, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/codespaces", owner, repo) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var codespaces *ListCodespaces - resp, err := s.client.Do(ctx, req, &codespaces) - if err != nil { - return nil, resp, err - } - - return codespaces, resp, nil -} - -// ListCodespacesOptions represents the options for listing codespaces for a user. -type ListCodespacesOptions struct { - ListOptions - RepositoryID int64 `url:"repository_id,omitempty"` -} - -// List lists codespaces for an authenticated user. -// -// Lists the authenticated user's codespaces. -// You must authenticate using an access token with the codespace scope to use this endpoint. -// GitHub Apps must have read access to the codespaces repository permission to use this endpoint. -// -// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#list-codespaces-for-the-authenticated-user -// -//meta:operation GET /user/codespaces -func (s *CodespacesService) List(ctx context.Context, opts *ListCodespacesOptions) (*ListCodespaces, *Response, error) { - u := "user/codespaces" - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var codespaces *ListCodespaces - resp, err := s.client.Do(ctx, req, &codespaces) - if err != nil { - return nil, resp, err - } - - return codespaces, resp, nil -} - -// CreateCodespaceOptions represents options for the creation of a codespace in a repository. -type CreateCodespaceOptions struct { - Ref *string `json:"ref,omitempty"` - // Geo represents the geographic area for this codespace. - // If not specified, the value is assigned by IP. - // This property replaces location, which is being deprecated. - // Geo can be one of: `EuropeWest`, `SoutheastAsia`, `UsEast`, `UsWest`. - Geo *string `json:"geo,omitempty"` - ClientIP *string `json:"client_ip,omitempty"` - Machine *string `json:"machine,omitempty"` - DevcontainerPath *string `json:"devcontainer_path,omitempty"` - MultiRepoPermissionsOptOut *bool `json:"multi_repo_permissions_opt_out,omitempty"` - WorkingDirectory *string `json:"working_directory,omitempty"` - IdleTimeoutMinutes *int `json:"idle_timeout_minutes,omitempty"` - DisplayName *string `json:"display_name,omitempty"` - // RetentionPeriodMinutes represents the duration in minutes after codespace has gone idle in which it will be deleted. - // Must be integer minutes between 0 and 43200 (30 days). - RetentionPeriodMinutes *int `json:"retention_period_minutes,omitempty"` -} - -// CreateInRepo creates a codespace in a repository. -// -// Creates a codespace owned by the authenticated user in the specified repository. -// You must authenticate using an access token with the codespace scope to use this endpoint. -// GitHub Apps must have write access to the codespaces repository permission to use this endpoint. -// -// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#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) { - u := fmt.Sprintf("repos/%v/%v/codespaces", owner, repo) - - req, err := s.client.NewRequest("POST", u, request) - if err != nil { - return nil, nil, err - } - - var codespace *Codespace - resp, err := s.client.Do(ctx, req, &codespace) - if err != nil { - return nil, resp, err - } - - return codespace, resp, nil -} - -// Start starts a codespace. -// -// You must authenticate using an access token with the codespace scope to use this endpoint. -// GitHub Apps must have write access to the codespaces_lifecycle_admin repository permission to use this endpoint. -// -// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#start-a-codespace-for-the-authenticated-user -// -//meta:operation POST /user/codespaces/{codespace_name}/start -func (s *CodespacesService) Start(ctx context.Context, codespaceName string) (*Codespace, *Response, error) { - u := fmt.Sprintf("user/codespaces/%v/start", codespaceName) - - req, err := s.client.NewRequest("POST", u, nil) - if err != nil { - return nil, nil, err - } - - var codespace *Codespace - resp, err := s.client.Do(ctx, req, &codespace) - if err != nil { - return nil, resp, err - } - - return codespace, resp, nil -} - -// Stop stops a codespace. -// -// You must authenticate using an access token with the codespace scope to use this endpoint. -// GitHub Apps must have write access to the codespaces_lifecycle_admin repository permission to use this endpoint. -// -// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#stop-a-codespace-for-the-authenticated-user -// -//meta:operation POST /user/codespaces/{codespace_name}/stop -func (s *CodespacesService) Stop(ctx context.Context, codespaceName string) (*Codespace, *Response, error) { - u := fmt.Sprintf("user/codespaces/%v/stop", codespaceName) - - req, err := s.client.NewRequest("POST", u, nil) - if err != nil { - return nil, nil, err - } - - var codespace *Codespace - resp, err := s.client.Do(ctx, req, &codespace) - if err != nil { - return nil, resp, err - } - - return codespace, resp, nil -} - -// Delete deletes a codespace. -// -// You must authenticate using an access token with the codespace scope to use this endpoint. -// GitHub Apps must have write access to the codespaces repository permission to use this endpoint. -// -// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#delete-a-codespace-for-the-authenticated-user -// -//meta:operation DELETE /user/codespaces/{codespace_name} -func (s *CodespacesService) Delete(ctx context.Context, codespaceName string) (*Response, error) { - u := fmt.Sprintf("user/codespaces/%v", codespaceName) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v75/AUTHORS b/vendor/github.com/google/go-github/v84/AUTHORS similarity index 96% rename from vendor/github.com/google/go-github/v75/AUTHORS rename to vendor/github.com/google/go-github/v84/AUTHORS index bf789bef0..2270852e5 100644 --- a/vendor/github.com/google/go-github/v75/AUTHORS +++ b/vendor/github.com/google/go-github/v84/AUTHORS @@ -12,6 +12,7 @@ 2BFL 413x 6543 <6543@obermui.de> +Aaron LaBrie Abed Kibbe Abhijit Hota Abhinav Gupta @@ -77,6 +78,7 @@ Arda Kuyumcu Ary Arıl Bozoluk Asier Marruedo +Austen Stone Austin Burdine Austin Dizzy Azuka Okuleye @@ -101,6 +103,7 @@ Bradley Falzon Bradley McAllister Brandon Butler Brandon Cook +Brandon Everett Brandon Stubbs Brett Kuhlman Brett Logan @@ -130,7 +133,9 @@ Christian Muehlhaeuser Christoph Jerolimov Christoph Sassenberg CI Monk +Claus Näveke Clemens W +cointem Colby Williams Colin Misare Craig Gumbley @@ -157,6 +162,7 @@ Davide Zipeto Dennis Webb Derek Jobst DeviousLab +Dhananjay Mishra Dhi Aurrahman Diego Lapiduz Diogo Vilela @@ -208,6 +214,7 @@ Glen Mailer Gnahz Google Inc. Grachev Mikhail +Gregor Jasny Gregory Oschwald griffin_stewie guangwu @@ -227,6 +234,7 @@ Huy Tr huydx i2bskn Iain Steers +Iehana Fu Ikko Ashimine Ilia Choly Ioannis Georgoulas @@ -239,6 +247,7 @@ Jake Krammer Jake Scaltreto Jake White Jameel Haffejee +James Alseth James Bowes James Cockbain James Loh @@ -261,6 +270,7 @@ Jesse Newland Jihoon Chung Jille Timmermans Jimmi Dyson +Jiří Žižkovský Joan Saum JoannaaKL Joe Tsai @@ -312,6 +322,7 @@ kyokomi Lachlan Cooper Lars Lehtonen Laurent Verdoïa +Leonard Sheng Sheng Lee leopoldwang Liam Galvin Liam Stanley @@ -332,6 +343,8 @@ Léo Salé M. Ryan Rigdon Magnus Kulke Maksim Zhylinski +Manas Sivakumar +Manav Sharma Manuel Bergler Marc Binder Marcelo Carlos @@ -343,6 +356,8 @@ Marwan Sulaiman Masayuki Izumi Mat Geist Matheus Santos Araújo +MathewClegg +Mathieu Sévégny Matija Horvat Matin Rahmanian Matt @@ -356,6 +371,7 @@ Matt Simons Matthew Reidy Maxime Bury Michael Meng +Michael Recachinas Michael Spiegel Michael Tiller Michał Glapa @@ -365,6 +381,7 @@ Mike Ball Mike Chen Miles Crabill Mishin Nikolai +Mohamad Al-Zawahreh mohammad ali <2018cs92@student.uet.edu.pk> Mohammed AlDujaili Mohammed Nafees @@ -449,6 +466,7 @@ Riaje Ricco Førgaard Richard de Vries Rob Figueiredo +Roger Peppe Rohit Upadhyay Rojan Dinc Roman Wu @@ -478,6 +496,7 @@ Sanket Payghan Sarah Funkhouser Sarasa Kisaragi Sasha Melentyev +Scott Dawson Sean Wang Sebastian Mandrean Sebastian Mæland Pedersen @@ -542,6 +561,7 @@ Victor Castell Victor Vrantchan Victory Osikwemhe vikkyomkar +Ville Skyttä Vivek Vivek Kumar Sahu Vlad Ungureanu @@ -564,6 +584,7 @@ Yumikiyo Osanai Yurii Soldak Yusef Mohamadi Yusuke Kuoka +Yuto Kimura Zach Latta Ze Peng zhouhaibing089 diff --git a/vendor/github.com/google/go-github/v75/LICENSE b/vendor/github.com/google/go-github/v84/LICENSE similarity index 100% rename from vendor/github.com/google/go-github/v75/LICENSE rename to vendor/github.com/google/go-github/v84/LICENSE diff --git a/vendor/github.com/google/go-github/v75/github/actions.go b/vendor/github.com/google/go-github/v84/github/actions.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/actions.go rename to vendor/github.com/google/go-github/v84/github/actions.go diff --git a/vendor/github.com/google/go-github/v75/github/actions_artifacts.go b/vendor/github.com/google/go-github/v84/github/actions_artifacts.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/actions_artifacts.go rename to vendor/github.com/google/go-github/v84/github/actions_artifacts.go diff --git a/vendor/github.com/google/go-github/v75/github/actions_cache.go b/vendor/github.com/google/go-github/v84/github/actions_cache.go similarity index 99% rename from vendor/github.com/google/go-github/v75/github/actions_cache.go rename to vendor/github.com/google/go-github/v84/github/actions_cache.go index 852e9860f..c883effb9 100644 --- a/vendor/github.com/google/go-github/v75/github/actions_cache.go +++ b/vendor/github.com/google/go-github/v84/github/actions_cache.go @@ -114,7 +114,7 @@ func (s *ActionsService) ListCaches(ctx context.Context, owner, repo string, opt //meta:operation DELETE /repos/{owner}/{repo}/actions/caches func (s *ActionsService) DeleteCachesByKey(ctx context.Context, owner, repo, key string, ref *string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/caches", owner, repo) - u, err := addOptions(u, ActionsCache{Key: &key, Ref: ref}) + u, err := addOptions(u, &ActionsCache{Key: &key, Ref: ref}) if err != nil { return nil, err } diff --git a/vendor/github.com/google/go-github/v75/github/actions_hosted_runners.go b/vendor/github.com/google/go-github/v84/github/actions_hosted_runners.go similarity index 84% rename from vendor/github.com/google/go-github/v75/github/actions_hosted_runners.go rename to vendor/github.com/google/go-github/v84/github/actions_hosted_runners.go index 207b755fc..eb805393f 100644 --- a/vendor/github.com/google/go-github/v75/github/actions_hosted_runners.go +++ b/vendor/github.com/google/go-github/v84/github/actions_hosted_runners.go @@ -83,48 +83,55 @@ func (s *ActionsService) ListHostedRunners(ctx context.Context, org string, opts } // HostedRunnerImage represents the image of GitHub-hosted runners. -// To list all available images, use GET /actions/hosted-runners/images/github-owned or GET /actions/hosted-runners/images/partner. type HostedRunnerImage struct { - ID string `json:"id"` - Source string `json:"source"` - Version string `json:"version"` + // The unique identifier of the runner image. + ID string `json:"id"` + // The source of the runner image. Can be one of: github, partner, custom. + Source string `json:"source"` + // The version of the runner image to deploy. This is relevant only for runners using custom images. + Version *string `json:"version,omitempty"` } -// HostedRunnerRequest specifies body parameters to Hosted Runner configuration. -type HostedRunnerRequest struct { - Name string `json:"name,omitempty"` - Image HostedRunnerImage `json:"image,omitempty"` - RunnerGroupID int64 `json:"runner_group_id,omitempty"` - Size string `json:"size,omitempty"` - MaximumRunners int64 `json:"maximum_runners,omitempty"` - EnableStaticIP bool `json:"enable_static_ip,omitempty"` - ImageVersion string `json:"image_version,omitempty"` +// CreateHostedRunnerRequest specifies body parameters to create Hosted Runner configuration. +type CreateHostedRunnerRequest struct { + Name string `json:"name"` + Image HostedRunnerImage `json:"image"` + Size string `json:"size"` + RunnerGroupID int64 `json:"runner_group_id"` + MaximumRunners *int64 `json:"maximum_runners,omitempty"` + EnableStaticIP *bool `json:"enable_static_ip,omitempty"` + ImageGen *bool `json:"image_gen,omitempty"` } -// validateCreateHostedRunnerRequest validates the provided HostedRunnerRequest to ensure +// UpdateHostedRunnerRequest specifies body parameters to update Hosted Runner configuration. +type UpdateHostedRunnerRequest struct { + Name *string `json:"name,omitempty"` + RunnerGroupID *int64 `json:"runner_group_id,omitempty"` + MaximumRunners *int64 `json:"maximum_runners,omitempty"` + EnableStaticIP *bool `json:"enable_static_ip,omitempty"` + Size *string `json:"size,omitempty"` + ImageID *string `json:"image_id,omitempty"` + ImageVersion *string `json:"image_version,omitempty"` +} + +// validateCreateHostedRunnerRequest validates the provided CreateHostedRunnerRequest to ensure // that all required fields are properly set and that no invalid fields are present for hosted runner create request. // // If any of these conditions are violated, an appropriate error message is returned. // Otherwise, nil is returned, indicating the request is valid. -func validateCreateHostedRunnerRequest(request *HostedRunnerRequest) error { - if request == nil { - return errors.New("request is required for creating a hosted runner") - } - if request.Size == "" { - return errors.New("size is required for creating a hosted runner") +func validateCreateHostedRunnerRequest(request *CreateHostedRunnerRequest) error { + if request.Name == "" { + return errors.New("name is required for creating a hosted runner") } if request.Image == (HostedRunnerImage{}) { return errors.New("image is required for creating a hosted runner") } - if request.Name == "" { - return errors.New("name is required for creating a hosted runner") + if request.Size == "" { + return errors.New("size is required for creating a hosted runner") } if request.RunnerGroupID == 0 { return errors.New("runner group ID is required for creating a hosted runner") } - if request.ImageVersion != "" { - return errors.New("imageVersion should not be set directly; use the Image struct to specify image details") - } return nil } @@ -133,8 +140,8 @@ func validateCreateHostedRunnerRequest(request *HostedRunnerRequest) error { // GitHub API docs: https://docs.github.com/rest/actions/hosted-runners#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 *HostedRunnerRequest) (*HostedRunner, *Response, error) { - if err := validateCreateHostedRunnerRequest(request); err != nil { +func (s *ActionsService) CreateHostedRunner(ctx context.Context, org string, request CreateHostedRunnerRequest) (*HostedRunner, *Response, error) { + if err := validateCreateHostedRunnerRequest(&request); err != nil { return nil, nil, fmt.Errorf("validation failed: %w", err) } @@ -317,33 +324,14 @@ func (s *ActionsService) GetHostedRunner(ctx context.Context, org string, runner return hostedRunner, resp, nil } -// validateUpdateHostedRunnerRequest validates the provided HostedRunnerRequest to ensure -// that no disallowed updates are made for a hosted runner update request. -// -// If any of these conditions are violated, an appropriate error message is returned. -// Otherwise, nil is returned, indicating the request is valid for an update. -func validateUpdateHostedRunnerRequest(request *HostedRunnerRequest) error { - if request.Size != "" { - return errors.New("size cannot be updated, API does not support updating size") - } - if request.Image != (HostedRunnerImage{}) { - return errors.New("image struct should not be set directly; use the ImageVersion to specify version details") - } - return nil -} - // UpdateHostedRunner updates a GitHub-hosted runner for an organization. // // GitHub API docs: https://docs.github.com/rest/actions/hosted-runners#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, updateReq HostedRunnerRequest) (*HostedRunner, *Response, error) { - if err := validateUpdateHostedRunnerRequest(&updateReq); err != nil { - return nil, nil, fmt.Errorf("validation failed: %w", err) - } - +func (s *ActionsService) UpdateHostedRunner(ctx context.Context, org string, runnerID int64, request UpdateHostedRunnerRequest) (*HostedRunner, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/hosted-runners/%v", org, runnerID) - req, err := s.client.NewRequest("PATCH", u, updateReq) + req, err := s.client.NewRequest("PATCH", u, request) if err != nil { return nil, nil, err } diff --git a/vendor/github.com/google/go-github/v75/github/actions_oidc.go b/vendor/github.com/google/go-github/v84/github/actions_oidc.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/actions_oidc.go rename to vendor/github.com/google/go-github/v84/github/actions_oidc.go diff --git a/vendor/github.com/google/go-github/v75/github/actions_permissions_enterprise.go b/vendor/github.com/google/go-github/v84/github/actions_permissions_enterprise.go similarity index 81% rename from vendor/github.com/google/go-github/v75/github/actions_permissions_enterprise.go rename to vendor/github.com/google/go-github/v84/github/actions_permissions_enterprise.go index fc4b67110..326230d64 100644 --- a/vendor/github.com/google/go-github/v75/github/actions_permissions_enterprise.go +++ b/vendor/github.com/google/go-github/v84/github/actions_permissions_enterprise.go @@ -68,12 +68,12 @@ func (s *ActionsService) GetActionsPermissionsInEnterprise(ctx context.Context, return permissions, resp, nil } -// EditActionsPermissionsInEnterprise sets the permissions policy in an enterprise. +// UpdateActionsPermissionsInEnterprise sets the permissions policy in an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-github-actions-permissions-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/permissions -func (s *ActionsService) EditActionsPermissionsInEnterprise(ctx context.Context, enterprise string, actionsPermissionsEnterprise ActionsPermissionsEnterprise) (*ActionsPermissionsEnterprise, *Response, error) { +func (s *ActionsService) UpdateActionsPermissionsInEnterprise(ctx context.Context, enterprise string, actionsPermissionsEnterprise ActionsPermissionsEnterprise) (*ActionsPermissionsEnterprise, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise) req, err := s.client.NewRequest("PUT", u, actionsPermissionsEnterprise) if err != nil { @@ -202,12 +202,12 @@ func (s *ActionsService) GetActionsAllowedInEnterprise(ctx context.Context, ente return actionsAllowed, resp, nil } -// EditActionsAllowedInEnterprise sets the actions that are allowed in an enterprise. +// UpdateActionsAllowedInEnterprise sets the actions that are allowed in an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/permissions/selected-actions -func (s *ActionsService) EditActionsAllowedInEnterprise(ctx context.Context, enterprise string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { +func (s *ActionsService) UpdateActionsAllowedInEnterprise(ctx context.Context, enterprise string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise) req, err := s.client.NewRequest("PUT", u, actionsAllowed) if err != nil { @@ -245,12 +245,12 @@ func (s *ActionsService) GetDefaultWorkflowPermissionsInEnterprise(ctx context.C return permissions, resp, nil } -// EditDefaultWorkflowPermissionsInEnterprise sets the GitHub Actions default workflow permissions for an enterprise. +// UpdateDefaultWorkflowPermissionsInEnterprise sets the GitHub Actions default workflow permissions for an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-default-workflow-permissions-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/permissions/workflow -func (s *ActionsService) EditDefaultWorkflowPermissionsInEnterprise(ctx context.Context, enterprise string, permissions DefaultWorkflowPermissionEnterprise) (*DefaultWorkflowPermissionEnterprise, *Response, error) { +func (s *ActionsService) UpdateDefaultWorkflowPermissionsInEnterprise(ctx context.Context, enterprise string, permissions DefaultWorkflowPermissionEnterprise) (*DefaultWorkflowPermissionEnterprise, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/workflow", enterprise) req, err := s.client.NewRequest("PUT", u, permissions) if err != nil { @@ -288,12 +288,12 @@ func (s *ActionsService) GetArtifactAndLogRetentionPeriodInEnterprise(ctx contex return arp, resp, nil } -// EditArtifactAndLogRetentionPeriodInEnterprise sets the artifact and log retention period for an enterprise. +// UpdateArtifactAndLogRetentionPeriodInEnterprise sets the artifact and log retention period for an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-artifact-and-log-retention-settings-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/permissions/artifact-and-log-retention -func (s *ActionsService) EditArtifactAndLogRetentionPeriodInEnterprise(ctx context.Context, enterprise string, period ArtifactPeriodOpt) (*Response, error) { +func (s *ActionsService) UpdateArtifactAndLogRetentionPeriodInEnterprise(ctx context.Context, enterprise string, period ArtifactPeriodOpt) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/artifact-and-log-retention", enterprise) req, err := s.client.NewRequest("PUT", u, period) if err != nil { @@ -324,12 +324,12 @@ func (s *ActionsService) GetSelfHostedRunnerPermissionsInEnterprise(ctx context. return permissions, resp, nil } -// EditSelfHostedRunnerPermissionsInEnterprise sets the self-hosted runner permissions for an enterprise. +// UpdateSelfHostedRunnerPermissionsInEnterprise sets the self-hosted runner permissions for an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-self-hosted-runners-permissions-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/permissions/self-hosted-runners -func (s *ActionsService) EditSelfHostedRunnerPermissionsInEnterprise(ctx context.Context, enterprise string, permissions SelfHostRunnerPermissionsEnterprise) (*Response, error) { +func (s *ActionsService) UpdateSelfHostedRunnerPermissionsInEnterprise(ctx context.Context, enterprise string, permissions SelfHostRunnerPermissionsEnterprise) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/self-hosted-runners", enterprise) req, err := s.client.NewRequest("PUT", u, permissions) if err != nil { @@ -375,3 +375,40 @@ func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise(ctx return s.client.Do(ctx, req, nil) } + +// GetEnterpriseForkPRContributorApprovalPermissions gets the fork PR contributor approval policy for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-fork-pr-contributor-approval-permissions-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions/fork-pr-contributor-approval +func (s *ActionsService) GetEnterpriseForkPRContributorApprovalPermissions(ctx context.Context, enterprise string) (*ContributorApprovalPermissions, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-contributor-approval", enterprise) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + policy := new(ContributorApprovalPermissions) + resp, err := s.client.Do(ctx, req, policy) + if err != nil { + return nil, resp, err + } + + return policy, resp, nil +} + +// UpdateEnterpriseForkPRContributorApprovalPermissions sets the fork PR contributor approval policy for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#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) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-contributor-approval", enterprise) + req, err := s.client.NewRequest("PUT", u, policy) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} diff --git a/vendor/github.com/google/go-github/v75/github/actions_permissions_orgs.go b/vendor/github.com/google/go-github/v84/github/actions_permissions_orgs.go similarity index 85% rename from vendor/github.com/google/go-github/v75/github/actions_permissions_orgs.go rename to vendor/github.com/google/go-github/v84/github/actions_permissions_orgs.go index fdd3181c5..626e39983 100644 --- a/vendor/github.com/google/go-github/v75/github/actions_permissions_orgs.go +++ b/vendor/github.com/google/go-github/v84/github/actions_permissions_orgs.go @@ -17,6 +17,7 @@ type ActionsPermissions struct { EnabledRepositories *string `json:"enabled_repositories,omitempty"` AllowedActions *string `json:"allowed_actions,omitempty"` SelectedActionsURL *string `json:"selected_actions_url,omitempty"` + SHAPinningRequired *bool `json:"sha_pinning_required,omitempty"` } func (a ActionsPermissions) String() string { @@ -87,12 +88,12 @@ func (s *ActionsService) GetActionsPermissions(ctx context.Context, org string) return permissions, resp, nil } -// EditActionsPermissions sets the permissions policy for repositories and allowed actions in an organization. +// UpdateActionsPermissions sets the permissions policy for repositories and allowed actions in an organization. // // GitHub API docs: https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions -func (s *ActionsService) EditActionsPermissions(ctx context.Context, org string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error) { +func (s *ActionsService) UpdateActionsPermissions(ctx context.Context, org string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions", org) req, err := s.client.NewRequest("PUT", u, actionsPermissions) if err != nil { @@ -221,12 +222,12 @@ func (s *ActionsService) GetActionsAllowed(ctx context.Context, org string) (*Ac return actionsAllowed, resp, nil } -// EditActionsAllowed sets the actions that are allowed in an organization. +// UpdateActionsAllowed sets the actions that are allowed in an organization. // // GitHub API docs: https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions/selected-actions -func (s *ActionsService) EditActionsAllowed(ctx context.Context, org string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { +func (s *ActionsService) UpdateActionsAllowed(ctx context.Context, org string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org) req, err := s.client.NewRequest("PUT", u, actionsAllowed) if err != nil { @@ -264,12 +265,12 @@ func (s *ActionsService) GetDefaultWorkflowPermissionsInOrganization(ctx context return permissions, resp, nil } -// EditDefaultWorkflowPermissionsInOrganization sets the GitHub Actions default workflow permissions for an organization. +// UpdateDefaultWorkflowPermissionsInOrganization sets the GitHub Actions default workflow permissions for an organization. // // GitHub API docs: https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions/workflow -func (s *ActionsService) EditDefaultWorkflowPermissionsInOrganization(ctx context.Context, org string, permissions DefaultWorkflowPermissionOrganization) (*DefaultWorkflowPermissionOrganization, *Response, error) { +func (s *ActionsService) UpdateDefaultWorkflowPermissionsInOrganization(ctx context.Context, org string, permissions DefaultWorkflowPermissionOrganization) (*DefaultWorkflowPermissionOrganization, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/workflow", org) req, err := s.client.NewRequest("PUT", u, permissions) if err != nil { @@ -307,12 +308,12 @@ func (s *ActionsService) GetArtifactAndLogRetentionPeriodInOrganization(ctx cont return arp, resp, nil } -// EditArtifactAndLogRetentionPeriodInOrganization sets the artifact and log retention period for an organization. +// UpdateArtifactAndLogRetentionPeriodInOrganization sets the artifact and log retention period for an organization. // // GitHub API docs: https://docs.github.com/rest/actions/permissions#set-artifact-and-log-retention-settings-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions/artifact-and-log-retention -func (s *ActionsService) EditArtifactAndLogRetentionPeriodInOrganization(ctx context.Context, org string, period ArtifactPeriodOpt) (*Response, error) { +func (s *ActionsService) UpdateArtifactAndLogRetentionPeriodInOrganization(ctx context.Context, org string, period ArtifactPeriodOpt) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/artifact-and-log-retention", org) req, err := s.client.NewRequest("PUT", u, period) if err != nil { @@ -344,12 +345,12 @@ func (s *ActionsService) GetSelfHostedRunnersSettingsInOrganization(ctx context. return settings, resp, nil } -// EditSelfHostedRunnersSettingsInOrganization sets the self-hosted runners permissions settings for repositories in an organization. +// UpdateSelfHostedRunnersSettingsInOrganization sets the self-hosted runners permissions settings for repositories in an organization. // // GitHub API docs: https://docs.github.com/rest/actions/permissions#set-self-hosted-runners-settings-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions/self-hosted-runners -func (s *ActionsService) EditSelfHostedRunnersSettingsInOrganization(ctx context.Context, org string, opt SelfHostedRunnersSettingsOrganizationOpt) (*Response, error) { +func (s *ActionsService) UpdateSelfHostedRunnersSettingsInOrganization(ctx context.Context, org string, opt SelfHostedRunnersSettingsOrganizationOpt) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/self-hosted-runners", org) req, err := s.client.NewRequest("PUT", u, opt) @@ -483,3 +484,40 @@ func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInOrganization(c return s.client.Do(ctx, req, nil) } + +// GetOrganizationForkPRContributorApprovalPermissions gets the fork PR contributor approval policy for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-fork-pr-contributor-approval-permissions-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/fork-pr-contributor-approval +func (s *ActionsService) GetOrganizationForkPRContributorApprovalPermissions(ctx context.Context, org string) (*ContributorApprovalPermissions, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/fork-pr-contributor-approval", org) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + policy := new(ContributorApprovalPermissions) + resp, err := s.client.Do(ctx, req, policy) + if err != nil { + return nil, resp, err + } + + return policy, resp, nil +} + +// UpdateOrganizationForkPRContributorApprovalPermissions sets the fork PR contributor approval policy for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#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) { + u := fmt.Sprintf("orgs/%v/actions/permissions/fork-pr-contributor-approval", org) + req, err := s.client.NewRequest("PUT", u, policy) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} diff --git a/vendor/github.com/google/go-github/v75/github/actions_runner_groups.go b/vendor/github.com/google/go-github/v84/github/actions_runner_groups.go similarity index 97% rename from vendor/github.com/google/go-github/v75/github/actions_runner_groups.go rename to vendor/github.com/google/go-github/v84/github/actions_runner_groups.go index b2ee32f61..dc54a8485 100644 --- a/vendor/github.com/google/go-github/v75/github/actions_runner_groups.go +++ b/vendor/github.com/google/go-github/v84/github/actions_runner_groups.go @@ -18,6 +18,8 @@ type RunnerGroup struct { Default *bool `json:"default,omitempty"` SelectedRepositoriesURL *string `json:"selected_repositories_url,omitempty"` RunnersURL *string `json:"runners_url,omitempty"` + HostedRunnersURL *string `json:"hosted_runners_url,omitempty"` + NetworkConfigurationID *string `json:"network_configuration_id,omitempty"` Inherited *bool `json:"inherited,omitempty"` AllowsPublicRepositories *bool `json:"allows_public_repositories,omitempty"` RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"` @@ -45,6 +47,8 @@ type CreateRunnerGroupRequest struct { RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"` // List of workflows the runner group should be allowed to run. This setting will be ignored unless RestrictedToWorkflows is set to true. SelectedWorkflows []string `json:"selected_workflows,omitempty"` + // The identifier of a hosted compute network configuration. + NetworkConfigurationID *string `json:"network_configuration_id,omitempty"` } // UpdateRunnerGroupRequest represents a request to update a Runner group for an organization. @@ -54,6 +58,7 @@ type UpdateRunnerGroupRequest struct { AllowsPublicRepositories *bool `json:"allows_public_repositories,omitempty"` RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"` SelectedWorkflows []string `json:"selected_workflows,omitempty"` + NetworkConfigurationID *string `json:"network_configuration_id,omitempty"` } // SetRepoAccessRunnerGroupRequest represents a request to replace the list of repositories diff --git a/vendor/github.com/google/go-github/v75/github/actions_runners.go b/vendor/github.com/google/go-github/v84/github/actions_runners.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/actions_runners.go rename to vendor/github.com/google/go-github/v84/github/actions_runners.go diff --git a/vendor/github.com/google/go-github/v75/github/actions_secrets.go b/vendor/github.com/google/go-github/v84/github/actions_secrets.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/actions_secrets.go rename to vendor/github.com/google/go-github/v84/github/actions_secrets.go diff --git a/vendor/github.com/google/go-github/v75/github/actions_variables.go b/vendor/github.com/google/go-github/v84/github/actions_variables.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/actions_variables.go rename to vendor/github.com/google/go-github/v84/github/actions_variables.go diff --git a/vendor/github.com/google/go-github/v75/github/actions_workflow_jobs.go b/vendor/github.com/google/go-github/v84/github/actions_workflow_jobs.go similarity index 98% rename from vendor/github.com/google/go-github/v75/github/actions_workflow_jobs.go rename to vendor/github.com/google/go-github/v84/github/actions_workflow_jobs.go index 10067c8b2..dabc80917 100644 --- a/vendor/github.com/google/go-github/v75/github/actions_workflow_jobs.go +++ b/vendor/github.com/google/go-github/v84/github/actions_workflow_jobs.go @@ -74,7 +74,7 @@ type ListWorkflowJobsOptions struct { // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs func (s *ActionsService) ListWorkflowJobs(ctx context.Context, owner, repo string, runID int64, opts *ListWorkflowJobsOptions) (*Jobs, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/actions/runs/%v/jobs", owner, repo, runID) + u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/jobs", owner, repo, runID) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -100,7 +100,7 @@ func (s *ActionsService) ListWorkflowJobs(ctx context.Context, owner, repo strin // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs func (s *ActionsService) ListWorkflowJobsAttempt(ctx context.Context, owner, repo string, runID, attemptNumber int64, opts *ListOptions) (*Jobs, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/actions/runs/%v/attempts/%v/jobs", owner, repo, runID, attemptNumber) + u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/attempts/%v/jobs", owner, repo, runID, attemptNumber) u, err := addOptions(u, opts) if err != nil { return nil, nil, err diff --git a/vendor/github.com/google/go-github/v75/github/actions_workflow_runs.go b/vendor/github.com/google/go-github/v84/github/actions_workflow_runs.go similarity index 98% rename from vendor/github.com/google/go-github/v75/github/actions_workflow_runs.go rename to vendor/github.com/google/go-github/v84/github/actions_workflow_runs.go index 2e20f1be3..7b13a23ef 100644 --- a/vendor/github.com/google/go-github/v75/github/actions_workflow_runs.go +++ b/vendor/github.com/google/go-github/v84/github/actions_workflow_runs.go @@ -164,7 +164,7 @@ func (s *ActionsService) listWorkflowRuns(ctx context.Context, endpoint string, // //meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs func (s *ActionsService) ListWorkflowRunsByID(ctx context.Context, owner, repo string, workflowID int64, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/actions/workflows/%v/runs", owner, repo, workflowID) + u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/runs", owner, repo, workflowID) return s.listWorkflowRuns(ctx, u, opts) } @@ -174,7 +174,7 @@ func (s *ActionsService) ListWorkflowRunsByID(ctx context.Context, owner, repo s // //meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs func (s *ActionsService) ListWorkflowRunsByFileName(ctx context.Context, owner, repo, workflowFileName string, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/actions/workflows/%v/runs", owner, repo, workflowFileName) + u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/runs", owner, repo, workflowFileName) return s.listWorkflowRuns(ctx, u, opts) } @@ -184,7 +184,7 @@ func (s *ActionsService) ListWorkflowRunsByFileName(ctx context.Context, owner, // //meta:operation GET /repos/{owner}/{repo}/actions/runs func (s *ActionsService) ListRepositoryWorkflowRuns(ctx context.Context, owner, repo string, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/actions/runs", owner, repo) + u := fmt.Sprintf("repos/%v/%v/actions/runs", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -306,7 +306,7 @@ func (s *ActionsService) getWorkflowRunAttemptLogsWithRateLimit(ctx context.Cont } // RerunWorkflowByID re-runs a workflow by ID. -// You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID a the DeploymentProtectionRuleEvent. +// You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID of a DeploymentProtectionRuleEvent. // // GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#re-run-a-workflow // @@ -398,7 +398,7 @@ func (s *ActionsService) getWorkflowRunLogsWithoutRateLimit(ctx context.Context, defer resp.Body.Close() if resp.StatusCode != http.StatusFound { - return nil, newResponse(resp), fmt.Errorf("unexpected status code: %s", resp.Status) + return nil, newResponse(resp), fmt.Errorf("unexpected status code: %v", resp.Status) } parsedURL, err := url.Parse(resp.Header.Get("Location")) diff --git a/vendor/github.com/google/go-github/v75/github/actions_workflows.go b/vendor/github.com/google/go-github/v84/github/actions_workflows.go similarity index 88% rename from vendor/github.com/google/go-github/v75/github/actions_workflows.go rename to vendor/github.com/google/go-github/v84/github/actions_workflows.go index dbde83cf3..582949f4d 100644 --- a/vendor/github.com/google/go-github/v75/github/actions_workflows.go +++ b/vendor/github.com/google/go-github/v84/github/actions_workflows.go @@ -51,9 +51,20 @@ type CreateWorkflowDispatchEventRequest struct { // Ref is required when creating a workflow dispatch event. Ref string `json:"ref"` // Inputs represents input keys and values configured in the workflow file. - // The maximum number of properties is 10. + // The maximum number of properties is 25. // Default: Any default properties configured in the workflow file will be used when `inputs` are omitted. Inputs map[string]any `json:"inputs,omitempty"` + // ReturnRunDetails specifies whether the response should include + // the workflow run ID and URLs. + ReturnRunDetails *bool `json:"return_run_details,omitempty"` +} + +// WorkflowDispatchRunDetails represents the response from creating +// a workflow dispatch event when ReturnRunDetails is set to true. +type WorkflowDispatchRunDetails struct { + WorkflowRunID *int64 `json:"workflow_run_id,omitempty"` + RunURL *string `json:"run_url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` } // WorkflowsPermissions represents the permissions for workflows in a repository. @@ -76,13 +87,23 @@ type WorkflowsPermissionsOpt struct { RequireApprovalForForkPRWorkflows *bool `json:"require_approval_for_fork_pr_workflows,omitempty"` } +// ContributorApprovalPermissions represents the policy that controls +// when fork PR workflows require approval from a maintainer. +type ContributorApprovalPermissions struct { + ApprovalPolicy string `json:"approval_policy"` +} + +func (p ContributorApprovalPermissions) String() string { + return Stringify(p) +} + // ListWorkflows lists all workflows in a repository. // // GitHub API docs: https://docs.github.com/rest/actions/workflows#list-repository-workflows // //meta:operation GET /repos/{owner}/{repo}/actions/workflows func (s *ActionsService) ListWorkflows(ctx context.Context, owner, repo string, opts *ListOptions) (*Workflows, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/actions/workflows", owner, repo) + u := fmt.Sprintf("repos/%v/%v/actions/workflows", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -181,7 +202,7 @@ func (s *ActionsService) getWorkflowUsage(ctx context.Context, url string) (*Wor // GitHub API docs: https://docs.github.com/rest/actions/workflows#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) (*Response, error) { +func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, owner, repo string, workflowID int64, event CreateWorkflowDispatchEventRequest) (*WorkflowDispatchRunDetails, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/dispatches", owner, repo, workflowID) return s.createWorkflowDispatchEvent(ctx, u, &event) @@ -192,19 +213,25 @@ func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, ow // GitHub API docs: https://docs.github.com/rest/actions/workflows#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) (*Response, error) { +func (s *ActionsService) CreateWorkflowDispatchEventByFileName(ctx context.Context, owner, repo, workflowFileName string, event CreateWorkflowDispatchEventRequest) (*WorkflowDispatchRunDetails, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/dispatches", owner, repo, workflowFileName) return s.createWorkflowDispatchEvent(ctx, u, &event) } -func (s *ActionsService) createWorkflowDispatchEvent(ctx context.Context, url string, event *CreateWorkflowDispatchEventRequest) (*Response, error) { +func (s *ActionsService) createWorkflowDispatchEvent(ctx context.Context, url string, event *CreateWorkflowDispatchEventRequest) (*WorkflowDispatchRunDetails, *Response, error) { req, err := s.client.NewRequest("POST", url, event) if err != nil { - return nil, err + return nil, nil, err } - return s.client.Do(ctx, req, nil) + var dispatchRunDetails *WorkflowDispatchRunDetails + resp, err := s.client.Do(ctx, req, &dispatchRunDetails) + if err != nil { + return nil, resp, err + } + + return dispatchRunDetails, resp, nil } // EnableWorkflowByID enables a workflow and sets the state of the workflow to "active". diff --git a/vendor/github.com/google/go-github/v75/github/activity.go b/vendor/github.com/google/go-github/v84/github/activity.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/activity.go rename to vendor/github.com/google/go-github/v84/github/activity.go diff --git a/vendor/github.com/google/go-github/v75/github/activity_events.go b/vendor/github.com/google/go-github/v84/github/activity_events.go similarity index 99% rename from vendor/github.com/google/go-github/v75/github/activity_events.go rename to vendor/github.com/google/go-github/v84/github/activity_events.go index b12baa99e..597f79920 100644 --- a/vendor/github.com/google/go-github/v75/github/activity_events.go +++ b/vendor/github.com/google/go-github/v84/github/activity_events.go @@ -143,6 +143,7 @@ func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org str // true, only public events will be returned. // // GitHub API docs: https://docs.github.com/rest/activity/events#list-events-for-the-authenticated-user +// // GitHub API docs: https://docs.github.com/rest/activity/events#list-public-events-for-a-user // //meta:operation GET /users/{username}/events @@ -177,6 +178,7 @@ func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user st // true, only public events will be returned. // // GitHub API docs: https://docs.github.com/rest/activity/events#list-events-received-by-the-authenticated-user +// // GitHub API docs: https://docs.github.com/rest/activity/events#list-public-events-received-by-a-user // //meta:operation GET /users/{username}/received_events diff --git a/vendor/github.com/google/go-github/v75/github/activity_notifications.go b/vendor/github.com/google/go-github/v84/github/activity_notifications.go similarity index 97% rename from vendor/github.com/google/go-github/v75/github/activity_notifications.go rename to vendor/github.com/google/go-github/v84/github/activity_notifications.go index e712323ed..feb38ea33 100644 --- a/vendor/github.com/google/go-github/v75/github/activity_notifications.go +++ b/vendor/github.com/google/go-github/v84/github/activity_notifications.go @@ -101,10 +101,11 @@ func (s *ActivityService) ListRepositoryNotifications(ctx context.Context, owner } type markReadOptions struct { - LastReadAt Timestamp `json:"last_read_at,omitempty"` + LastReadAt Timestamp `json:"last_read_at,omitzero"` } // MarkNotificationsRead marks all notifications up to lastRead as read. +// If lastRead is the zero value, all notifications in the repository are marked as read. // // GitHub API docs: https://docs.github.com/rest/activity/notifications#mark-notifications-as-read // @@ -123,6 +124,7 @@ func (s *ActivityService) MarkNotificationsRead(ctx context.Context, lastRead Ti // MarkRepositoryNotificationsRead marks all notifications up to lastRead in // the specified repository as read. +// If lastRead is the zero value, all notifications in the repository are marked as read. // // GitHub API docs: https://docs.github.com/rest/activity/notifications#mark-repository-notifications-as-read // diff --git a/vendor/github.com/google/go-github/v75/github/activity_star.go b/vendor/github.com/google/go-github/v84/github/activity_star.go similarity index 97% rename from vendor/github.com/google/go-github/v75/github/activity_star.go rename to vendor/github.com/google/go-github/v84/github/activity_star.go index 782c09884..d9383e434 100644 --- a/vendor/github.com/google/go-github/v75/github/activity_star.go +++ b/vendor/github.com/google/go-github/v84/github/activity_star.go @@ -29,7 +29,7 @@ type Stargazer struct { // //meta:operation GET /repos/{owner}/{repo}/stargazers func (s *ActivityService) ListStargazers(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Stargazer, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/stargazers", owner, repo) + u := fmt.Sprintf("repos/%v/%v/stargazers", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -59,7 +59,7 @@ type ActivityListStarredOptions struct { Sort string `url:"sort,omitempty"` // Direction in which to sort repositories. Possible values are: asc, desc. - // Default is "asc" when sort is "full_name", otherwise default is "desc". + // Default is "asc" when sort is "full_name"; otherwise, default is "desc". Direction string `url:"direction,omitempty"` ListOptions @@ -69,6 +69,7 @@ type ActivityListStarredOptions struct { // will list the starred repositories for the authenticated user. // // GitHub API docs: https://docs.github.com/rest/activity/starring#list-repositories-starred-by-a-user +// // GitHub API docs: https://docs.github.com/rest/activity/starring#list-repositories-starred-by-the-authenticated-user // //meta:operation GET /user/starred diff --git a/vendor/github.com/google/go-github/v75/github/activity_watching.go b/vendor/github.com/google/go-github/v84/github/activity_watching.go similarity index 95% rename from vendor/github.com/google/go-github/v75/github/activity_watching.go rename to vendor/github.com/google/go-github/v84/github/activity_watching.go index 348590057..8106d799c 100644 --- a/vendor/github.com/google/go-github/v75/github/activity_watching.go +++ b/vendor/github.com/google/go-github/v84/github/activity_watching.go @@ -31,7 +31,7 @@ type Subscription struct { // //meta:operation GET /repos/{owner}/{repo}/subscribers func (s *ActivityService) ListWatchers(ctx context.Context, owner, repo string, opts *ListOptions) ([]*User, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/subscribers", owner, repo) + u := fmt.Sprintf("repos/%v/%v/subscribers", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -55,6 +55,7 @@ func (s *ActivityService) ListWatchers(ctx context.Context, owner, repo string, // the empty string will fetch watched repos for the authenticated user. // // GitHub API docs: https://docs.github.com/rest/activity/watching#list-repositories-watched-by-a-user +// // GitHub API docs: https://docs.github.com/rest/activity/watching#list-repositories-watched-by-the-authenticated-user // //meta:operation GET /user/subscriptions @@ -93,7 +94,7 @@ func (s *ActivityService) ListWatched(ctx context.Context, user string, opts *Li // //meta:operation GET /repos/{owner}/{repo}/subscription func (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner, repo string) (*Subscription, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo) + u := fmt.Sprintf("repos/%v/%v/subscription", owner, repo) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -122,7 +123,7 @@ func (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner, // //meta:operation PUT /repos/{owner}/{repo}/subscription func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, repo string, subscription *Subscription) (*Subscription, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo) + u := fmt.Sprintf("repos/%v/%v/subscription", owner, repo) req, err := s.client.NewRequest("PUT", u, subscription) if err != nil { @@ -148,7 +149,7 @@ func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, // //meta:operation DELETE /repos/{owner}/{repo}/subscription func (s *ActivityService) DeleteRepositorySubscription(ctx context.Context, owner, repo string) (*Response, error) { - u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo) + u := fmt.Sprintf("repos/%v/%v/subscription", owner, repo) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err diff --git a/vendor/github.com/google/go-github/v75/github/admin.go b/vendor/github.com/google/go-github/v84/github/admin.go similarity index 97% rename from vendor/github.com/google/go-github/v75/github/admin.go rename to vendor/github.com/google/go-github/v84/github/admin.go index 021a12ad8..89b40ae26 100644 --- a/vendor/github.com/google/go-github/v75/github/admin.go +++ b/vendor/github.com/google/go-github/v84/github/admin.go @@ -82,7 +82,7 @@ func (m Enterprise) String() string { // UpdateUserLDAPMapping updates the mapping between a GitHub user and an LDAP user. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/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) { @@ -103,7 +103,7 @@ func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, m // UpdateTeamLDAPMapping updates the mapping between a GitHub team and an LDAP group. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/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) { diff --git a/vendor/github.com/google/go-github/v75/github/admin_orgs.go b/vendor/github.com/google/go-github/v84/github/admin_orgs.go similarity index 94% rename from vendor/github.com/google/go-github/v75/github/admin_orgs.go rename to vendor/github.com/google/go-github/v84/github/admin_orgs.go index eb3f8d2df..b06c5b71f 100644 --- a/vendor/github.com/google/go-github/v75/github/admin_orgs.go +++ b/vendor/github.com/google/go-github/v84/github/admin_orgs.go @@ -23,7 +23,7 @@ type createOrgRequest struct { // Note that only a subset of the org fields are used and org must // not be nil. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/orgs#create-an-organization +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/orgs#create-an-organization // //meta:operation POST /admin/organizations func (s *AdminService) CreateOrg(ctx context.Context, org *Organization, admin string) (*Organization, *Response, error) { @@ -62,7 +62,7 @@ type RenameOrgResponse struct { // RenameOrg renames an organization in GitHub Enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/orgs#update-an-organization-name +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/orgs#update-an-organization-name // //meta:operation PATCH /admin/organizations/{org} func (s *AdminService) RenameOrg(ctx context.Context, org *Organization, newName string) (*RenameOrgResponse, *Response, error) { @@ -78,7 +78,7 @@ func (s *AdminService) RenameOrg(ctx context.Context, org *Organization, newName // RenameOrgByName renames an organization in GitHub Enterprise using its current name. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/orgs#update-an-organization-name +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/orgs#update-an-organization-name // //meta:operation PATCH /admin/organizations/{org} func (s *AdminService) RenameOrgByName(ctx context.Context, org, newName string) (*RenameOrgResponse, *Response, error) { diff --git a/vendor/github.com/google/go-github/v75/github/admin_stats.go b/vendor/github.com/google/go-github/v84/github/admin_stats.go similarity index 98% rename from vendor/github.com/google/go-github/v75/github/admin_stats.go rename to vendor/github.com/google/go-github/v84/github/admin_stats.go index 07465b8d6..17527e1fa 100644 --- a/vendor/github.com/google/go-github/v75/github/admin_stats.go +++ b/vendor/github.com/google/go-github/v84/github/admin_stats.go @@ -152,7 +152,7 @@ func (s RepoStats) String() string { // Please note that this is only available to site administrators, // otherwise it will error with a 404 not found (instead of 401 or 403). // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/admin-stats#get-all-statistics +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/admin-stats#get-all-statistics // //meta:operation GET /enterprise/stats/all func (s *AdminService) GetAdminStats(ctx context.Context) (*AdminStats, *Response, error) { diff --git a/vendor/github.com/google/go-github/v75/github/admin_users.go b/vendor/github.com/google/go-github/v84/github/admin_users.go similarity index 91% rename from vendor/github.com/google/go-github/v75/github/admin_users.go rename to vendor/github.com/google/go-github/v84/github/admin_users.go index 843a177be..05f123175 100644 --- a/vendor/github.com/google/go-github/v75/github/admin_users.go +++ b/vendor/github.com/google/go-github/v84/github/admin_users.go @@ -20,7 +20,7 @@ type CreateUserRequest struct { // CreateUser creates a new user in GitHub Enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#create-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/users#create-a-user // //meta:operation POST /admin/users func (s *AdminService) CreateUser(ctx context.Context, userReq CreateUserRequest) (*User, *Response, error) { @@ -42,7 +42,7 @@ func (s *AdminService) CreateUser(ctx context.Context, userReq CreateUserRequest // DeleteUser deletes a user in GitHub Enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#delete-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/users#delete-a-user // //meta:operation DELETE /admin/users/{username} func (s *AdminService) DeleteUser(ctx context.Context, username string) (*Response, error) { @@ -95,11 +95,11 @@ type UserAuthorization struct { // CreateUserImpersonation creates an impersonation OAuth token. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#create-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/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) { - u := fmt.Sprintf("admin/users/%s/authorizations", username) + u := fmt.Sprintf("admin/users/%v/authorizations", username) req, err := s.client.NewRequest("POST", u, opts) if err != nil { @@ -117,11 +117,11 @@ func (s *AdminService) CreateUserImpersonation(ctx context.Context, username str // DeleteUserImpersonation deletes an impersonation OAuth token. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#delete-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/users#delete-an-impersonation-oauth-token // //meta:operation DELETE /admin/users/{username}/authorizations func (s *AdminService) DeleteUserImpersonation(ctx context.Context, username string) (*Response, error) { - u := fmt.Sprintf("admin/users/%s/authorizations", username) + u := fmt.Sprintf("admin/users/%v/authorizations", username) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { diff --git a/vendor/github.com/google/go-github/v75/github/apps.go b/vendor/github.com/google/go-github/v84/github/apps.go similarity index 98% rename from vendor/github.com/google/go-github/v75/github/apps.go rename to vendor/github.com/google/go-github/v84/github/apps.go index 441a64fb1..eb78203a6 100644 --- a/vendor/github.com/google/go-github/v75/github/apps.go +++ b/vendor/github.com/google/go-github/v84/github/apps.go @@ -115,6 +115,7 @@ type InstallationPermissions struct { OrganizationCodespaces *string `json:"organization_codespaces,omitempty"` OrganizationCodespacesSecrets *string `json:"organization_codespaces_secrets,omitempty"` OrganizationCodespacesSettings *string `json:"organization_codespaces_settings,omitempty"` + OrganizationCopilotMetrics *string `json:"organization_copilot_metrics,omitempty"` OrganizationCopilotSeatManagement *string `json:"organization_copilot_seat_management,omitempty"` OrganizationCustomProperties *string `json:"organization_custom_properties,omitempty"` OrganizationCustomRoles *string `json:"organization_custom_roles,omitempty"` @@ -168,6 +169,7 @@ type InstallationRequest struct { type Installation struct { ID *int64 `json:"id,omitempty"` NodeID *string `json:"node_id,omitempty"` + ClientID *string `json:"client_id,omitempty"` AppID *int64 `json:"app_id,omitempty"` AppSlug *string `json:"app_slug,omitempty"` TargetID *int64 `json:"target_id,omitempty"` @@ -214,6 +216,7 @@ func (i Installation) String() string { // (e.g., https://github.com/settings/apps/:app_slug). // // GitHub API docs: https://docs.github.com/rest/apps/apps#get-an-app +// // GitHub API docs: https://docs.github.com/rest/apps/apps#get-the-authenticated-app // //meta:operation GET /app @@ -433,7 +436,6 @@ func (s *AppsService) CreateAttachment(ctx context.Context, contentReferenceID i return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeContentAttachmentsPreview) m := &Attachment{} @@ -469,7 +471,7 @@ func (s *AppsService) FindRepositoryInstallation(ctx context.Context, owner, rep // //meta:operation GET /repositories/{repository_id}/installation func (s *AppsService) FindRepositoryInstallationByID(ctx context.Context, id int64) (*Installation, *Response, error) { - return s.getInstallation(ctx, fmt.Sprintf("repositories/%d/installation", id)) + return s.getInstallation(ctx, fmt.Sprintf("repositories/%v/installation", id)) } // FindUserInstallation finds the user's installation information. diff --git a/vendor/github.com/google/go-github/v75/github/apps_hooks.go b/vendor/github.com/google/go-github/v84/github/apps_hooks.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/apps_hooks.go rename to vendor/github.com/google/go-github/v84/github/apps_hooks.go diff --git a/vendor/github.com/google/go-github/v75/github/apps_hooks_deliveries.go b/vendor/github.com/google/go-github/v84/github/apps_hooks_deliveries.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/apps_hooks_deliveries.go rename to vendor/github.com/google/go-github/v84/github/apps_hooks_deliveries.go diff --git a/vendor/github.com/google/go-github/v75/github/apps_installation.go b/vendor/github.com/google/go-github/v84/github/apps_installation.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/apps_installation.go rename to vendor/github.com/google/go-github/v84/github/apps_installation.go diff --git a/vendor/github.com/google/go-github/v75/github/apps_manifest.go b/vendor/github.com/google/go-github/v84/github/apps_manifest.go similarity index 96% rename from vendor/github.com/google/go-github/v75/github/apps_manifest.go rename to vendor/github.com/google/go-github/v84/github/apps_manifest.go index 5b6ff9af4..fdd8d7b1e 100644 --- a/vendor/github.com/google/go-github/v75/github/apps_manifest.go +++ b/vendor/github.com/google/go-github/v84/github/apps_manifest.go @@ -35,7 +35,7 @@ type AppConfig struct { // //meta:operation POST /app-manifests/{code}/conversions func (s *AppsService) CompleteAppManifest(ctx context.Context, code string) (*AppConfig, *Response, error) { - u := fmt.Sprintf("app-manifests/%s/conversions", code) + u := fmt.Sprintf("app-manifests/%v/conversions", code) req, err := s.client.NewRequest("POST", u, nil) if err != nil { return nil, nil, err diff --git a/vendor/github.com/google/go-github/v75/github/apps_marketplace.go b/vendor/github.com/google/go-github/v84/github/apps_marketplace.go similarity index 99% rename from vendor/github.com/google/go-github/v75/github/apps_marketplace.go rename to vendor/github.com/google/go-github/v84/github/apps_marketplace.go index 976775a79..33382378e 100644 --- a/vendor/github.com/google/go-github/v75/github/apps_marketplace.go +++ b/vendor/github.com/google/go-github/v84/github/apps_marketplace.go @@ -90,6 +90,7 @@ type MarketplacePurchaseAccount struct { // ListPlans lists all plans for your Marketplace listing. // // GitHub API docs: https://docs.github.com/rest/apps/marketplace#list-plans +// // GitHub API docs: https://docs.github.com/rest/apps/marketplace#list-plans-stubbed // //meta:operation GET /marketplace_listing/plans @@ -118,6 +119,7 @@ func (s *MarketplaceService) ListPlans(ctx context.Context, opts *ListOptions) ( // ListPlanAccountsForPlan lists all GitHub accounts (user or organization) on a specific plan. // // GitHub API docs: https://docs.github.com/rest/apps/marketplace#list-accounts-for-a-plan +// // GitHub API docs: https://docs.github.com/rest/apps/marketplace#list-accounts-for-a-plan-stubbed // //meta:operation GET /marketplace_listing/plans/{plan_id}/accounts @@ -146,6 +148,7 @@ func (s *MarketplaceService) ListPlanAccountsForPlan(ctx context.Context, planID // GetPlanAccountForAccount get GitHub account (user or organization) associated with an account. // // GitHub API docs: https://docs.github.com/rest/apps/marketplace#get-a-subscription-plan-for-an-account +// // GitHub API docs: https://docs.github.com/rest/apps/marketplace#get-a-subscription-plan-for-an-account-stubbed // //meta:operation GET /marketplace_listing/accounts/{account_id} @@ -170,6 +173,7 @@ func (s *MarketplaceService) GetPlanAccountForAccount(ctx context.Context, accou // ListMarketplacePurchasesForUser lists all GitHub marketplace purchases made by a user. // // GitHub API docs: https://docs.github.com/rest/apps/marketplace#list-subscriptions-for-the-authenticated-user +// // GitHub API docs: https://docs.github.com/rest/apps/marketplace#list-subscriptions-for-the-authenticated-user-stubbed // //meta:operation GET /user/marketplace_purchases diff --git a/vendor/github.com/google/go-github/v75/github/attestations.go b/vendor/github.com/google/go-github/v84/github/attestations.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/attestations.go rename to vendor/github.com/google/go-github/v84/github/attestations.go diff --git a/vendor/github.com/google/go-github/v75/github/authorizations.go b/vendor/github.com/google/go-github/v84/github/authorizations.go similarity index 98% rename from vendor/github.com/google/go-github/v75/github/authorizations.go rename to vendor/github.com/google/go-github/v84/github/authorizations.go index 6f22e40a1..24bbc4d3a 100644 --- a/vendor/github.com/google/go-github/v75/github/authorizations.go +++ b/vendor/github.com/google/go-github/v84/github/authorizations.go @@ -257,7 +257,7 @@ func (s *AuthorizationsService) DeleteGrant(ctx context.Context, clientID, acces // you can e.g. create or delete a user's public SSH key. NOTE: creating a // new token automatically revokes an existing one. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#create-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/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) { @@ -279,7 +279,7 @@ func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, usernam // // NOTE: there can be only one at a time. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#delete-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/users#delete-an-impersonation-oauth-token // //meta:operation DELETE /admin/users/{username}/authorizations func (s *AuthorizationsService) DeleteImpersonation(ctx context.Context, username string) (*Response, error) { diff --git a/vendor/github.com/google/go-github/v84/github/billing.go b/vendor/github.com/google/go-github/v84/github/billing.go new file mode 100644 index 000000000..29cccbaab --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/billing.go @@ -0,0 +1,394 @@ +// Copyright 2021 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// BillingService provides access to the billing related functions +// in the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/billing +type BillingService service + +// MinutesUsedBreakdown counts the actions minutes used by machine type (e.g. UBUNTU, WINDOWS, MACOS). +type MinutesUsedBreakdown = map[string]int + +// PackagesBilling represents billing of GitHub Packages . +type PackagesBilling struct { + TotalGigabytesBandwidthUsed int `json:"total_gigabytes_bandwidth_used"` + TotalPaidGigabytesBandwidthUsed int `json:"total_paid_gigabytes_bandwidth_used"` + IncludedGigabytesBandwidth int `json:"included_gigabytes_bandwidth"` +} + +// StorageBilling represents a GitHub Storage billing. +type StorageBilling struct { + DaysLeftInBillingCycle int `json:"days_left_in_billing_cycle"` + EstimatedPaidStorageForMonth int `json:"estimated_paid_storage_for_month"` + EstimatedStorageForMonth int `json:"estimated_storage_for_month"` +} + +// ActiveCommittersListOptions specifies optional parameters to the +// BillingService.GetAdvancedSecurityActiveCommittersOrg method. +type ActiveCommittersListOptions struct { + // The security product to get GitHub Advanced Security active committers for. For standalone + // Code Scanning or Secret Protection products, this parameter is required to specify which + // product you want committer information for. For other plans this parameter cannot be used. + // + // Can be one of: "code_security", "secret_protection". + AdvancedSecurityProduct *string `url:"advanced_security_product,omitempty"` + + ListOptions +} + +// ActiveCommitters represents the total active committers across all repositories in an Organization. +type ActiveCommitters struct { + TotalAdvancedSecurityCommitters *int `json:"total_advanced_security_committers,omitempty"` + TotalCount *int `json:"total_count,omitempty"` + MaximumAdvancedSecurityCommitters *int `json:"maximum_advanced_security_committers,omitempty"` + PurchasedAdvancedSecurityCommitters *int `json:"purchased_advanced_security_committers,omitempty"` + Repositories []*RepositoryActiveCommitters `json:"repositories"` +} + +// RepositoryActiveCommitters represents active committers on each repository. +type RepositoryActiveCommitters struct { + Name string `json:"name"` + AdvancedSecurityCommitters int `json:"advanced_security_committers"` + AdvancedSecurityCommittersBreakdown []*AdvancedSecurityCommittersBreakdown `json:"advanced_security_committers_breakdown"` +} + +// AdvancedSecurityCommittersBreakdown represents the user activity breakdown for ActiveCommitters. +type AdvancedSecurityCommittersBreakdown struct { + UserLogin string `json:"user_login"` + LastPushedDate string `json:"last_pushed_date"` + LastPushedEmail string `json:"last_pushed_email"` +} + +// UsageReportOptions specifies optional parameters for the enhanced billing platform usage report. +type UsageReportOptions struct { + // If specified, only return results for a single year. The value of year is an integer with four digits representing a year. For example, 2025. + // Default value is the current year. + Year *int `url:"year,omitempty"` + + // If specified, only return results for a single month. The value of month is an integer between 1 and 12. + // If no year is specified the default year is used. + Month *int `url:"month,omitempty"` + + // If specified, only return results for a single day. The value of day is an integer between 1 and 31. + // If no year or month is specified, the default year and month are used. + Day *int `url:"day,omitempty"` + + // If specified, only return results for a single hour. The value of hour is an integer between 0 and 23. + // If no year, month, or day is specified, the default year, month, and day are used. + Hour *int `url:"hour,omitempty"` +} + +// PremiumRequestUsageReportOptions specifies optional parameters +// for the enhanced billing platform premium request usage report. +type PremiumRequestUsageReportOptions struct { + // If specified, only return results for a single year. + // The value of year is an integer with four digits representing a year. For example, 2025. + // Default value is the current year. + Year *int `url:"year,omitempty"` + + // If specified, only return results for a single month. + // The value of month is an integer between 1 and 12. Default value is the current month. + // If no year is specified the default year is used. + Month *int `url:"month,omitempty"` + + // If specified, only return results for a single day. + // The value of day is an integer between 1 and 31. + // If no year or month is specified, the default year and month are used. + Day *int `url:"day,omitempty"` + + // The user name to query usage for. The name is not case-sensitive. + User *string `url:"user,omitempty"` + + // The model name to query usage for. The name is not case-sensitive. + Model *string `url:"model,omitempty"` + + // The product name to query usage for. The name is not case-sensitive. + Product *string `url:"product,omitempty"` +} + +// UsageItem represents a single usage item in the enhanced billing platform report. +type UsageItem struct { + Date string `json:"date"` + Product string `json:"product"` + SKU string `json:"sku"` + Quantity float64 `json:"quantity"` + UnitType string `json:"unitType"` + PricePerUnit float64 `json:"pricePerUnit"` + GrossAmount float64 `json:"grossAmount"` + DiscountAmount float64 `json:"discountAmount"` + NetAmount float64 `json:"netAmount"` + RepositoryName *string `json:"repositoryName,omitempty"` + // Organization name is only used for organization-level reports. + OrganizationName *string `json:"organizationName,omitempty"` +} + +// UsageReport represents the enhanced billing platform usage report response. +type UsageReport struct { + UsageItems []*UsageItem `json:"usageItems,omitempty"` +} + +// PremiumRequestUsageItem represents a single usage line item in premium request usage reports. +type PremiumRequestUsageItem struct { + Product string `json:"product"` + SKU string `json:"sku"` + Model string `json:"model"` + UnitType string `json:"unitType"` + PricePerUnit float64 `json:"pricePerUnit"` + GrossQuantity float64 `json:"grossQuantity"` + GrossAmount float64 `json:"grossAmount"` + DiscountQuantity float64 `json:"discountQuantity"` + DiscountAmount float64 `json:"discountAmount"` + NetQuantity float64 `json:"netQuantity"` + NetAmount float64 `json:"netAmount"` +} + +// PremiumRequestUsageTimePeriod represents a time period for premium request usage reports. +type PremiumRequestUsageTimePeriod struct { + Year int `json:"year"` + Month *int `json:"month,omitempty"` + Day *int `json:"day,omitempty"` +} + +// PremiumRequestUsageReport represents the premium request usage report response. +type PremiumRequestUsageReport struct { + TimePeriod PremiumRequestUsageTimePeriod `json:"timePeriod"` + // Organization is only set for organization-level reports. + Organization *string `json:"organization,omitempty"` + // User is only set for user-level reports. + User *string `json:"user,omitempty"` + Product *string `json:"product,omitempty"` + Model *string `json:"model,omitempty"` + UsageItems []*PremiumRequestUsageItem `json:"usageItems"` +} + +// GetOrganizationPackagesBilling returns the free and paid storage used for GitHub Packages in gigabytes for an Org. +// +// This endpoint appears to have disappeared from the official GitHub v3 API documentation website. +// See https://github.com/google/go-github/issues/3894 for details. +func (s *BillingService) GetOrganizationPackagesBilling(ctx context.Context, org string) (*PackagesBilling, *Response, error) { + u := fmt.Sprintf("orgs/%v/settings/billing/packages", org) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + result := new(PackagesBilling) + resp, err := s.client.Do(ctx, req, result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// GetOrganizationStorageBilling returns the estimated paid and estimated total storage used for GitHub Actions +// and GitHub Packages in gigabytes for an Org. +// +// This endpoint appears to have disappeared from the official GitHub v3 API documentation website. +// See https://github.com/google/go-github/issues/3894 for details. +func (s *BillingService) GetOrganizationStorageBilling(ctx context.Context, org string) (*StorageBilling, *Response, error) { + u := fmt.Sprintf("orgs/%v/settings/billing/shared-storage", org) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + result := new(StorageBilling) + resp, err := s.client.Do(ctx, req, result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// GetOrganizationAdvancedSecurityActiveCommitters returns the GitHub Advanced Security active committers for an organization per repository. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/billing#get-github-advanced-security-active-committers-for-an-organization +// +//meta:operation GET /orgs/{org}/settings/billing/advanced-security +func (s *BillingService) GetOrganizationAdvancedSecurityActiveCommitters(ctx context.Context, org string, opts *ActiveCommittersListOptions) (*ActiveCommitters, *Response, error) { + u := fmt.Sprintf("orgs/%v/settings/billing/advanced-security", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + result := new(ActiveCommitters) + resp, err := s.client.Do(ctx, req, result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// GetPackagesBilling returns the free and paid storage used for GitHub Packages in gigabytes for a user. +// +// This endpoint appears to have disappeared from the official GitHub v3 API documentation website. +// See https://github.com/google/go-github/issues/3894 for details. +func (s *BillingService) GetPackagesBilling(ctx context.Context, user string) (*PackagesBilling, *Response, error) { + u := fmt.Sprintf("users/%v/settings/billing/packages", user) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + packagesUserBilling := new(PackagesBilling) + resp, err := s.client.Do(ctx, req, packagesUserBilling) + if err != nil { + return nil, resp, err + } + + return packagesUserBilling, resp, nil +} + +// GetStorageBilling returns the estimated paid and estimated total storage used for GitHub Actions +// and GitHub Packages in gigabytes for a user. +// +// This endpoint appears to have disappeared from the official GitHub v3 API documentation website. +// See https://github.com/google/go-github/issues/3894 for details. +func (s *BillingService) GetStorageBilling(ctx context.Context, user string) (*StorageBilling, *Response, error) { + u := fmt.Sprintf("users/%v/settings/billing/shared-storage", user) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + storageUserBilling := new(StorageBilling) + resp, err := s.client.Do(ctx, req, storageUserBilling) + if err != nil { + return nil, resp, err + } + + return storageUserBilling, resp, nil +} + +// GetOrganizationUsageReport returns a report of the total usage for an organization using the enhanced billing platform. +// +// Note: This endpoint is only available to organizations with access to the enhanced billing platform. +// +// GitHub API docs: https://docs.github.com/rest/billing/usage#get-billing-usage-report-for-an-organization +// +//meta:operation GET /organizations/{org}/settings/billing/usage +func (s *BillingService) GetOrganizationUsageReport(ctx context.Context, org string, opts *UsageReportOptions) (*UsageReport, *Response, error) { + u := fmt.Sprintf("organizations/%v/settings/billing/usage", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + usageReport := new(UsageReport) + resp, err := s.client.Do(ctx, req, usageReport) + if err != nil { + return nil, resp, err + } + + return usageReport, resp, nil +} + +// GetUsageReport returns a report of the total usage for a user using the enhanced billing platform. +// +// Note: This endpoint is only available to users with access to the enhanced billing platform. +// +// GitHub API docs: https://docs.github.com/rest/billing/usage#get-billing-usage-report-for-a-user +// +//meta:operation GET /users/{username}/settings/billing/usage +func (s *BillingService) GetUsageReport(ctx context.Context, user string, opts *UsageReportOptions) (*UsageReport, *Response, error) { + u := fmt.Sprintf("users/%v/settings/billing/usage", user) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + usageReport := new(UsageReport) + resp, err := s.client.Do(ctx, req, usageReport) + if err != nil { + return nil, resp, err + } + + return usageReport, resp, nil +} + +// GetOrganizationPremiumRequestUsageReport returns a report of the premium request +// usage for an organization using the enhanced billing platform. +// +// Note: This endpoint is only available to organizations with access to the enhanced billing platform. +// +// GitHub API docs: https://docs.github.com/rest/billing/usage#get-billing-premium-request-usage-report-for-an-organization +// +//meta:operation GET /organizations/{org}/settings/billing/premium_request/usage +func (s *BillingService) GetOrganizationPremiumRequestUsageReport(ctx context.Context, org string, opts *PremiumRequestUsageReportOptions) (*PremiumRequestUsageReport, *Response, error) { + u := fmt.Sprintf("organizations/%v/settings/billing/premium_request/usage", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + premiumRequestUsageReport := new(PremiumRequestUsageReport) + resp, err := s.client.Do(ctx, req, premiumRequestUsageReport) + if err != nil { + return nil, resp, err + } + + return premiumRequestUsageReport, resp, nil +} + +// GetPremiumRequestUsageReport returns a report of the premium request +// usage for a user using the enhanced billing platform. +// +// Note: This endpoint is only available to users with access to the enhanced billing platform. +// +// GitHub API docs: https://docs.github.com/rest/billing/usage#get-billing-premium-request-usage-report-for-a-user +// +//meta:operation GET /users/{username}/settings/billing/premium_request/usage +func (s *BillingService) GetPremiumRequestUsageReport(ctx context.Context, user string, opts *PremiumRequestUsageReportOptions) (*PremiumRequestUsageReport, *Response, error) { + u := fmt.Sprintf("users/%v/settings/billing/premium_request/usage", user) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + premiumRequestUsageReport := new(PremiumRequestUsageReport) + resp, err := s.client.Do(ctx, req, premiumRequestUsageReport) + if err != nil { + return nil, resp, err + } + + return premiumRequestUsageReport, resp, nil +} diff --git a/vendor/github.com/google/go-github/v75/github/checks.go b/vendor/github.com/google/go-github/v84/github/checks.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/checks.go rename to vendor/github.com/google/go-github/v84/github/checks.go diff --git a/vendor/github.com/google/go-github/v84/github/classroom.go b/vendor/github.com/google/go-github/v84/github/classroom.go new file mode 100644 index 000000000..47124dd4a --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/classroom.go @@ -0,0 +1,256 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// ClassroomService handles communication with the GitHub Classroom related +// methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom +type ClassroomService service + +// ClassroomUser represents a GitHub user simplified for Classroom. +type ClassroomUser struct { + ID *int64 `json:"id,omitempty"` + Login *string `json:"login,omitempty"` + AvatarURL *string `json:"avatar_url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` +} + +func (u ClassroomUser) String() string { + return Stringify(u) +} + +// Classroom represents a GitHub Classroom. +type Classroom struct { + ID *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Archived *bool `json:"archived,omitempty"` + Organization *Organization `json:"organization,omitempty"` + URL *string `json:"url,omitempty"` +} + +func (c Classroom) String() string { + return Stringify(c) +} + +// ClassroomAssignment represents a GitHub Classroom assignment. +type ClassroomAssignment struct { + ID *int64 `json:"id,omitempty"` + PublicRepo *bool `json:"public_repo,omitempty"` + Title *string `json:"title,omitempty"` + Type *string `json:"type,omitempty"` + InviteLink *string `json:"invite_link,omitempty"` + InvitationsEnabled *bool `json:"invitations_enabled,omitempty"` + Slug *string `json:"slug,omitempty"` + StudentsAreRepoAdmins *bool `json:"students_are_repo_admins,omitempty"` + FeedbackPullRequestsEnabled *bool `json:"feedback_pull_requests_enabled,omitempty"` + MaxTeams *int `json:"max_teams,omitempty"` + MaxMembers *int `json:"max_members,omitempty"` + Editor *string `json:"editor,omitempty"` + Accepted *int `json:"accepted,omitempty"` + Submitted *int `json:"submitted,omitempty"` + Passing *int `json:"passing,omitempty"` + Language *string `json:"language,omitempty"` + Deadline *Timestamp `json:"deadline,omitempty"` + StarterCodeRepository *Repository `json:"starter_code_repository,omitempty"` + Classroom *Classroom `json:"classroom,omitempty"` +} + +func (a ClassroomAssignment) String() string { + return Stringify(a) +} + +// AcceptedAssignment represents a GitHub Classroom accepted assignment. +type AcceptedAssignment struct { + ID *int64 `json:"id,omitempty"` + Submitted *bool `json:"submitted,omitempty"` + Passing *bool `json:"passing,omitempty"` + CommitCount *int `json:"commit_count,omitempty"` + Grade *string `json:"grade,omitempty"` + Students []*ClassroomUser `json:"students,omitempty"` + Repository *Repository `json:"repository,omitempty"` + Assignment *ClassroomAssignment `json:"assignment,omitempty"` +} + +func (a AcceptedAssignment) String() string { + return Stringify(a) +} + +// AssignmentGrade represents a GitHub Classroom assignment grade. +type AssignmentGrade struct { + AssignmentName *string `json:"assignment_name,omitempty"` + AssignmentURL *string `json:"assignment_url,omitempty"` + StarterCodeURL *string `json:"starter_code_url,omitempty"` + GithubUsername *string `json:"github_username,omitempty"` + RosterIdentifier *string `json:"roster_identifier,omitempty"` + StudentRepositoryName *string `json:"student_repository_name,omitempty"` + StudentRepositoryURL *string `json:"student_repository_url,omitempty"` + SubmissionTimestamp *Timestamp `json:"submission_timestamp,omitempty"` + PointsAwarded *int `json:"points_awarded,omitempty"` + PointsAvailable *int `json:"points_available,omitempty"` + GroupName *string `json:"group_name,omitempty"` +} + +func (g AssignmentGrade) String() string { + return Stringify(g) +} + +// GetAssignment gets a GitHub Classroom assignment. Assignment will only be +// returned if the current user is an administrator of the GitHub Classroom +// for the assignment. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom#get-an-assignment +// +//meta:operation GET /assignments/{assignment_id} +func (s *ClassroomService) GetAssignment(ctx context.Context, assignmentID int64) (*ClassroomAssignment, *Response, error) { + u := fmt.Sprintf("assignments/%v", assignmentID) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + assignment := new(ClassroomAssignment) + resp, err := s.client.Do(ctx, req, assignment) + if err != nil { + return nil, resp, err + } + + return assignment, resp, nil +} + +// GetClassroom gets a GitHub Classroom for the current user. Classroom will only be +// returned if the current user is an administrator of the GitHub Classroom. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom#get-a-classroom +// +//meta:operation GET /classrooms/{classroom_id} +func (s *ClassroomService) GetClassroom(ctx context.Context, classroomID int64) (*Classroom, *Response, error) { + u := fmt.Sprintf("classrooms/%v", classroomID) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + classroom := new(Classroom) + resp, err := s.client.Do(ctx, req, classroom) + if err != nil { + return nil, resp, err + } + + return classroom, resp, nil +} + +// ListClassrooms lists GitHub Classrooms for the current user. Classrooms will only be +// returned if the current user is an administrator of one or more GitHub Classrooms. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom#list-classrooms +// +//meta:operation GET /classrooms +func (s *ClassroomService) ListClassrooms(ctx context.Context, opts *ListOptions) ([]*Classroom, *Response, error) { + u, err := addOptions("classrooms", opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var classrooms []*Classroom + resp, err := s.client.Do(ctx, req, &classrooms) + if err != nil { + return nil, resp, err + } + + return classrooms, resp, nil +} + +// ListClassroomAssignments lists GitHub Classroom assignments for a classroom. Assignments will only be +// returned if the current user is an administrator of the GitHub Classroom. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom#list-assignments-for-a-classroom +// +//meta:operation GET /classrooms/{classroom_id}/assignments +func (s *ClassroomService) ListClassroomAssignments(ctx context.Context, classroomID int64, opts *ListOptions) ([]*ClassroomAssignment, *Response, error) { + u := fmt.Sprintf("classrooms/%v/assignments", classroomID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var assignments []*ClassroomAssignment + resp, err := s.client.Do(ctx, req, &assignments) + if err != nil { + return nil, resp, err + } + + return assignments, resp, nil +} + +// ListAcceptedAssignments lists accepted assignments for a GitHub Classroom assignment. +// Accepted assignments will only be returned if the current user is an administrator +// of the GitHub Classroom for the assignment. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom#list-accepted-assignments-for-an-assignment +// +//meta:operation GET /assignments/{assignment_id}/accepted_assignments +func (s *ClassroomService) ListAcceptedAssignments(ctx context.Context, assignmentID int64, opts *ListOptions) ([]*AcceptedAssignment, *Response, error) { + u := fmt.Sprintf("assignments/%v/accepted_assignments", assignmentID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var acceptedAssignments []*AcceptedAssignment + resp, err := s.client.Do(ctx, req, &acceptedAssignments) + if err != nil { + return nil, resp, err + } + + return acceptedAssignments, resp, nil +} + +// GetAssignmentGrades gets assignment grades for a GitHub Classroom assignment. +// Grades will only be returned if the current user is an administrator +// of the GitHub Classroom for the assignment. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom#get-assignment-grades +// +//meta:operation GET /assignments/{assignment_id}/grades +func (s *ClassroomService) GetAssignmentGrades(ctx context.Context, assignmentID int64) ([]*AssignmentGrade, *Response, error) { + u := fmt.Sprintf("assignments/%v/grades", assignmentID) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var grades []*AssignmentGrade + resp, err := s.client.Do(ctx, req, &grades) + if err != nil { + return nil, resp, err + } + + return grades, resp, nil +} diff --git a/vendor/github.com/google/go-github/v75/github/code_scanning.go b/vendor/github.com/google/go-github/v84/github/code_scanning.go similarity index 99% rename from vendor/github.com/google/go-github/v75/github/code_scanning.go rename to vendor/github.com/google/go-github/v84/github/code_scanning.go index 19a88241d..982efc459 100644 --- a/vendor/github.com/google/go-github/v75/github/code_scanning.go +++ b/vendor/github.com/google/go-github/v84/github/code_scanning.go @@ -613,7 +613,7 @@ type DefaultSetupConfiguration struct { // //meta:operation GET /repos/{owner}/{repo}/code-scanning/default-setup func (s *CodeScanningService) GetDefaultSetupConfiguration(ctx context.Context, owner, repo string) (*DefaultSetupConfiguration, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/code-scanning/default-setup", owner, repo) + u := fmt.Sprintf("repos/%v/%v/code-scanning/default-setup", owner, repo) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -656,7 +656,7 @@ type UpdateDefaultSetupConfigurationResponse struct { // //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) { - u := fmt.Sprintf("repos/%s/%s/code-scanning/default-setup", owner, repo) + u := fmt.Sprintf("repos/%v/%v/code-scanning/default-setup", owner, repo) req, err := s.client.NewRequest("PATCH", u, options) if err != nil { diff --git a/vendor/github.com/google/go-github/v75/github/codesofconduct.go b/vendor/github.com/google/go-github/v84/github/codesofconduct.go similarity index 92% rename from vendor/github.com/google/go-github/v75/github/codesofconduct.go rename to vendor/github.com/google/go-github/v84/github/codesofconduct.go index aba057417..a514aac6b 100644 --- a/vendor/github.com/google/go-github/v75/github/codesofconduct.go +++ b/vendor/github.com/google/go-github/v84/github/codesofconduct.go @@ -36,7 +36,6 @@ func (s *CodesOfConductService) List(ctx context.Context) ([]*CodeOfConduct, *Re return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeCodesOfConductPreview) var cs []*CodeOfConduct @@ -61,13 +60,12 @@ func (c *Client) ListCodesOfConduct(ctx context.Context) ([]*CodeOfConduct, *Res // //meta:operation GET /codes_of_conduct/{key} func (s *CodesOfConductService) Get(ctx context.Context, key string) (*CodeOfConduct, *Response, error) { - u := fmt.Sprintf("codes_of_conduct/%s", key) + u := fmt.Sprintf("codes_of_conduct/%v", key) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeCodesOfConductPreview) coc := new(CodeOfConduct) diff --git a/vendor/github.com/google/go-github/v84/github/codespaces.go b/vendor/github.com/google/go-github/v84/github/codespaces.go new file mode 100644 index 000000000..bc8d617f3 --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/codespaces.go @@ -0,0 +1,591 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// CodespacesService handles communication with the Codespaces related +// methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/ +type CodespacesService service + +// Codespace represents a codespace. +// +// GitHub API docs: https://docs.github.com/rest/codespaces +type Codespace struct { + ID *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + DisplayName *string `json:"display_name,omitempty"` + EnvironmentID *string `json:"environment_id,omitempty"` + Owner *User `json:"owner,omitempty"` + BillableOwner *User `json:"billable_owner,omitempty"` + Repository *Repository `json:"repository,omitempty"` + Machine *CodespacesMachine `json:"machine,omitempty"` + DevcontainerPath *string `json:"devcontainer_path,omitempty"` + Prebuild *bool `json:"prebuild,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + LastUsedAt *Timestamp `json:"last_used_at,omitempty"` + State *string `json:"state,omitempty"` + URL *string `json:"url,omitempty"` + GitStatus *CodespacesGitStatus `json:"git_status,omitempty"` + Location *string `json:"location,omitempty"` + IdleTimeoutMinutes *int `json:"idle_timeout_minutes,omitempty"` + WebURL *string `json:"web_url,omitempty"` + MachinesURL *string `json:"machines_url,omitempty"` + StartURL *string `json:"start_url,omitempty"` + StopURL *string `json:"stop_url,omitempty"` + PullsURL *string `json:"pulls_url,omitempty"` + RecentFolders []string `json:"recent_folders,omitempty"` + RuntimeConstraints *CodespacesRuntimeConstraints `json:"runtime_constraints,omitempty"` + PendingOperation *bool `json:"pending_operation,omitempty"` + PendingOperationDisabledReason *string `json:"pending_operation_disabled_reason,omitempty"` + IdleTimeoutNotice *string `json:"idle_timeout_notice,omitempty"` + RetentionPeriodMinutes *int `json:"retention_period_minutes,omitempty"` + RetentionExpiresAt *Timestamp `json:"retention_expires_at,omitempty"` + LastKnownStopNotice *string `json:"last_known_stop_notice,omitempty"` +} + +// CodespacesGitStatus represents the git status of a codespace. +type CodespacesGitStatus struct { + Ahead *int `json:"ahead,omitempty"` + Behind *int `json:"behind,omitempty"` + HasUnpushedChanges *bool `json:"has_unpushed_changes,omitempty"` + HasUncommittedChanges *bool `json:"has_uncommitted_changes,omitempty"` + Ref *string `json:"ref,omitempty"` +} + +// CodespacesMachine represents the machine type of a codespace. +type CodespacesMachine struct { + Name *string `json:"name,omitempty"` + DisplayName *string `json:"display_name,omitempty"` + OperatingSystem *string `json:"operating_system,omitempty"` + StorageInBytes *int64 `json:"storage_in_bytes,omitempty"` + MemoryInBytes *int64 `json:"memory_in_bytes,omitempty"` + CPUs *int `json:"cpus,omitempty"` + PrebuildAvailability *string `json:"prebuild_availability,omitempty"` +} + +// CodespacesRuntimeConstraints represents the runtime constraints of a codespace. +type CodespacesRuntimeConstraints struct { + AllowedPortPrivacySettings []string `json:"allowed_port_privacy_settings,omitempty"` +} + +// ListCodespaces represents the response from the list codespaces endpoints. +type ListCodespaces struct { + TotalCount *int `json:"total_count,omitempty"` + Codespaces []*Codespace `json:"codespaces"` +} + +// ListInRepo lists codespaces for a user in a repository. +// +// Lists the codespaces associated with a specified repository and the authenticated user. +// You must authenticate using an access token with the codespace scope to use this endpoint. +// GitHub Apps must have read access to the codespaces repository permission to use this endpoint. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#list-codespaces-in-a-repository-for-the-authenticated-user +// +//meta:operation GET /repos/{owner}/{repo}/codespaces +func (s *CodespacesService) ListInRepo(ctx context.Context, owner, repo string, opts *ListOptions) (*ListCodespaces, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/codespaces", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var codespaces *ListCodespaces + resp, err := s.client.Do(ctx, req, &codespaces) + if err != nil { + return nil, resp, err + } + + return codespaces, resp, nil +} + +// ListCodespacesOptions represents the options for listing codespaces for a user. +type ListCodespacesOptions struct { + ListOptions + RepositoryID int64 `url:"repository_id,omitempty"` +} + +// List lists codespaces for an authenticated user. +// +// Lists the authenticated user's codespaces. +// You must authenticate using an access token with the codespace scope to use this endpoint. +// GitHub Apps must have read access to the codespaces repository permission to use this endpoint. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#list-codespaces-for-the-authenticated-user +// +//meta:operation GET /user/codespaces +func (s *CodespacesService) List(ctx context.Context, opts *ListCodespacesOptions) (*ListCodespaces, *Response, error) { + u := "user/codespaces" + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var codespaces *ListCodespaces + resp, err := s.client.Do(ctx, req, &codespaces) + if err != nil { + return nil, resp, err + } + + return codespaces, resp, nil +} + +// CreateCodespaceOptions represents options for the creation of a codespace in a repository. +type CreateCodespaceOptions struct { + Ref *string `json:"ref,omitempty"` + // Geo represents the geographic area for this codespace. + // If not specified, the value is assigned by IP. + // This property replaces location, which is being deprecated. + // Geo can be one of: `EuropeWest`, `SoutheastAsia`, `UsEast`, `UsWest`. + Geo *string `json:"geo,omitempty"` + ClientIP *string `json:"client_ip,omitempty"` + Machine *string `json:"machine,omitempty"` + DevcontainerPath *string `json:"devcontainer_path,omitempty"` + MultiRepoPermissionsOptOut *bool `json:"multi_repo_permissions_opt_out,omitempty"` + WorkingDirectory *string `json:"working_directory,omitempty"` + IdleTimeoutMinutes *int `json:"idle_timeout_minutes,omitempty"` + DisplayName *string `json:"display_name,omitempty"` + // RetentionPeriodMinutes represents the duration in minutes after codespace has gone idle in which it will be deleted. + // Must be integer minutes between 0 and 43200 (30 days). + RetentionPeriodMinutes *int `json:"retention_period_minutes,omitempty"` + Location *string `json:"location,omitempty"` +} + +// DevContainer represents a devcontainer configuration in a repository. +type DevContainer struct { + Path string `json:"path"` + Name *string `json:"name,omitempty"` + DisplayName *string `json:"display_name,omitempty"` +} + +// DevContainerConfigurations represents a list of devcontainer configurations in a repository. +type DevContainerConfigurations struct { + Devcontainers []*DevContainer `json:"devcontainers"` + TotalCount int64 `json:"total_count"` +} + +// CodespaceDefaults represents default settings for a Codespace. +type CodespaceDefaults struct { + Location string `json:"location"` + DevcontainerPath *string `json:"devcontainer_path,omitempty"` +} + +// CodespaceDefaultAttributes represents the default attributes for codespaces created by the user with the repository. +type CodespaceDefaultAttributes struct { + BillableOwner *User `json:"billable_owner"` + Defaults *CodespaceDefaults `json:"defaults"` +} + +// CodespaceGetDefaultAttributesOptions represents options for getting default attributes for a codespace. +type CodespaceGetDefaultAttributesOptions struct { + // Ref represents the branch or commit to check for a default devcontainer path. If not specified, the default branch will be checked. + Ref *string `url:"ref,omitempty"` + // ClientIP represents an alternative IP for default location auto-detection, such as when proxying a request. + ClientIP *string `url:"client_ip,omitempty"` +} + +// CodespacePullRequestOptions represents options for a CodespacePullRequest. +type CodespacePullRequestOptions struct { + // PullRequestNumber represents the pull request number. + PullRequestNumber int64 `json:"pull_request_number"` + // RepositoryID represents the repository ID for this codespace. + RepositoryID int64 `json:"repository_id"` +} + +// CodespaceCreateForUserOptions represents options for creating a codespace for the authenticated user. +type CodespaceCreateForUserOptions struct { + PullRequest *CodespacePullRequestOptions `json:"pull_request"` + // RepositoryID represents the repository ID for this codespace. + RepositoryID int64 `json:"repository_id"` + Ref *string `json:"ref,omitempty"` + Geo *string `json:"geo,omitempty"` + ClientIP *string `json:"client_ip,omitempty"` + RetentionPeriodMinutes *int `json:"retention_period_minutes,omitempty"` + Location *string `json:"location,omitempty"` + Machine *string `json:"machine,omitempty"` + DevcontainerPath *string `json:"devcontainer_path,omitempty"` + MultiRepoPermissionsOptOut *bool `json:"multi_repo_permissions_opt_out,omitempty"` + WorkingDirectory *string `json:"working_directory,omitempty"` + IdleTimeoutMinutes *int `json:"idle_timeout_minutes,omitempty"` + DisplayName *string `json:"display_name,omitempty"` +} + +// UpdateCodespaceOptions represents options for updating a codespace. +type UpdateCodespaceOptions struct { + // Machine represents a valid machine to transition this codespace to. + Machine *string `json:"machine,omitempty"` + // RecentFolders represents the recently opened folders inside the codespace. + // It is currently used by the clients to determine the folder path to load the codespace in. + RecentFolders []string `json:"recent_folders,omitempty"` +} + +// CodespaceExport represents an export of a codespace. +type CodespaceExport struct { + // Can be one of: `succeeded`, `failed`, `in_progress`. + State *string `json:"state,omitempty"` + CompletedAt *Timestamp `json:"completed_at,omitempty"` + Branch *string `json:"branch,omitempty"` + SHA *string `json:"sha,omitempty"` + ID *string `json:"id,omitempty"` + ExportURL *string `json:"export_url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` +} + +// PublishCodespaceOptions represents options for creating a repository from an unpublished codespace. +type PublishCodespaceOptions struct { + // Name represents the name of the new repository. + Name *string `json:"name,omitempty"` + // Private represents whether the new repository is private. Defaults to false. + Private *bool `json:"private,omitempty"` +} + +// CodespacePermissions represents a response indicating whether the permissions defined by a devcontainer have been accepted. +type CodespacePermissions struct { + Accepted bool `json:"accepted"` +} + +// CreateInRepo creates a codespace in a repository. +// +// Creates a codespace owned by the authenticated user in the specified repository. +// You must authenticate using an access token with the codespace scope to use this endpoint. +// GitHub Apps must have write access to the codespaces repository permission to use this endpoint. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#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) { + u := fmt.Sprintf("repos/%v/%v/codespaces", owner, repo) + req, err := s.client.NewRequest("POST", u, request) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(ctx, req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} + +// Start starts a codespace. +// +// You must authenticate using an access token with the codespace scope to use this endpoint. +// GitHub Apps must have write access to the codespaces_lifecycle_admin repository permission to use this endpoint. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#start-a-codespace-for-the-authenticated-user +// +//meta:operation POST /user/codespaces/{codespace_name}/start +func (s *CodespacesService) Start(ctx context.Context, codespaceName string) (*Codespace, *Response, error) { + u := fmt.Sprintf("user/codespaces/%v/start", codespaceName) + req, err := s.client.NewRequest("POST", u, nil) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(ctx, req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} + +// Stop stops a codespace. +// +// You must authenticate using an access token with the codespace scope to use this endpoint. +// GitHub Apps must have write access to the codespaces_lifecycle_admin repository permission to use this endpoint. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#stop-a-codespace-for-the-authenticated-user +// +//meta:operation POST /user/codespaces/{codespace_name}/stop +func (s *CodespacesService) Stop(ctx context.Context, codespaceName string) (*Codespace, *Response, error) { + u := fmt.Sprintf("user/codespaces/%v/stop", codespaceName) + req, err := s.client.NewRequest("POST", u, nil) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(ctx, req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} + +// Delete deletes a codespace. +// +// You must authenticate using an access token with the codespace scope to use this endpoint. +// GitHub Apps must have write access to the codespaces repository permission to use this endpoint. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#delete-a-codespace-for-the-authenticated-user +// +//meta:operation DELETE /user/codespaces/{codespace_name} +func (s *CodespacesService) Delete(ctx context.Context, codespaceName string) (*Response, error) { + u := fmt.Sprintf("user/codespaces/%v", codespaceName) + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// ListDevContainerConfigurations lists devcontainer configurations in a repository for the authenticated user. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#list-devcontainer-configurations-in-a-repository-for-the-authenticated-user +// +//meta:operation GET /repos/{owner}/{repo}/codespaces/devcontainers +func (s *CodespacesService) ListDevContainerConfigurations(ctx context.Context, owner, repo string, opts *ListOptions) (*DevContainerConfigurations, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/codespaces/devcontainers", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var devcontainers *DevContainerConfigurations + resp, err := s.client.Do(ctx, req, &devcontainers) + if err != nil { + return nil, resp, err + } + + return devcontainers, resp, nil +} + +// GetDefaultAttributes gets the default attributes for codespaces created by the user with the repository. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#get-default-attributes-for-a-codespace +// +//meta:operation GET /repos/{owner}/{repo}/codespaces/new +func (s *CodespacesService) GetDefaultAttributes(ctx context.Context, owner, repo string, opts *CodespaceGetDefaultAttributesOptions) (*CodespaceDefaultAttributes, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/codespaces/new", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var attributes *CodespaceDefaultAttributes + resp, err := s.client.Do(ctx, req, &attributes) + if err != nil { + return nil, resp, err + } + + return attributes, resp, nil +} + +// CheckPermissions checks whether the permissions defined by a given devcontainer configuration have been accepted by the authenticated user. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#check-if-permissions-defined-by-a-devcontainer-have-been-accepted-by-the-authenticated-user +// +//meta:operation GET /repos/{owner}/{repo}/codespaces/permissions_check +func (s *CodespacesService) CheckPermissions(ctx context.Context, owner, repo, ref, devcontainerPath string) (*CodespacePermissions, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/codespaces/permissions_check", owner, repo) + u, err := addOptions(u, &struct { + Ref string `url:"ref"` + DevcontainerPath string `url:"devcontainer_path"` + }{ + Ref: ref, + DevcontainerPath: devcontainerPath, + }) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *CodespacePermissions + resp, err := s.client.Do(ctx, req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// CreateFromPullRequest creates a codespace owned by the authenticated user for the specified pull request. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#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) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v/codespaces", owner, repo, pullNumber) + req, err := s.client.NewRequest("POST", u, request) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(ctx, req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} + +// Create creates a new codespace, owned by the authenticated user. +// +// This method requires either RepositoryId OR a PullRequest but not both. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#create-a-codespace-for-the-authenticated-user +// +//meta:operation POST /user/codespaces +func (s *CodespacesService) Create(ctx context.Context, opts *CodespaceCreateForUserOptions) (*Codespace, *Response, error) { + u := "user/codespaces" + req, err := s.client.NewRequest("POST", u, opts) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(ctx, req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} + +// Get gets information about a user's codespace. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#get-a-codespace-for-the-authenticated-user +// +//meta:operation GET /user/codespaces/{codespace_name} +func (s *CodespacesService) Get(ctx context.Context, codespaceName string) (*Codespace, *Response, error) { + u := fmt.Sprintf("user/codespaces/%v", codespaceName) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(ctx, req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} + +// Update updates a codespace owned by the authenticated user. +// +// Only the codespace's machine type and recent folders can be modified using this endpoint. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#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) { + u := fmt.Sprintf("user/codespaces/%v", codespaceName) + req, err := s.client.NewRequest("PATCH", u, opts) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(ctx, req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} + +// ExportCodespace triggers an export of the specified codespace and returns a URL and ID where the status of the export can be monitored. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#export-a-codespace-for-the-authenticated-user +// +//meta:operation POST /user/codespaces/{codespace_name}/exports +func (s *CodespacesService) ExportCodespace(ctx context.Context, codespaceName string) (*CodespaceExport, *Response, error) { + u := fmt.Sprintf("user/codespaces/%v/exports", codespaceName) + req, err := s.client.NewRequest("POST", u, nil) + if err != nil { + return nil, nil, err + } + + var codespace *CodespaceExport + resp, err := s.client.Do(ctx, req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} + +// GetLatestCodespaceExport gets information about an export of a codespace. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#get-details-about-a-codespace-export +// +//meta:operation GET /user/codespaces/{codespace_name}/exports/{export_id} +func (s *CodespacesService) GetLatestCodespaceExport(ctx context.Context, codespaceName string) (*CodespaceExport, *Response, error) { + u := fmt.Sprintf("user/codespaces/%v/exports/latest", codespaceName) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var codespace *CodespaceExport + resp, err := s.client.Do(ctx, req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} + +// Publish publishes an unpublished codespace, creating a new repository and assigning it to the codespace. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#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) { + u := fmt.Sprintf("user/codespaces/%v/publish", codespaceName) + req, err := s.client.NewRequest("POST", u, opts) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(ctx, req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} diff --git a/vendor/github.com/google/go-github/v84/github/codespaces_machines.go b/vendor/github.com/google/go-github/v84/github/codespaces_machines.go new file mode 100644 index 000000000..5277b1f40 --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/codespaces_machines.go @@ -0,0 +1,74 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// CodespacesMachines represent a list of machines. +type CodespacesMachines struct { + TotalCount int64 `json:"total_count"` + Machines []*CodespacesMachine `json:"machines"` +} + +// ListRepoMachineTypesOptions represent options for ListMachineTypesForRepository. +type ListRepoMachineTypesOptions struct { + // Ref represent the branch or commit to check for prebuild availability and devcontainer restrictions. + Ref *string `url:"ref,omitempty"` + // Location represent the location to check for available machines. Assigned by IP if not provided. + Location *string `url:"location,omitempty"` + // ClientIP represent the IP for location auto-detection when proxying a request + ClientIP *string `url:"client_ip,omitempty"` +} + +// ListRepositoryMachineTypes lists the machine types available for a given repository based on its configuration. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/machines#list-available-machine-types-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/codespaces/machines +func (s *CodespacesService) ListRepositoryMachineTypes(ctx context.Context, owner, repo string, opts *ListRepoMachineTypesOptions) (*CodespacesMachines, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/codespaces/machines", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var machines *CodespacesMachines + resp, err := s.client.Do(ctx, req, &machines) + if err != nil { + return nil, resp, err + } + + return machines, resp, nil +} + +// ListCodespaceMachineTypes lists the machine types a codespace can transition to use. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/machines#list-machine-types-for-a-codespace +// +//meta:operation GET /user/codespaces/{codespace_name}/machines +func (s *CodespacesService) ListCodespaceMachineTypes(ctx context.Context, codespaceName string) (*CodespacesMachines, *Response, error) { + u := fmt.Sprintf("user/codespaces/%v/machines", codespaceName) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var machines *CodespacesMachines + resp, err := s.client.Do(ctx, req, &machines) + if err != nil { + return nil, resp, err + } + + return machines, resp, nil +} diff --git a/vendor/github.com/google/go-github/v84/github/codespaces_orgs.go b/vendor/github.com/google/go-github/v84/github/codespaces_orgs.go new file mode 100644 index 000000000..3aeb05f86 --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/codespaces_orgs.go @@ -0,0 +1,173 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// CodespacesOrgAccessControlRequest represent request for SetOrgAccessControl. +type CodespacesOrgAccessControlRequest struct { + // Visibility represent which users can access codespaces in the organization. + // Can be one of: disabled, selected_members, all_members, all_members_and_outside_collaborators. + Visibility string `json:"visibility"` + // SelectedUsernames represent the usernames of the organization members who should have access to codespaces in the organization. + // Required when visibility is selected_members. + SelectedUsernames []string `json:"selected_usernames,omitzero"` +} + +// ListInOrg lists the codespaces associated to a specified organization. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/organizations#list-codespaces-for-the-organization +// +//meta:operation GET /orgs/{org}/codespaces +func (s *CodespacesService) ListInOrg(ctx context.Context, org string, opts *ListOptions) (*ListCodespaces, *Response, error) { + u := fmt.Sprintf("orgs/%v/codespaces", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var codespaces *ListCodespaces + resp, err := s.client.Do(ctx, req, &codespaces) + if err != nil { + return nil, resp, err + } + + return codespaces, resp, nil +} + +// SetOrgAccessControl sets which users can access codespaces in an organization. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/organizations#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) { + u := fmt.Sprintf("orgs/%v/codespaces/access", org) + req, err := s.client.NewRequest("PUT", u, request) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// AddUsersToOrgAccess adds users to Codespaces access for an organization. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/organizations#add-users-to-codespaces-access-for-an-organization +// +//meta:operation POST /orgs/{org}/codespaces/access/selected_users +func (s *CodespacesService) AddUsersToOrgAccess(ctx context.Context, org string, usernames []string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/codespaces/access/selected_users", org) + req, err := s.client.NewRequest("POST", u, map[string][]string{"selected_usernames": usernames}) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// RemoveUsersFromOrgAccess removes users from Codespaces access for an organization. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/organizations#remove-users-from-codespaces-access-for-an-organization +// +//meta:operation DELETE /orgs/{org}/codespaces/access/selected_users +func (s *CodespacesService) RemoveUsersFromOrgAccess(ctx context.Context, org string, usernames []string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/codespaces/access/selected_users", org) + req, err := s.client.NewRequest("DELETE", u, map[string][]string{"selected_usernames": usernames}) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// ListUserCodespacesInOrg lists the codespaces that a member of an organization has for repositories in that organization. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/organizations#list-codespaces-for-a-user-in-organization +// +//meta:operation GET /orgs/{org}/members/{username}/codespaces +func (s *CodespacesService) ListUserCodespacesInOrg(ctx context.Context, org, username string, opts *ListOptions) (*ListCodespaces, *Response, error) { + u := fmt.Sprintf("orgs/%v/members/%v/codespaces", org, username) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var codespaces *ListCodespaces + resp, err := s.client.Do(ctx, req, &codespaces) + if err != nil { + return nil, resp, err + } + + return codespaces, resp, nil +} + +// DeleteUserCodespaceInOrg deletes a user's codespace from the organization. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/organizations#delete-a-codespace-from-the-organization +// +//meta:operation DELETE /orgs/{org}/members/{username}/codespaces/{codespace_name} +func (s *CodespacesService) DeleteUserCodespaceInOrg(ctx context.Context, org, username, codespaceName string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/members/%v/codespaces/%v", org, username, codespaceName) + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// StopUserCodespaceInOrg stops a codespace for an organization user. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/organizations#stop-a-codespace-for-an-organization-user +// +//meta:operation POST /orgs/{org}/members/{username}/codespaces/{codespace_name}/stop +func (s *CodespacesService) StopUserCodespaceInOrg(ctx context.Context, org, username, codespaceName string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/members/%v/codespaces/%v/stop", org, username, codespaceName) + req, err := s.client.NewRequest("POST", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v75/github/codespaces_secrets.go b/vendor/github.com/google/go-github/v84/github/codespaces_secrets.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/codespaces_secrets.go rename to vendor/github.com/google/go-github/v84/github/codespaces_secrets.go diff --git a/vendor/github.com/google/go-github/v75/github/copilot.go b/vendor/github.com/google/go-github/v84/github/copilot.go similarity index 73% rename from vendor/github.com/google/go-github/v75/github/copilot.go rename to vendor/github.com/google/go-github/v84/github/copilot.go index 25f5969eb..445b6dda0 100644 --- a/vendor/github.com/google/go-github/v75/github/copilot.go +++ b/vendor/github.com/google/go-github/v84/github/copilot.go @@ -185,6 +185,24 @@ type CopilotMetrics struct { CopilotDotcomPullRequests *CopilotDotcomPullRequests `json:"copilot_dotcom_pull_requests,omitempty"` } +// CopilotMetricsReportOptions specifies the optional parameters for single-day metrics report endpoints. +type CopilotMetricsReportOptions struct { + Day string `url:"day"` // Required, format: YYYY-MM-DD +} + +// CopilotDailyMetricsReport represents the response from 1-day Copilot metrics report endpoints. +type CopilotDailyMetricsReport struct { + DownloadLinks []string `json:"download_links"` + ReportDay string `json:"report_day"` +} + +// CopilotMetricsReport represents the response from 28-day Copilot metrics report endpoints. +type CopilotMetricsReport struct { + DownloadLinks []string `json:"download_links"` + ReportStartDay string `json:"report_start_day"` + ReportEndDay string `json:"report_end_day"` +} + // UnmarshalJSON implements the json.Unmarshaler interface. func (cp *CopilotSeatDetails) UnmarshalJSON(data []byte) error { // Using an alias to avoid infinite recursion when calling json.Unmarshal @@ -574,3 +592,195 @@ func (s *CopilotService) GetOrganizationTeamMetrics(ctx context.Context, org, te return metrics, resp, nil } + +// GetEnterpriseDailyMetricsReport gets a report containing Copilot metrics for a single day for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-usage-metrics#get-copilot-enterprise-usage-metrics-for-a-specific-day +// +//meta:operation GET /enterprises/{enterprise}/copilot/metrics/reports/enterprise-1-day +func (s *CopilotService) GetEnterpriseDailyMetricsReport(ctx context.Context, enterprise string, opts *CopilotMetricsReportOptions) (*CopilotDailyMetricsReport, *Response, error) { + u := fmt.Sprintf("enterprises/%v/copilot/metrics/reports/enterprise-1-day", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotDailyMetricsReport + resp, err := s.client.Do(ctx, req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetEnterpriseMetricsReport gets a report containing Copilot metrics for a 28-day rolling window for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-usage-metrics#get-copilot-enterprise-usage-metrics +// +//meta:operation GET /enterprises/{enterprise}/copilot/metrics/reports/enterprise-28-day/latest +func (s *CopilotService) GetEnterpriseMetricsReport(ctx context.Context, enterprise string) (*CopilotMetricsReport, *Response, error) { + u := fmt.Sprintf("enterprises/%v/copilot/metrics/reports/enterprise-28-day/latest", enterprise) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotMetricsReport + resp, err := s.client.Do(ctx, req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetEnterpriseUsersDailyMetricsReport gets a report containing Copilot user metrics for a single day for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-usage-metrics#get-copilot-users-usage-metrics-for-a-specific-day +// +//meta:operation GET /enterprises/{enterprise}/copilot/metrics/reports/users-1-day +func (s *CopilotService) GetEnterpriseUsersDailyMetricsReport(ctx context.Context, enterprise string, opts *CopilotMetricsReportOptions) (*CopilotDailyMetricsReport, *Response, error) { + u := fmt.Sprintf("enterprises/%v/copilot/metrics/reports/users-1-day", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotDailyMetricsReport + resp, err := s.client.Do(ctx, req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetEnterpriseUsersMetricsReport gets a report containing Copilot user metrics for a 28-day rolling window for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-usage-metrics#get-copilot-users-usage-metrics +// +//meta:operation GET /enterprises/{enterprise}/copilot/metrics/reports/users-28-day/latest +func (s *CopilotService) GetEnterpriseUsersMetricsReport(ctx context.Context, enterprise string) (*CopilotMetricsReport, *Response, error) { + u := fmt.Sprintf("enterprises/%v/copilot/metrics/reports/users-28-day/latest", enterprise) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotMetricsReport + resp, err := s.client.Do(ctx, req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetOrganizationDailyMetricsReport gets a report containing Copilot metrics for a single day for an organization. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-usage-metrics#get-copilot-organization-usage-metrics-for-a-specific-day +// +//meta:operation GET /orgs/{org}/copilot/metrics/reports/organization-1-day +func (s *CopilotService) GetOrganizationDailyMetricsReport(ctx context.Context, org string, opts *CopilotMetricsReportOptions) (*CopilotDailyMetricsReport, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/metrics/reports/organization-1-day", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotDailyMetricsReport + resp, err := s.client.Do(ctx, req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetOrganizationMetricsReport gets a report containing Copilot metrics for a 28-day rolling window for an organization. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-usage-metrics#get-copilot-organization-usage-metrics +// +//meta:operation GET /orgs/{org}/copilot/metrics/reports/organization-28-day/latest +func (s *CopilotService) GetOrganizationMetricsReport(ctx context.Context, org string) (*CopilotMetricsReport, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/metrics/reports/organization-28-day/latest", org) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotMetricsReport + resp, err := s.client.Do(ctx, req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetOrganizationUsersDailyMetricsReport gets a report containing Copilot user metrics for a single day for an organization. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-usage-metrics#get-copilot-organization-users-usage-metrics-for-a-specific-day +// +//meta:operation GET /orgs/{org}/copilot/metrics/reports/users-1-day +func (s *CopilotService) GetOrganizationUsersDailyMetricsReport(ctx context.Context, org string, opts *CopilotMetricsReportOptions) (*CopilotDailyMetricsReport, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/metrics/reports/users-1-day", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotDailyMetricsReport + resp, err := s.client.Do(ctx, req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetOrganizationUsersMetricsReport gets a report containing Copilot user metrics for a 28-day rolling window for an organization. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-usage-metrics#get-copilot-organization-users-usage-metrics +// +//meta:operation GET /orgs/{org}/copilot/metrics/reports/users-28-day/latest +func (s *CopilotService) GetOrganizationUsersMetricsReport(ctx context.Context, org string) (*CopilotMetricsReport, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/metrics/reports/users-28-day/latest", org) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotMetricsReport + resp, err := s.client.Do(ctx, req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} diff --git a/vendor/github.com/google/go-github/v84/github/credentials.go b/vendor/github.com/google/go-github/v84/github/credentials.go new file mode 100644 index 000000000..ff6e6f691 --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/credentials.go @@ -0,0 +1,37 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" +) + +// CredentialsService handles credentials related methods of the GitHub API. +type CredentialsService service + +// revokeCredentialsRequest represents the request body for revoking credentials. +type revokeCredentialsRequest struct { + // The list of credential strings (tokens) to revoke. + Credentials []string `json:"credentials"` +} + +// Revoke revokes a list of credentials. +// +// GitHub API docs: https://docs.github.com/rest/credentials/revoke#revoke-a-list-of-credentials +// +//meta:operation POST /credentials/revoke +func (s *CredentialsService) Revoke(ctx context.Context, credentials []string) (*Response, error) { + u := "credentials/revoke" + + reqBody := &revokeCredentialsRequest{Credentials: credentials} + + req, err := s.client.NewRequest("POST", u, reqBody) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} diff --git a/vendor/github.com/google/go-github/v75/github/dependabot.go b/vendor/github.com/google/go-github/v84/github/dependabot.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/dependabot.go rename to vendor/github.com/google/go-github/v84/github/dependabot.go diff --git a/vendor/github.com/google/go-github/v75/github/dependabot_alerts.go b/vendor/github.com/google/go-github/v84/github/dependabot_alerts.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/dependabot_alerts.go rename to vendor/github.com/google/go-github/v84/github/dependabot_alerts.go diff --git a/vendor/github.com/google/go-github/v75/github/dependabot_secrets.go b/vendor/github.com/google/go-github/v84/github/dependabot_secrets.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/dependabot_secrets.go rename to vendor/github.com/google/go-github/v84/github/dependabot_secrets.go diff --git a/vendor/github.com/google/go-github/v75/github/dependency_graph.go b/vendor/github.com/google/go-github/v84/github/dependency_graph.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/dependency_graph.go rename to vendor/github.com/google/go-github/v84/github/dependency_graph.go diff --git a/vendor/github.com/google/go-github/v75/github/dependency_graph_snapshots.go b/vendor/github.com/google/go-github/v84/github/dependency_graph_snapshots.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/dependency_graph_snapshots.go rename to vendor/github.com/google/go-github/v84/github/dependency_graph_snapshots.go diff --git a/vendor/github.com/google/go-github/v75/github/doc.go b/vendor/github.com/google/go-github/v84/github/doc.go similarity index 93% rename from vendor/github.com/google/go-github/v75/github/doc.go rename to vendor/github.com/google/go-github/v84/github/doc.go index 7fff8857a..337c37900 100644 --- a/vendor/github.com/google/go-github/v75/github/doc.go +++ b/vendor/github.com/google/go-github/v84/github/doc.go @@ -8,8 +8,7 @@ Package github provides a client for using the GitHub API. Usage: - import "github.com/google/go-github/v75/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) - import "github.com/google/go-github/github" // with go modules disabled + import "github.com/google/go-github/v84/github" Construct a new GitHub client, then use the various services on the client to access different parts of the GitHub API. For example: @@ -40,7 +39,7 @@ For more sample code snippets, head over to the https://github.com/google/go-git # Authentication -Use [Client.WithAuthToken] to configure your client to authenticate using an Oauth token +Use [Client.WithAuthToken] to configure your client to authenticate using an OAuth token (for example, a personal access token). This is what is needed for a majority of use cases aside from GitHub Apps. @@ -111,10 +110,10 @@ To detect an API rate limit error, you can check if its type is *[RateLimitError For secondary rate limits, you can check if its type is *[AbuseRateLimitError]: repos, _, err := client.Repositories.List(ctx, "", nil) - if _, ok := err.(*github.RateLimitError); ok { + if errors.As(err, new(*github.RateLimitError)) { log.Println("hit rate limit") } - if _, ok := err.(*github.AbuseRateLimitError); ok { + if errors.As(err, new(*github.AbuseRateLimitError)) { log.Println("hit secondary rate limit") } @@ -132,7 +131,7 @@ To detect this condition of error, you can check if its type is *[AcceptedError]: stats, _, err := client.Repositories.ListContributorsStats(ctx, org, repo) - if _, ok := err.(*github.AcceptedError); ok { + if errors.As(err, new(*github.AcceptedError)) { log.Println("scheduled on GitHub side") } @@ -151,7 +150,7 @@ recommended when making requests using short-lived credentials such as a GitHub App installation token. Learn more about GitHub conditional requests at -https://docs.github.com/rest/overview/resources-in-the-rest-api#conditional-requests. +https://docs.github.com/en/rest/using-the-rest-api/best-practices-for-using-the-rest-api?apiVersion=2022-11-28#use-conditional-requests-if-appropriate. # Creating and Updating Resources diff --git a/vendor/github.com/google/go-github/v75/github/emojis.go b/vendor/github.com/google/go-github/v84/github/emojis.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/emojis.go rename to vendor/github.com/google/go-github/v84/github/emojis.go diff --git a/vendor/github.com/google/go-github/v75/github/enterprise.go b/vendor/github.com/google/go-github/v84/github/enterprise.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/enterprise.go rename to vendor/github.com/google/go-github/v84/github/enterprise.go diff --git a/vendor/github.com/google/go-github/v75/github/enterprise_actions_hosted_runners.go b/vendor/github.com/google/go-github/v84/github/enterprise_actions_hosted_runners.go similarity index 94% rename from vendor/github.com/google/go-github/v75/github/enterprise_actions_hosted_runners.go rename to vendor/github.com/google/go-github/v84/github/enterprise_actions_hosted_runners.go index e82ba9b80..746579644 100644 --- a/vendor/github.com/google/go-github/v75/github/enterprise_actions_hosted_runners.go +++ b/vendor/github.com/google/go-github/v84/github/enterprise_actions_hosted_runners.go @@ -41,8 +41,8 @@ func (s *EnterpriseService) ListHostedRunners(ctx context.Context, enterprise st // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners#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 *HostedRunnerRequest) (*HostedRunner, *Response, error) { - if err := validateCreateHostedRunnerRequest(request); err != nil { +func (s *EnterpriseService) CreateHostedRunner(ctx context.Context, enterprise string, request CreateHostedRunnerRequest) (*HostedRunner, *Response, error) { + if err := validateCreateHostedRunnerRequest(&request); err != nil { return nil, nil, fmt.Errorf("validation failed: %w", err) } @@ -192,13 +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#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, updateReq HostedRunnerRequest) (*HostedRunner, *Response, error) { - if err := validateUpdateHostedRunnerRequest(&updateReq); err != nil { - return nil, nil, fmt.Errorf("validation failed: %w", err) - } - +func (s *EnterpriseService) UpdateHostedRunner(ctx context.Context, enterprise string, runnerID int64, request UpdateHostedRunnerRequest) (*HostedRunner, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/%v", enterprise, runnerID) - req, err := s.client.NewRequest("PATCH", u, updateReq) + req, err := s.client.NewRequest("PATCH", u, request) if err != nil { return nil, nil, err } diff --git a/vendor/github.com/google/go-github/v75/github/enterprise_actions_runner_groups.go b/vendor/github.com/google/go-github/v84/github/enterprise_actions_runner_groups.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/enterprise_actions_runner_groups.go rename to vendor/github.com/google/go-github/v84/github/enterprise_actions_runner_groups.go diff --git a/vendor/github.com/google/go-github/v75/github/enterprise_actions_runners.go b/vendor/github.com/google/go-github/v84/github/enterprise_actions_runners.go similarity index 98% rename from vendor/github.com/google/go-github/v75/github/enterprise_actions_runners.go rename to vendor/github.com/google/go-github/v84/github/enterprise_actions_runners.go index fa345aea8..408dcfd84 100644 --- a/vendor/github.com/google/go-github/v75/github/enterprise_actions_runners.go +++ b/vendor/github.com/google/go-github/v84/github/enterprise_actions_runners.go @@ -75,7 +75,7 @@ func (s *EnterpriseService) CreateRegistrationToken(ctx context.Context, enterpr return registrationToken, resp, nil } -// ListRunners lists all the self-hosted runners for a enterprise. +// ListRunners lists all the self-hosted runners for an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-enterprise // diff --git a/vendor/github.com/google/go-github/v84/github/enterprise_app_installation.go b/vendor/github.com/google/go-github/v84/github/enterprise_app_installation.go new file mode 100644 index 000000000..aed3ac753 --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/enterprise_app_installation.go @@ -0,0 +1,159 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// InstallableOrganization represents an organization in an enterprise in which a GitHub app can be installed. +type InstallableOrganization struct { + ID int64 `json:"id"` + Login string `json:"login"` + AccessibleRepositoriesURL *string `json:"accessible_repositories_url,omitempty"` +} + +// AccessibleRepository represents a repository that can be made accessible to a GitHub app. +type AccessibleRepository struct { + ID int64 `json:"id"` + Name string `json:"name"` + FullName string `json:"full_name"` +} + +// InstallAppRequest represents the request to install a GitHub app on an enterprise-owned organization. +type InstallAppRequest struct { + // The Client ID of the GitHub App to install. + ClientID string `json:"client_id"` + // The selection of repositories that the GitHub app can access. + // Can be one of: all, selected, none + RepositorySelection string `json:"repository_selection"` + // A list of repository names that the GitHub App can access, if the repository_selection is set to selected. + Repositories []string `json:"repositories,omitempty"` +} + +// ListAppInstallableOrganizations lists the organizations in an enterprise that are installable for an app. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations#get-enterprise-owned-organizations-that-can-have-github-apps-installed +// +//meta:operation GET /enterprises/{enterprise}/apps/installable_organizations +func (s *EnterpriseService) ListAppInstallableOrganizations(ctx context.Context, enterprise string, opts *ListOptions) ([]*InstallableOrganization, *Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/installable_organizations", enterprise) + + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var orgs []*InstallableOrganization + resp, err := s.client.Do(ctx, req, &orgs) + if err != nil { + return nil, resp, err + } + + return orgs, resp, nil +} + +// ListAppAccessibleOrganizationRepositories lists the repositories accessible to an app in an enterprise-owned organization. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations#get-repositories-belonging-to-an-enterprise-owned-organization +// +//meta:operation GET /enterprises/{enterprise}/apps/installable_organizations/{org}/accessible_repositories +func (s *EnterpriseService) ListAppAccessibleOrganizationRepositories(ctx context.Context, enterprise, org string, opts *ListOptions) ([]*AccessibleRepository, *Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/installable_organizations/%v/accessible_repositories", enterprise, org) + + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var repos []*AccessibleRepository + resp, err := s.client.Do(ctx, req, &repos) + if err != nil { + return nil, resp, err + } + + return repos, resp, nil +} + +// ListAppInstallations lists the GitHub app installations associated with the given enterprise-owned organization. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations#list-github-apps-installed-on-an-enterprise-owned-organization +// +//meta:operation GET /enterprises/{enterprise}/apps/organizations/{org}/installations +func (s *EnterpriseService) ListAppInstallations(ctx context.Context, enterprise, org string, opts *ListOptions) ([]*Installation, *Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations", enterprise, org) + + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var installation []*Installation + resp, err := s.client.Do(ctx, req, &installation) + if err != nil { + return nil, resp, err + } + + return installation, resp, nil +} + +// InstallApp installs any valid GitHub app on the specified organization owned by the enterprise. +// If the app is already installed on the organization, and is suspended, it will be unsuspended. If the app has a pending installation request, they will all be approved. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations#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) { + u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations", enterprise, org) + req, err := s.client.NewRequest("POST", u, request) + if err != nil { + return nil, nil, err + } + + var installation *Installation + resp, err := s.client.Do(ctx, req, &installation) + if err != nil { + return nil, resp, err + } + + return installation, resp, nil +} + +// UninstallApp uninstalls a GitHub app from an organization. Any app installed on the organization can be removed. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations#uninstall-a-github-app-from-an-enterprise-owned-organization +// +//meta:operation DELETE /enterprises/{enterprise}/apps/organizations/{org}/installations/{installation_id} +func (s *EnterpriseService) UninstallApp(ctx context.Context, enterprise, org string, installationID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations/%v", enterprise, org, installationID) + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v84/github/enterprise_apps.go b/vendor/github.com/google/go-github/v84/github/enterprise_apps.go new file mode 100644 index 000000000..3fc0df743 --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/enterprise_apps.go @@ -0,0 +1,116 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// AppInstallationRepositoriesOptions specifies the parameters for +// EnterpriseService.AddRepositoriesToAppInstallation and +// EnterpriseService.RemoveRepositoriesFromAppInstallation. +type AppInstallationRepositoriesOptions struct { + SelectedRepositoryIDs []int64 `json:"selected_repository_ids"` +} + +// UpdateAppInstallationRepositoriesOptions specifies the parameters for +// EnterpriseService.UpdateAppInstallationRepositories. +type UpdateAppInstallationRepositoriesOptions struct { + RepositorySelection *string `json:"repository_selection,omitempty"` // Can be "all" or "selected" + SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"` +} + +// ListRepositoriesForOrgAppInstallation lists the repositories that an enterprise app installation +// has access to on an organization. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations#get-the-repositories-accessible-to-a-given-github-app-installation +// +//meta:operation GET /enterprises/{enterprise}/apps/organizations/{org}/installations/{installation_id}/repositories +func (s *EnterpriseService) ListRepositoriesForOrgAppInstallation(ctx context.Context, enterprise, org string, installationID int64, opts *ListOptions) ([]*AccessibleRepository, *Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations/%v/repositories", enterprise, org, installationID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var r []*AccessibleRepository + resp, err := s.client.Do(ctx, req, &r) + if err != nil { + return nil, resp, err + } + + return r, resp, nil +} + +// UpdateAppInstallationRepositories changes a GitHub App installation's repository access +// between all repositories and a selected set. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations#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 UpdateAppInstallationRepositoriesOptions) (*Installation, *Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations/%v/repositories", enterprise, org, installationID) + req, err := s.client.NewRequest("PATCH", u, opts) + if err != nil { + return nil, nil, err + } + + var r *Installation + resp, err := s.client.Do(ctx, req, &r) + if err != nil { + return nil, resp, err + } + + return r, resp, nil +} + +// AddRepositoriesToAppInstallation grants repository access for a GitHub App installation. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations#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 AppInstallationRepositoriesOptions) ([]*AccessibleRepository, *Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations/%v/repositories/add", enterprise, org, installationID) + req, err := s.client.NewRequest("PATCH", u, opts) + if err != nil { + return nil, nil, err + } + + var r []*AccessibleRepository + resp, err := s.client.Do(ctx, req, &r) + if err != nil { + return nil, resp, err + } + + return r, resp, nil +} + +// RemoveRepositoriesFromAppInstallation revokes repository access from a GitHub App installation. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/organization-installations#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 AppInstallationRepositoriesOptions) ([]*AccessibleRepository, *Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations/%v/repositories/remove", enterprise, org, installationID) + req, err := s.client.NewRequest("PATCH", u, opts) + if err != nil { + return nil, nil, err + } + + var r []*AccessibleRepository + resp, err := s.client.Do(ctx, req, &r) + if err != nil { + return nil, resp, err + } + + return r, resp, nil +} diff --git a/vendor/github.com/google/go-github/v75/github/enterprise_audit_log.go b/vendor/github.com/google/go-github/v84/github/enterprise_audit_log.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/enterprise_audit_log.go rename to vendor/github.com/google/go-github/v84/github/enterprise_audit_log.go diff --git a/vendor/github.com/google/go-github/v84/github/enterprise_billing_cost_centers.go b/vendor/github.com/google/go-github/v84/github/enterprise_billing_cost_centers.go new file mode 100644 index 000000000..3cc3279da --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/enterprise_billing_cost_centers.go @@ -0,0 +1,233 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// CostCenter represents an enterprise cost center. +type CostCenter struct { + ID string `json:"id"` + Name string `json:"name"` + Resources []*CostCenterResource `json:"resources"` + State *string `json:"state,omitempty"` + AzureSubscription *string `json:"azure_subscription,omitempty"` +} + +// CostCenterResource represents a resource assigned to a cost center. +type CostCenterResource struct { + Type string `json:"type"` + Name string `json:"name"` +} + +// CostCenters represents a list of cost centers. +type CostCenters struct { + CostCenters []*CostCenter `json:"costCenters,omitempty"` +} + +// ListCostCenterOptions specifies optional parameters to the EnterpriseService.ListCostCenters method. +type ListCostCenterOptions struct { + // Set to `active` or `deleted` to only list cost centers in a specific state. + State *string `url:"state,omitempty"` +} + +// CostCenterRequest represents a request to create or update a cost center. +type CostCenterRequest struct { + Name string `json:"name"` +} + +// CostCenterResourceRequest represents a request to add or remove resources from a cost center. +type CostCenterResourceRequest struct { + Users []string `json:"users,omitempty"` + Organizations []string `json:"organizations,omitempty"` + Repositories []string `json:"repositories,omitempty"` +} + +// AddResourcesToCostCenterResponse represents a response from adding resources to a cost center. +type AddResourcesToCostCenterResponse struct { + Message *string `json:"message,omitempty"` + ReassignedResources []*ReassignedResource `json:"reassigned_resources,omitempty"` +} + +// ReassignedResource represents a resource that was reassigned from another cost center. +type ReassignedResource struct { + ResourceType *string `json:"resource_type,omitempty"` + Name *string `json:"name,omitempty"` + PreviousCostCenter *string `json:"previous_cost_center,omitempty"` +} + +// RemoveResourcesFromCostCenterResponse represents a response from removing resources from a cost center. +type RemoveResourcesFromCostCenterResponse struct { + Message *string `json:"message,omitempty"` +} + +// DeleteCostCenterResponse represents a response from deleting a cost center. +type DeleteCostCenterResponse struct { + Message string `json:"message"` + ID string `json:"id"` + Name string `json:"name"` + CostCenterState string `json:"costCenterState"` +} + +// ListCostCenters lists all cost centers for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/cost-centers#get-all-cost-centers-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/settings/billing/cost-centers +func (s *EnterpriseService) ListCostCenters(ctx context.Context, enterprise string, opts *ListCostCenterOptions) (*CostCenters, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + costCenters := &CostCenters{} + resp, err := s.client.Do(ctx, req, costCenters) + if err != nil { + return nil, resp, err + } + + return costCenters, resp, nil +} + +// CreateCostCenter creates a new cost center for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/cost-centers#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) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers", enterprise) + + req, err := s.client.NewRequest("POST", u, costCenter) + if err != nil { + return nil, nil, err + } + + result := &CostCenter{} + resp, err := s.client.Do(ctx, req, result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// GetCostCenter gets a cost center by ID for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/cost-centers#get-a-cost-center-by-id +// +//meta:operation GET /enterprises/{enterprise}/settings/billing/cost-centers/{cost_center_id} +func (s *EnterpriseService) GetCostCenter(ctx context.Context, enterprise, costCenterID string) (*CostCenter, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers/%v", enterprise, costCenterID) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + costCenter := &CostCenter{} + resp, err := s.client.Do(ctx, req, costCenter) + if err != nil { + return nil, resp, err + } + + return costCenter, resp, nil +} + +// UpdateCostCenter updates the name of a cost center. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/cost-centers#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) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers/%v", enterprise, costCenterID) + + req, err := s.client.NewRequest("PATCH", u, costCenter) + if err != nil { + return nil, nil, err + } + + result := &CostCenter{} + resp, err := s.client.Do(ctx, req, result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// DeleteCostCenter deletes a cost center. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/cost-centers#delete-a-cost-center +// +//meta:operation DELETE /enterprises/{enterprise}/settings/billing/cost-centers/{cost_center_id} +func (s *EnterpriseService) DeleteCostCenter(ctx context.Context, enterprise, costCenterID string) (*DeleteCostCenterResponse, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers/%v", enterprise, costCenterID) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, nil, err + } + + result := &DeleteCostCenterResponse{} + resp, err := s.client.Do(ctx, req, result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// AddResourcesToCostCenter adds resources to a cost center. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/cost-centers#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) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers/%v/resource", enterprise, costCenterID) + + req, err := s.client.NewRequest("POST", u, resources) + if err != nil { + return nil, nil, err + } + + result := &AddResourcesToCostCenterResponse{} + resp, err := s.client.Do(ctx, req, result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// RemoveResourcesFromCostCenter removes resources from a cost center. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/cost-centers#remove-resources-from-a-cost-center +// +//meta:operation DELETE /enterprises/{enterprise}/settings/billing/cost-centers/{cost_center_id}/resource +func (s *EnterpriseService) RemoveResourcesFromCostCenter(ctx context.Context, enterprise, costCenterID string, resources CostCenterResourceRequest) (*RemoveResourcesFromCostCenterResponse, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers/%v/resource", enterprise, costCenterID) + + req, err := s.client.NewRequest("DELETE", u, resources) + if err != nil { + return nil, nil, err + } + + result := &RemoveResourcesFromCostCenterResponse{} + resp, err := s.client.Do(ctx, req, result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} diff --git a/vendor/github.com/google/go-github/v75/github/enterprise_code_security_and_analysis.go b/vendor/github.com/google/go-github/v84/github/enterprise_code_security_and_analysis.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/enterprise_code_security_and_analysis.go rename to vendor/github.com/google/go-github/v84/github/enterprise_code_security_and_analysis.go diff --git a/vendor/github.com/google/go-github/v84/github/enterprise_codesecurity_configurations.go b/vendor/github.com/google/go-github/v84/github/enterprise_codesecurity_configurations.go new file mode 100644 index 000000000..978a32ad8 --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/enterprise_codesecurity_configurations.go @@ -0,0 +1,232 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" + "net/http" +) + +// ListEnterpriseCodeSecurityConfigurationOptions specifies optional parameters to get security configurations for enterprises. +// +// Note: Pagination is powered by before/after cursor-style pagination. After the initial call, +// inspect the returned *Response. Use resp.After as the opts.After value to request +// the next page, and resp.Before as the opts.Before value to request the previous +// page. Set either Before or After for a request; if both are +// supplied GitHub API will return an error. PerPage controls the number of items +// per page (max 100 per GitHub API docs). +type ListEnterpriseCodeSecurityConfigurationOptions struct { + // A cursor, as given in the Link header. If specified, the query only searches for security configurations before this cursor. + Before string `url:"before,omitempty"` + + // A cursor, as given in the Link header. If specified, the query only searches for security configurations after this cursor. + After string `url:"after,omitempty"` + + // For paginated result sets, the number of results to include per page. + PerPage int `url:"per_page,omitempty"` +} + +// ListCodeSecurityConfigurations lists all code security configurations available in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-code-security-configurations-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/code-security/configurations +func (s *EnterpriseService) ListCodeSecurityConfigurations(ctx context.Context, enterprise string, opts *ListEnterpriseCodeSecurityConfigurationOptions) ([]*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configurations []*CodeSecurityConfiguration + resp, err := s.client.Do(ctx, req, &configurations) + if err != nil { + return nil, resp, err + } + return configurations, resp, nil +} + +// CreateCodeSecurityConfiguration creates a code security configuration in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations#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) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations", enterprise) + + req, err := s.client.NewRequest("POST", u, config) + if err != nil { + return nil, nil, err + } + + var configuration *CodeSecurityConfiguration + resp, err := s.client.Do(ctx, req, &configuration) + if err != nil { + return nil, resp, err + } + return configuration, resp, nil +} + +// ListDefaultCodeSecurityConfigurations lists the default code security configurations for an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-default-code-security-configurations-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/code-security/configurations/defaults +func (s *EnterpriseService) ListDefaultCodeSecurityConfigurations(ctx context.Context, enterprise string) ([]*CodeSecurityConfigurationWithDefaultForNewRepos, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/defaults", enterprise) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configurations []*CodeSecurityConfigurationWithDefaultForNewRepos + resp, err := s.client.Do(ctx, req, &configurations) + if err != nil { + return nil, resp, err + } + return configurations, resp, nil +} + +// GetCodeSecurityConfiguration gets a code security configuration available in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations#retrieve-a-code-security-configuration-of-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/code-security/configurations/{configuration_id} +func (s *EnterpriseService) GetCodeSecurityConfiguration(ctx context.Context, enterprise string, configurationID int64) (*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v", enterprise, configurationID) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configuration *CodeSecurityConfiguration + resp, err := s.client.Do(ctx, req, &configuration) + if err != nil { + return nil, resp, err + } + return configuration, resp, nil +} + +// UpdateCodeSecurityConfiguration updates a code security configuration in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations#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) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v", enterprise, configurationID) + + req, err := s.client.NewRequest("PATCH", u, config) + if err != nil { + return nil, nil, err + } + + var configuration *CodeSecurityConfiguration + resp, err := s.client.Do(ctx, req, &configuration) + if err != nil { + return nil, resp, err + } + return configuration, resp, nil +} + +// DeleteCodeSecurityConfiguration deletes a code security configuration from an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations#delete-a-code-security-configuration-for-an-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/code-security/configurations/{configuration_id} +func (s *EnterpriseService) DeleteCodeSecurityConfiguration(ctx context.Context, enterprise string, configurationID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v", enterprise, configurationID) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + return resp, nil +} + +// AttachCodeSecurityConfigurationToRepositories attaches an enterprise code security configuration to repositories. +// `scope` is the type of repositories to attach the configuration to. +// Can be one of: `all`, `all_without_configurations`. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations#attach-an-enterprise-configuration-to-repositories +// +//meta:operation POST /enterprises/{enterprise}/code-security/configurations/{configuration_id}/attach +func (s *EnterpriseService) AttachCodeSecurityConfigurationToRepositories(ctx context.Context, enterprise string, configurationID int64, scope string) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v/attach", enterprise, configurationID) + type scopeType struct { + Scope string `json:"scope"` + } + + req, err := s.client.NewRequest("POST", u, scopeType{Scope: scope}) + if err != nil { + return nil, err + } + resp, err := s.client.Do(ctx, req, nil) + if err != nil && resp.StatusCode != http.StatusAccepted { // StatusAccepted(202) is the expected status code as job is queued for processing + return resp, err + } + return resp, nil +} + +// SetDefaultCodeSecurityConfiguration sets a code security configuration as a default for an enterprise. +// `defaultForNewRepos` specifies which types of repository this security configuration should be applied to by default. +// Can be one of: `all`, `none`, `private_and_internal`, `public`. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations#set-a-code-security-configuration-as-a-default-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/code-security/configurations/{configuration_id}/defaults +func (s *EnterpriseService) SetDefaultCodeSecurityConfiguration(ctx context.Context, enterprise string, configurationID int64, defaultForNewRepos string) (*CodeSecurityConfigurationWithDefaultForNewRepos, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v/defaults", enterprise, configurationID) + type configParam struct { + DefaultForNewRepos string `json:"default_for_new_repos"` + } + + req, err := s.client.NewRequest("PUT", u, configParam{DefaultForNewRepos: defaultForNewRepos}) + if err != nil { + return nil, nil, err + } + var config *CodeSecurityConfigurationWithDefaultForNewRepos + resp, err := s.client.Do(ctx, req, &config) + if err != nil { + return nil, resp, err + } + return config, resp, nil +} + +// ListCodeSecurityConfigurationRepositories lists the repositories associated with an enterprise code security configuration. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-repositories-associated-with-an-enterprise-code-security-configuration +// +//meta:operation GET /enterprises/{enterprise}/code-security/configurations/{configuration_id}/repositories +func (s *EnterpriseService) ListCodeSecurityConfigurationRepositories(ctx context.Context, enterprise string, configurationID int64, opts *ListCodeSecurityConfigurationRepositoriesOptions) ([]*RepositoryAttachment, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v/repositories", enterprise, configurationID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + var attachments []*RepositoryAttachment + resp, err := s.client.Do(ctx, req, &attachments) + if err != nil { + return nil, resp, err + } + return attachments, resp, nil +} diff --git a/vendor/github.com/google/go-github/v84/github/enterprise_licenses.go b/vendor/github.com/google/go-github/v84/github/enterprise_licenses.go new file mode 100644 index 000000000..e58fc07c6 --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/enterprise_licenses.go @@ -0,0 +1,138 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// EnterpriseConsumedLicenses represents information about users with consumed enterprise licenses. +type EnterpriseConsumedLicenses struct { + TotalSeatsConsumed int `json:"total_seats_consumed"` + TotalSeatsPurchased int `json:"total_seats_purchased"` + Users []*EnterpriseLicensedUsers `json:"users,omitempty"` +} + +// EnterpriseLicensedUsers represents a user with license information in an enterprise. +type EnterpriseLicensedUsers struct { + GithubComLogin string `json:"github_com_login"` + GithubComName *string `json:"github_com_name"` + EnterpriseServerUserIDs []string `json:"enterprise_server_user_ids,omitempty"` + GithubComUser bool `json:"github_com_user"` + EnterpriseServerUser *bool `json:"enterprise_server_user"` + VisualStudioSubscriptionUser bool `json:"visual_studio_subscription_user"` + LicenseType string `json:"license_type"` + GithubComProfile *string `json:"github_com_profile"` + GithubComMemberRoles []string `json:"github_com_member_roles,omitempty"` + GithubComEnterpriseRoles []string `json:"github_com_enterprise_roles,omitempty"` + GithubComVerifiedDomainEmails []string `json:"github_com_verified_domain_emails,omitempty"` + GithubComSamlNameID *string `json:"github_com_saml_name_id"` + GithubComOrgsWithPendingInvites []string `json:"github_com_orgs_with_pending_invites,omitempty"` + GithubComTwoFactorAuth *bool `json:"github_com_two_factor_auth"` + EnterpriseServerEmails []string `json:"enterprise_server_emails,omitempty"` + VisualStudioLicenseStatus *string `json:"visual_studio_license_status"` + VisualStudioSubscriptionEmail *string `json:"visual_studio_subscription_email"` + TotalUserAccounts int `json:"total_user_accounts"` +} + +// EnterpriseLicenseSyncStatus represents the synchronization status of +// GitHub Enterprise Server instances with an enterprise account. +type EnterpriseLicenseSyncStatus struct { + Title string `json:"title"` + Description string `json:"description"` + Properties *ServerInstanceProperties `json:"properties,omitempty"` +} + +// ServerInstanceProperties contains the collection of server instances. +type ServerInstanceProperties struct { + ServerInstances *ServerInstances `json:"server_instances,omitempty"` +} + +// ServerInstances represents a collection of GitHub Enterprise Server instances +// and their synchronization status. +type ServerInstances struct { + Type string `json:"type"` + Items *ServiceInstanceItems `json:"items,omitempty"` +} + +// ServiceInstanceItems defines the structure and properties of individual server instances +// in the collection. +type ServiceInstanceItems struct { + Type string `json:"type"` + Properties *ServerItemProperties `json:"properties,omitempty"` +} + +// ServerItemProperties represents the properties of a GitHub Enterprise Server instance, +// including its identifier, hostname, and last synchronization status. +type ServerItemProperties struct { + ServerID string `json:"server_id"` + Hostname string `json:"hostname"` + LastSync *LastLicenseSync `json:"last_sync,omitempty"` +} + +// LastLicenseSync contains information about the most recent license synchronization +// attempt for a server instance. +type LastLicenseSync struct { + Type string `json:"type"` + Properties *LastLicenseSyncProperties `json:"properties,omitempty"` +} + +// LastLicenseSyncProperties represents the details of the last synchronization attempt, +// including the date, status, and any error that occurred. +type LastLicenseSyncProperties struct { + Date *Timestamp `json:"date,omitempty"` + Status string `json:"status"` + Error string `json:"error"` +} + +// GetConsumedLicenses collect information about the number of consumed licenses and a collection with all the users with consumed enterprise licenses. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/licensing#list-enterprise-consumed-licenses +// +//meta:operation GET /enterprises/{enterprise}/consumed-licenses +func (s *EnterpriseService) GetConsumedLicenses(ctx context.Context, enterprise string, opts *ListOptions) (*EnterpriseConsumedLicenses, *Response, error) { + u := fmt.Sprintf("enterprises/%v/consumed-licenses", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + consumedLicenses := &EnterpriseConsumedLicenses{} + resp, err := s.client.Do(ctx, req, &consumedLicenses) + if err != nil { + return nil, resp, err + } + + return consumedLicenses, resp, nil +} + +// GetLicenseSyncStatus collects information about the status of a license sync job for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/licensing#get-a-license-sync-status +// +//meta:operation GET /enterprises/{enterprise}/license-sync-status +func (s *EnterpriseService) GetLicenseSyncStatus(ctx context.Context, enterprise string) (*EnterpriseLicenseSyncStatus, *Response, error) { + u := fmt.Sprintf("enterprises/%v/license-sync-status", enterprise) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + syncStatus := &EnterpriseLicenseSyncStatus{} + resp, err := s.client.Do(ctx, req, &syncStatus) + if err != nil { + return nil, resp, err + } + + return syncStatus, resp, nil +} diff --git a/vendor/github.com/google/go-github/v75/github/enterprise_manage_ghes.go b/vendor/github.com/google/go-github/v84/github/enterprise_manage_ghes.go similarity index 95% rename from vendor/github.com/google/go-github/v75/github/enterprise_manage_ghes.go rename to vendor/github.com/google/go-github/v84/github/enterprise_manage_ghes.go index c5e38386a..023c119d1 100644 --- a/vendor/github.com/google/go-github/v75/github/enterprise_manage_ghes.go +++ b/vendor/github.com/google/go-github/v84/github/enterprise_manage_ghes.go @@ -74,7 +74,7 @@ type ReleaseVersion struct { // CheckSystemRequirements checks if GHES system nodes meet the system requirements. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-the-system-requirement-check-results-for-configured-cluster-nodes +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/manage-ghes#get-the-system-requirement-check-results-for-configured-cluster-nodes // //meta:operation GET /manage/v1/checks/system-requirements func (s *EnterpriseService) CheckSystemRequirements(ctx context.Context) (*SystemRequirements, *Response, error) { @@ -95,7 +95,7 @@ func (s *EnterpriseService) CheckSystemRequirements(ctx context.Context) (*Syste // ClusterStatus gets the status of all services running on each cluster node. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-the-status-of-services-running-on-all-cluster-nodes +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/manage-ghes#get-the-status-of-services-running-on-all-cluster-nodes // //meta:operation GET /manage/v1/cluster/status func (s *EnterpriseService) ClusterStatus(ctx context.Context) (*ClusterStatus, *Response, error) { @@ -116,7 +116,7 @@ func (s *EnterpriseService) ClusterStatus(ctx context.Context) (*ClusterStatus, // ReplicationStatus gets the status of all services running on each replica node. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-the-status-of-services-running-on-all-replica-nodes +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/manage-ghes#get-the-status-of-services-running-on-all-replica-nodes // //meta:operation GET /manage/v1/replication/status func (s *EnterpriseService) ReplicationStatus(ctx context.Context, opts *NodeQueryOptions) (*ClusterStatus, *Response, error) { @@ -140,7 +140,7 @@ func (s *EnterpriseService) ReplicationStatus(ctx context.Context, opts *NodeQue // GetNodeReleaseVersions gets the version information deployed to each node. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-all-ghes-release-versions-for-all-nodes +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/manage-ghes#get-all-ghes-release-versions-for-all-nodes // //meta:operation GET /manage/v1/version func (s *EnterpriseService) GetNodeReleaseVersions(ctx context.Context, opts *NodeQueryOptions) ([]*NodeReleaseVersion, *Response, error) { diff --git a/vendor/github.com/google/go-github/v75/github/enterprise_manage_ghes_config.go b/vendor/github.com/google/go-github/v84/github/enterprise_manage_ghes_config.go similarity index 96% rename from vendor/github.com/google/go-github/v75/github/enterprise_manage_ghes_config.go rename to vendor/github.com/google/go-github/v84/github/enterprise_manage_ghes_config.go index ded48ddc7..92bf3d71a 100644 --- a/vendor/github.com/google/go-github/v75/github/enterprise_manage_ghes_config.go +++ b/vendor/github.com/google/go-github/v84/github/enterprise_manage_ghes_config.go @@ -63,10 +63,10 @@ type ConfigApplyEventsNodeEvent struct { SpanDepth *int `json:"span_depth,omitempty"` } -// InitialConfigOptions is a struct to hold the options for the InitialConfig API. +// InitialConfigOptions represents the payload for initializing instance configuration. type InitialConfigOptions struct { - License string `url:"license"` - Password string `url:"password"` + License string `json:"license"` + Password string `json:"password"` } // LicenseStatus is a struct to hold the response from the License API. @@ -305,7 +305,7 @@ type NodeDetails struct { // ConfigApplyEvents gets events from the command ghe-config-apply. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#list-events-from-ghe-config-apply +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/manage-ghes#list-events-from-ghe-config-apply // //meta:operation GET /manage/v1/config/apply/events func (s *EnterpriseService) ConfigApplyEvents(ctx context.Context, opts *ConfigApplyEventsOptions) (*ConfigApplyEvents, *Response, error) { @@ -330,18 +330,18 @@ func (s *EnterpriseService) ConfigApplyEvents(ctx context.Context, opts *ConfigA // InitialConfig initializes the GitHub Enterprise instance with a license and password. // After initializing the instance, you need to run an apply to apply the configuration. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#initialize-instance-configuration-with-license-and-password +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/manage-ghes#initialize-instance-configuration-with-license-and-password // //meta:operation POST /manage/v1/config/init func (s *EnterpriseService) InitialConfig(ctx context.Context, license, password string) (*Response, error) { u := "manage/v1/config/init" - opts := &InitialConfigOptions{ + payload := &InitialConfigOptions{ License: license, Password: password, } - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest("POST", u, payload) if err != nil { return nil, err } @@ -351,7 +351,7 @@ func (s *EnterpriseService) InitialConfig(ctx context.Context, license, password // License gets the current license information for the GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-the-enterprise-license-information +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/manage-ghes#get-the-enterprise-license-information // //meta:operation GET /manage/v1/config/license func (s *EnterpriseService) License(ctx context.Context) ([]*LicenseStatus, *Response, error) { @@ -372,7 +372,7 @@ func (s *EnterpriseService) License(ctx context.Context) ([]*LicenseStatus, *Res // UploadLicense uploads a new license to the GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#upload-an-enterprise-license +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/manage-ghes#upload-an-enterprise-license // //meta:operation PUT /manage/v1/config/license func (s *EnterpriseService) UploadLicense(ctx context.Context, license string) (*Response, error) { @@ -390,7 +390,7 @@ func (s *EnterpriseService) UploadLicense(ctx context.Context, license string) ( // LicenseStatus gets the current license status for the GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#check-a-license +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/manage-ghes#check-a-license // //meta:operation GET /manage/v1/config/license/check func (s *EnterpriseService) LicenseStatus(ctx context.Context) ([]*LicenseCheck, *Response, error) { @@ -412,7 +412,7 @@ func (s *EnterpriseService) LicenseStatus(ctx context.Context) ([]*LicenseCheck, // NodeMetadata gets the metadata for all nodes in the GitHub Enterprise instance. // This is required for clustered setups. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-ghes-node-metadata-for-all-nodes +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/manage-ghes#get-ghes-node-metadata-for-all-nodes // //meta:operation GET /manage/v1/config/nodes func (s *EnterpriseService) NodeMetadata(ctx context.Context, opts *NodeQueryOptions) (*NodeMetadataStatus, *Response, error) { @@ -436,7 +436,7 @@ func (s *EnterpriseService) NodeMetadata(ctx context.Context, opts *NodeQueryOpt // Settings gets the current configuration settings for the GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-the-ghes-settings +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/manage-ghes#get-the-ghes-settings // //meta:operation GET /manage/v1/config/settings func (s *EnterpriseService) Settings(ctx context.Context) (*ConfigSettings, *Response, error) { @@ -457,7 +457,7 @@ func (s *EnterpriseService) Settings(ctx context.Context) (*ConfigSettings, *Res // UpdateSettings updates the configuration settings for the GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#set-settings +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/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) { @@ -476,7 +476,7 @@ func (s *EnterpriseService) UpdateSettings(ctx context.Context, opts *ConfigSett // ConfigApply triggers a configuration apply run on the GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#trigger-a-ghe-config-apply-run +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/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) { @@ -497,7 +497,7 @@ func (s *EnterpriseService) ConfigApply(ctx context.Context, opts *ConfigApplyOp // ConfigApplyStatus gets the status of a ghe-config-apply run on the GitHub Enterprise instance. // You can request lat one or specific id one. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-the-status-of-a-ghe-config-apply-run +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/manage-ghes#get-the-status-of-a-ghe-config-apply-run // //meta:operation GET /manage/v1/config/apply func (s *EnterpriseService) ConfigApplyStatus(ctx context.Context, opts *ConfigApplyOptions) (*ConfigApplyStatus, *Response, error) { diff --git a/vendor/github.com/google/go-github/v75/github/enterprise_manage_ghes_maintenance.go b/vendor/github.com/google/go-github/v84/github/enterprise_manage_ghes_maintenance.go similarity index 96% rename from vendor/github.com/google/go-github/v75/github/enterprise_manage_ghes_maintenance.go rename to vendor/github.com/google/go-github/v84/github/enterprise_manage_ghes_maintenance.go index 8b27b32a4..9a4653303 100644 --- a/vendor/github.com/google/go-github/v75/github/enterprise_manage_ghes_maintenance.go +++ b/vendor/github.com/google/go-github/v84/github/enterprise_manage_ghes_maintenance.go @@ -46,7 +46,7 @@ type MaintenanceOptions struct { // GetMaintenanceStatus gets the status of maintenance mode for all nodes. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-the-status-of-maintenance-mode +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/manage-ghes#get-the-status-of-maintenance-mode // //meta:operation GET /manage/v1/maintenance func (s *EnterpriseService) GetMaintenanceStatus(ctx context.Context, opts *NodeQueryOptions) ([]*MaintenanceStatus, *Response, error) { @@ -71,7 +71,7 @@ func (s *EnterpriseService) GetMaintenanceStatus(ctx context.Context, opts *Node // CreateMaintenance sets the maintenance mode for the instance. // With the enable parameter we can control to put instance into maintenance mode or not. With false we can disable the maintenance mode. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#set-the-status-of-maintenance-mode +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/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) { diff --git a/vendor/github.com/google/go-github/v75/github/enterprise_manage_ghes_ssh.go b/vendor/github.com/google/go-github/v84/github/enterprise_manage_ghes_ssh.go similarity index 93% rename from vendor/github.com/google/go-github/v75/github/enterprise_manage_ghes_ssh.go rename to vendor/github.com/google/go-github/v84/github/enterprise_manage_ghes_ssh.go index d60f89779..78dc2b35f 100644 --- a/vendor/github.com/google/go-github/v75/github/enterprise_manage_ghes_ssh.go +++ b/vendor/github.com/google/go-github/v84/github/enterprise_manage_ghes_ssh.go @@ -31,7 +31,7 @@ type ClusterSSHKey struct { // DeleteSSHKey deletes the SSH key from the instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#delete-a-ssh-key +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/manage-ghes#delete-a-ssh-key // //meta:operation DELETE /manage/v1/access/ssh func (s *EnterpriseService) DeleteSSHKey(ctx context.Context, key string) ([]*SSHKeyStatus, *Response, error) { @@ -55,7 +55,7 @@ func (s *EnterpriseService) DeleteSSHKey(ctx context.Context, key string) ([]*SS // GetSSHKey gets the SSH keys configured for the instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#get-the-configured-ssh-keys +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/manage-ghes#get-the-configured-ssh-keys // //meta:operation GET /manage/v1/access/ssh func (s *EnterpriseService) GetSSHKey(ctx context.Context) ([]*ClusterSSHKey, *Response, error) { @@ -76,7 +76,7 @@ func (s *EnterpriseService) GetSSHKey(ctx context.Context) ([]*ClusterSSHKey, *R // CreateSSHKey adds a new SSH key to the instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/manage-ghes#set-a-new-ssh-key +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/manage-ghes#set-a-new-ssh-key // //meta:operation POST /manage/v1/access/ssh func (s *EnterpriseService) CreateSSHKey(ctx context.Context, key string) ([]*SSHKeyStatus, *Response, error) { diff --git a/vendor/github.com/google/go-github/v75/github/enterprise_network_configurations.go b/vendor/github.com/google/go-github/v84/github/enterprise_network_configurations.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/enterprise_network_configurations.go rename to vendor/github.com/google/go-github/v84/github/enterprise_network_configurations.go diff --git a/vendor/github.com/google/go-github/v84/github/enterprise_organization_properties.go b/vendor/github.com/google/go-github/v84/github/enterprise_organization_properties.go new file mode 100644 index 000000000..01a646b38 --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/enterprise_organization_properties.go @@ -0,0 +1,189 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// EnterpriseCustomPropertySchema represents the schema response for GetEnterpriseCustomPropertiesSchema. +type EnterpriseCustomPropertySchema struct { + // An ordered list of the custom property defined in the enterprise. + Properties []*CustomProperty `json:"properties,omitempty"` +} + +// EnterpriseCustomPropertiesValues represents the custom properties values for an organization within an enterprise. +type EnterpriseCustomPropertiesValues struct { + // The Organization ID that the custom property values will be applied to. + OrganizationID *int64 `json:"organization_id,omitempty"` + // The names of organizations that the custom property values will be applied to. + OrganizationLogin *string `json:"organization_login,omitempty"` + // List of custom property names and associated values to apply to the organizations. + Properties []*CustomPropertyValue `json:"properties,omitempty"` +} + +// EnterpriseCustomPropertyValuesRequest represents the request to update custom property values for organizations within an enterprise. +type EnterpriseCustomPropertyValuesRequest struct { + // The names of organizations that the custom property values will be applied to. + // OrganizationLogin specifies the organization name when updating multiple organizations. + OrganizationLogin []string `json:"organization_login"` + // List of custom property names and associated values to apply to the organizations. + Properties []*CustomPropertyValue `json:"properties"` +} + +// GetOrganizationCustomPropertySchema gets all organization custom property definitions that are defined on an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs#get-organization-custom-properties-schema-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/org-properties/schema +func (s *EnterpriseService) GetOrganizationCustomPropertySchema(ctx context.Context, enterprise string) (*EnterpriseCustomPropertySchema, *Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/schema", enterprise) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var schema *EnterpriseCustomPropertySchema + resp, err := s.client.Do(ctx, req, &schema) + if err != nil { + return nil, resp, err + } + + return schema, resp, nil +} + +// CreateOrUpdateOrganizationCustomPropertySchema creates new or updates existing organization custom properties defined on an enterprise in a batch. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs#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) { + u := fmt.Sprintf("enterprises/%v/org-properties/schema", enterprise) + req, err := s.client.NewRequest("PATCH", u, schema) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// GetOrganizationCustomProperty retrieves a specific organization custom property definition from an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs#get-an-organization-custom-property-definition-from-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/org-properties/schema/{custom_property_name} +func (s *EnterpriseService) GetOrganizationCustomProperty(ctx context.Context, enterprise, customPropertyName string) (*CustomProperty, *Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/schema/%v", enterprise, customPropertyName) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var property *CustomProperty + resp, err := s.client.Do(ctx, req, &property) + if err != nil { + return nil, resp, err + } + + return property, resp, nil +} + +// CreateOrUpdateOrganizationCustomProperty creates a new or updates an existing organization custom property definition that is defined on an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs#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) { + u := fmt.Sprintf("enterprises/%v/org-properties/schema/%v", enterprise, customPropertyName) + req, err := s.client.NewRequest("PUT", u, property) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// DeleteOrganizationCustomProperty removes an organization custom property definition that is defined on an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs#remove-an-organization-custom-property-definition-from-an-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/org-properties/schema/{custom_property_name} +func (s *EnterpriseService) DeleteOrganizationCustomProperty(ctx context.Context, enterprise, customPropertyName string) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/schema/%v", enterprise, customPropertyName) + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// ListOrganizationCustomPropertyValues lists enterprise organizations with all of their custom property values. +// Returns a list of organizations and their custom property values defined in the enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs#list-custom-property-values-for-organizations-in-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/org-properties/values +func (s *EnterpriseService) ListOrganizationCustomPropertyValues(ctx context.Context, enterprise string, opts *ListOptions) ([]*EnterpriseCustomPropertiesValues, *Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/values", enterprise) + + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var values []*EnterpriseCustomPropertiesValues + resp, err := s.client.Do(ctx, req, &values) + if err != nil { + return nil, resp, err + } + + return values, resp, nil +} + +// CreateOrUpdateOrganizationCustomPropertyValues creates or updates custom property values for organizations in an enterprise. +// To remove a custom property value from an organization, set the property value to null. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs#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) { + u := fmt.Sprintf("enterprises/%v/org-properties/values", enterprise) + req, err := s.client.NewRequest("PATCH", u, values) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v75/github/enterprise_properties.go b/vendor/github.com/google/go-github/v84/github/enterprise_properties.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/enterprise_properties.go rename to vendor/github.com/google/go-github/v84/github/enterprise_properties.go diff --git a/vendor/github.com/google/go-github/v75/github/enterprise_rules.go b/vendor/github.com/google/go-github/v84/github/enterprise_rules.go similarity index 76% rename from vendor/github.com/google/go-github/v75/github/enterprise_rules.go rename to vendor/github.com/google/go-github/v84/github/enterprise_rules.go index f43822337..3cd3ee4e8 100644 --- a/vendor/github.com/google/go-github/v75/github/enterprise_rules.go +++ b/vendor/github.com/google/go-github/v84/github/enterprise_rules.go @@ -76,31 +76,6 @@ func (s *EnterpriseService) UpdateRepositoryRuleset(ctx context.Context, enterpr return rs, resp, nil } -// UpdateRepositoryRulesetClearBypassActor clears the bypass actors for a repository ruleset for the specified enterprise. -// -// This function is necessary as the UpdateRepositoryRuleset function does not marshal ByPassActor if passed as an empty array. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules#update-an-enterprise-repository-ruleset -// -//meta:operation PUT /enterprises/{enterprise}/rulesets/{ruleset_id} -func (s *EnterpriseService) UpdateRepositoryRulesetClearBypassActor(ctx context.Context, enterprise string, rulesetID int64) (*Response, error) { - u := fmt.Sprintf("enterprises/%v/rulesets/%v", enterprise, rulesetID) - - rsClearBypassActor := rulesetClearBypassActors{} - - req, err := s.client.NewRequest("PUT", u, rsClearBypassActor) - if err != nil { - return nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - - return resp, nil -} - // DeleteRepositoryRuleset deletes a repository ruleset from the specified enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules#delete-an-enterprise-repository-ruleset diff --git a/vendor/github.com/google/go-github/v84/github/enterprise_scim.go b/vendor/github.com/google/go-github/v84/github/enterprise_scim.go new file mode 100644 index 000000000..9f9e29694 --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/enterprise_scim.go @@ -0,0 +1,481 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// SCIMSchemasURINamespacesGroups is the SCIM schema URI namespace for group resources. +// This constant represents the standard SCIM core schema for group objects as defined by RFC 7643. +const SCIMSchemasURINamespacesGroups = "urn:ietf:params:scim:schemas:core:2.0:Group" + +// SCIMSchemasURINamespacesUser is the SCIM schema URI namespace for user resources. +// This constant represents the standard SCIM core schema for user objects as defined by RFC 7643. +const SCIMSchemasURINamespacesUser = "urn:ietf:params:scim:schemas:core:2.0:User" + +// SCIMSchemasURINamespacesListResponse is the SCIM schema URI namespace for list response resources. +// This constant represents the standard SCIM namespace for list responses used in paginated queries, as defined by RFC 7644. +const SCIMSchemasURINamespacesListResponse = "urn:ietf:params:scim:api:messages:2.0:ListResponse" + +// SCIMSchemasURINamespacesPatchOp is the SCIM schema URI namespace for patch operations. +// This constant represents the standard SCIM namespace for patch operations as defined by RFC 7644. +const SCIMSchemasURINamespacesPatchOp = "urn:ietf:params:scim:api:messages:2.0:PatchOp" + +// SCIMEnterpriseGroupAttributes represents supported SCIM Enterprise group attributes, and represents the result of calling UpdateSCIMGroupAttribute. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#supported-scim-group-attributes +type SCIMEnterpriseGroupAttributes struct { + DisplayName *string `json:"displayName,omitempty"` // Human-readable name for a group. + Members []*SCIMEnterpriseDisplayReference `json:"members,omitempty"` // List of members who are assigned to the group in SCIM provider + ExternalID *string `json:"externalId,omitempty"` // This identifier is generated by a SCIM provider. Must be unique per group. + Schemas []string `json:"schemas,omitempty"` // The URIs that are used to indicate the namespaces of the SCIM schemas. + // Bellow: Only populated as a result of calling UpdateSCIMGroupAttribute: + ID *string `json:"id,omitempty"` // The internally generated id for the group object. + Meta *SCIMEnterpriseMeta `json:"meta,omitempty"` // The metadata associated with the creation/updates to the group. +} + +// SCIMEnterpriseDisplayReference represents a JSON SCIM (System for Cross-domain Identity Management) resource reference. +type SCIMEnterpriseDisplayReference struct { + Value string `json:"value"` // The local unique identifier for the member (e.g., user ID or group ID). + Ref *string `json:"$ref,omitempty"` // The URI reference to the Members or Groups resource (e.g., /scim/v2/enterprises/{enterprise}/Users/{scim_user_id}). + Display *string `json:"display,omitempty"` // The display name associated with the member (e.g., user name or group name). +} + +// SCIMEnterpriseMeta represents metadata about the SCIM resource. +type SCIMEnterpriseMeta struct { + ResourceType string `json:"resourceType"` // A type of a resource (`User` or `Group`). + Created *Timestamp `json:"created,omitempty"` // A date and time when the user was created. + LastModified *Timestamp `json:"lastModified,omitempty"` // A date and time when the user was last modified. + Location *string `json:"location,omitempty"` // A URL location of an object +} + +// SCIMEnterpriseGroups represents the result of calling ListProvisionedSCIMGroups. +type SCIMEnterpriseGroups struct { + Schemas []string `json:"schemas,omitempty"` + TotalResults *int `json:"totalResults,omitempty"` + Resources []*SCIMEnterpriseGroupAttributes `json:"Resources,omitempty"` + StartIndex *int `json:"startIndex,omitempty"` + ItemsPerPage *int `json:"itemsPerPage,omitempty"` +} + +// ListProvisionedSCIMGroupsEnterpriseOptions represents query parameters for ListProvisionedSCIMGroups. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#list-provisioned-scim-groups-for-an-enterprise--parameters +type ListProvisionedSCIMGroupsEnterpriseOptions struct { + // If specified, only results that match the specified filter will be returned. + // Possible filters are `externalId`, `id`, and `displayName`. For example, `externalId eq "a123"`. + Filter *string `url:"filter,omitempty"` + // Excludes the specified attributes from being returned in the results. + ExcludedAttributes *string `url:"excludedAttributes,omitempty"` + // Used for pagination: the starting index of the first result to return when paginating through values. + // Default: 1. + StartIndex *int `url:"startIndex,omitempty"` + // Used for pagination: the number of results to return per page. + // Default: 30. + Count *int `url:"count,omitempty"` +} + +// GetProvisionedSCIMGroupEnterpriseOptions represents query parameters for GetProvisionedSCIMGroup. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#get-scim-provisioning-information-for-an-enterprise-group +type GetProvisionedSCIMGroupEnterpriseOptions struct { + // Excludes the specified attributes from being returned in the results. + ExcludedAttributes *string `url:"excludedAttributes,omitempty"` +} + +// SCIMEnterpriseUserAttributes represents supported SCIM enterprise user attributes, and represents the result of calling UpdateSCIMUserAttribute. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#supported-scim-user-attributes +type SCIMEnterpriseUserAttributes struct { + DisplayName string `json:"displayName"` // Human-readable name for a user + Name *SCIMEnterpriseUserName `json:"name,omitempty"` // The user's full name + UserName string `json:"userName"` // The username for the user (GitHub Account after normalized), generated by the SCIM provider. Must be unique per user. + Emails []*SCIMEnterpriseUserEmail `json:"emails"` // List of the user's emails. They all must be unique per user. + Roles []*SCIMEnterpriseUserRole `json:"roles,omitempty"` // List of the user's roles. + ExternalID string `json:"externalId"` // This identifier is generated by a SCIM provider. Must be unique per user. + Active bool `json:"active"` // Indicates whether the identity is active (true) or should be suspended (false). + Schemas []string `json:"schemas"` // The URIs that are used to indicate the namespaces of the SCIM schemas. + // Bellow: Only populated as a result of calling UpdateSCIMUserAttribute: + ID *string `json:"id,omitempty"` // Identifier generated by the GitHub's SCIM endpoint. + Groups []*SCIMEnterpriseDisplayReference `json:"groups,omitempty"` // List of groups who are assigned to the user in SCIM provider + Meta *SCIMEnterpriseMeta `json:"meta,omitempty"` // The metadata associated with the creation/updates to the user. +} + +// SCIMEnterpriseUserName represents SCIM enterprise user's name information. +type SCIMEnterpriseUserName struct { + GivenName string `json:"givenName"` // The first name of the user. + FamilyName string `json:"familyName"` // The last name of the user. + Formatted *string `json:"formatted,omitempty"` // The user's full name, including all middle names, titles, and suffixes, formatted for display. + MiddleName *string `json:"middleName,omitempty"` // The middle name(s) of the user. +} + +// SCIMEnterpriseUserEmail represents SCIM enterprise user's emails. +type SCIMEnterpriseUserEmail struct { + Value string `json:"value"` // The email address. + Primary bool `json:"primary"` // Whether this email address is the primary address. + Type string `json:"type"` // The type of email address +} + +// SCIMEnterpriseUserRole is an enterprise-wide role granted to the user. +type SCIMEnterpriseUserRole struct { + Value string `json:"value"` // The role value representing a user role in GitHub. + Display *string `json:"display,omitempty"` + Type *string `json:"type,omitempty"` + Primary *bool `json:"primary,omitempty"` // Is the role a primary role for the user? +} + +// SCIMEnterpriseUsers represents the result of calling ListProvisionedSCIMUsers. +type SCIMEnterpriseUsers struct { + Schemas []string `json:"schemas,omitempty"` + TotalResults *int `json:"totalResults,omitempty"` + ItemsPerPage *int `json:"itemsPerPage,omitempty"` + StartIndex *int `json:"startIndex,omitempty"` + Resources []*SCIMEnterpriseUserAttributes `json:"Resources,omitempty"` +} + +// ListProvisionedSCIMUsersEnterpriseOptions represents query parameters for ListProvisionedSCIMUsers. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#list-scim-provisioned-identities-for-an-enterprise +type ListProvisionedSCIMUsersEnterpriseOptions struct { + // If specified, only results that match the specified filter will be returned. + // Possible filters are `userName`, `externalId`, `id`, and `displayName`. For example, `externalId eq "a123"`. + Filter *string `url:"filter,omitempty"` + // Used for pagination: the starting index of the first result to return when paginating through values. + // Default: 1. + StartIndex *int `url:"startIndex,omitempty"` + // Used for pagination: the number of results to return per page. + // Default: 30. + Count *int `url:"count,omitempty"` +} + +// SCIMEnterpriseAttribute represents attribute operations for UpdateSCIMGroupAttribute or UpdateSCIMUserAttribute. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#update-an-attribute-for-a-scim-enterprise-group +type SCIMEnterpriseAttribute struct { + Schemas []string `json:"schemas"` // The URIs that are used to indicate the namespaces for a SCIM patch operation. + Operations []*SCIMEnterpriseAttributeOperation `json:"Operations"` // Set of operations to be performed. +} + +// SCIMEnterpriseAttributeOperation represents an operation for UpdateSCIMGroupAttribute or UpdateSCIMUserAttribute. +type SCIMEnterpriseAttributeOperation struct { + Op string `json:"op"` // Can be one of: `add`, `replace`, `remove`. + Path *string `json:"path,omitempty"` // Path to the attribute being modified (Filters are not supported). + Value any `json:"value,omitempty"` // New value for the attribute being modified. +} + +// ListProvisionedSCIMGroups lists provisioned SCIM groups in an enterprise. +// +// You can improve query search time by using the `excludedAttributes` and +// exclude the specified attributes, e.g. `members` to exclude members from the +// response. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#list-provisioned-scim-groups-for-an-enterprise +// +//meta:operation GET /scim/v2/enterprises/{enterprise}/Groups +func (s *EnterpriseService) ListProvisionedSCIMGroups(ctx context.Context, enterprise string, opts *ListProvisionedSCIMGroupsEnterpriseOptions) (*SCIMEnterpriseGroups, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Groups", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + groups := new(SCIMEnterpriseGroups) + resp, err := s.client.Do(ctx, req, groups) + if err != nil { + return nil, resp, err + } + + return groups, resp, nil +} + +// ListProvisionedSCIMUsers lists provisioned SCIM enterprise users. +// +// When members are part of the group provisioning payload, they're designated +// as external group members. Providers are responsible for maintaining a +// mapping between the `externalId` and `id` for each user. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#list-scim-provisioned-identities-for-an-enterprise +// +//meta:operation GET /scim/v2/enterprises/{enterprise}/Users +func (s *EnterpriseService) ListProvisionedSCIMUsers(ctx context.Context, enterprise string, opts *ListProvisionedSCIMUsersEnterpriseOptions) (*SCIMEnterpriseUsers, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Users", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + users := new(SCIMEnterpriseUsers) + resp, err := s.client.Do(ctx, req, users) + if err != nil { + return nil, resp, err + } + + return users, resp, nil +} + +// SetProvisionedSCIMGroup replaces an existing provisioned group’s information. +// +// You must provide all the information required for the group as if you were provisioning it for the first time. Any +// existing group information that you don't provide will be removed, including group membership. To update only +// specific attributes, refer to the `Enterprise.UpdateSCIMGroupAttribute()` method. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#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) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Groups/%v", enterprise, scimGroupID) + req, err := s.client.NewRequest("PUT", u, group) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + groupNew := new(SCIMEnterpriseGroupAttributes) + resp, err := s.client.Do(ctx, req, groupNew) + if err != nil { + return nil, resp, err + } + + return groupNew, resp, nil +} + +// SetProvisionedSCIMUser replaces an existing provisioned user's information. +// +// You must supply complete user information, just as you would when provisioning them initially. Any previously +// existing data not provided will be deleted. To update specific attributes only, refer to the +// `Enterprise.UpdateSCIMUserAttribute()` method. +// +// **Warning**: Setting `active: false` will suspend a user, and their handle and email will be obfuscated. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#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) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Users/%v", enterprise, scimUserID) + req, err := s.client.NewRequest("PUT", u, user) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + userNew := new(SCIMEnterpriseUserAttributes) + resp, err := s.client.Do(ctx, req, userNew) + if err != nil { + return nil, resp, err + } + + return userNew, resp, nil +} + +// UpdateSCIMGroupAttribute updates a provisioned group’s individual attributes. +// +// The `attribute` parameter must include at least one of the following +// Operations: `add`, `remove`, or `replace`. +// +// The update function can also be used to add group memberships. +// +// You can submit group memberships individually or in batches for improved +// efficiency. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#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) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Groups/%v", enterprise, scimGroupID) + req, err := s.client.NewRequest("PATCH", u, attribute) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + group := new(SCIMEnterpriseGroupAttributes) + resp, err := s.client.Do(ctx, req, group) + if err != nil { + return nil, resp, err + } + + return group, resp, nil +} + +// UpdateSCIMUserAttribute updates a provisioned user's individual attributes. +// +// The `attribute` parameter must include at least one of the following +// Operations: `add`, `remove`, or `replace`. +// +// Note: Complex SCIM path selectors that include filters are not supported. +// For example, a path selector defined as `"path": "emails[type eq \"work\"]"` +// will be ineffective. +// +// Warning: Setting `active: false` will suspend a user, and their handle and +// email will be obfuscated. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#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) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Users/%v", enterprise, scimUserID) + req, err := s.client.NewRequest("PATCH", u, attribute) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + user := new(SCIMEnterpriseUserAttributes) + resp, err := s.client.Do(ctx, req, user) + if err != nil { + return nil, resp, err + } + + return user, resp, nil +} + +// ProvisionSCIMGroup creates a SCIM group for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#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) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Groups", enterprise) + req, err := s.client.NewRequest("POST", u, group) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + groupProvisioned := new(SCIMEnterpriseGroupAttributes) + resp, err := s.client.Do(ctx, req, groupProvisioned) + if err != nil { + return nil, resp, err + } + + return groupProvisioned, resp, nil +} + +// ProvisionSCIMUser creates an external identity for a new SCIM enterprise user. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#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) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Users", enterprise) + req, err := s.client.NewRequest("POST", u, user) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + userProvisioned := new(SCIMEnterpriseUserAttributes) + resp, err := s.client.Do(ctx, req, userProvisioned) + if err != nil { + return nil, resp, err + } + + return userProvisioned, resp, nil +} + +// GetProvisionedSCIMGroup gets information about a SCIM group. +// +// You can use the `excludedAttributes` from `opts` and exclude the specified +// attributes from being returned in the results. Using this parameter can +// speed up response time. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#get-scim-provisioning-information-for-an-enterprise-group +// +//meta:operation GET /scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} +func (s *EnterpriseService) GetProvisionedSCIMGroup(ctx context.Context, enterprise, scimGroupID string, opts *GetProvisionedSCIMGroupEnterpriseOptions) (*SCIMEnterpriseGroupAttributes, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Groups/%v", enterprise, scimGroupID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + group := new(SCIMEnterpriseGroupAttributes) + resp, err := s.client.Do(ctx, req, group) + if err != nil { + return nil, resp, err + } + + return group, resp, nil +} + +// GetProvisionedSCIMUser gets information about a SCIM user. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#get-scim-provisioning-information-for-an-enterprise-user +// +//meta:operation GET /scim/v2/enterprises/{enterprise}/Users/{scim_user_id} +func (s *EnterpriseService) GetProvisionedSCIMUser(ctx context.Context, enterprise, scimUserID string) (*SCIMEnterpriseUserAttributes, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Users/%v", enterprise, scimUserID) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + user := new(SCIMEnterpriseUserAttributes) + resp, err := s.client.Do(ctx, req, user) + if err != nil { + return nil, resp, err + } + + return user, resp, nil +} + +// DeleteSCIMGroup deletes a SCIM group from an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#delete-a-scim-group-from-an-enterprise +// +//meta:operation DELETE /scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} +func (s *EnterpriseService) DeleteSCIMGroup(ctx context.Context, enterprise, scimGroupID string) (*Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Groups/%v", enterprise, scimGroupID) + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// DeleteSCIMUser deletes a SCIM user from an enterprise. +// +// Suspends a SCIM user permanently from an enterprise. This action will: +// remove all the user's data, anonymize their login, email, and display name, +// erase all external identity SCIM attributes, delete the user's emails, +// avatar, PATs, SSH keys, OAuth authorizations, GPG keys, and SAML mappings. +// This action is irreversible. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#delete-a-scim-user-from-an-enterprise +// +//meta:operation DELETE /scim/v2/enterprises/{enterprise}/Users/{scim_user_id} +func (s *EnterpriseService) DeleteSCIMUser(ctx context.Context, enterprise, scimUserID string) (*Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Users/%v", enterprise, scimUserID) + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} diff --git a/vendor/github.com/google/go-github/v84/github/enterprise_team.go b/vendor/github.com/google/go-github/v84/github/enterprise_team.go new file mode 100644 index 000000000..e9317b077 --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/enterprise_team.go @@ -0,0 +1,420 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// EnterpriseTeam represent a team in a GitHub Enterprise. +type EnterpriseTeam struct { + ID int64 `json:"id"` + URL string `json:"url"` + MemberURL string `json:"member_url"` + Name string `json:"name"` + Description *string `json:"description,omitempty"` + HTMLURL string `json:"html_url"` + Slug string `json:"slug"` + CreatedAt Timestamp `json:"created_at"` + UpdatedAt Timestamp `json:"updated_at"` + GroupID string `json:"group_id"` + OrganizationSelectionType *string `json:"organization_selection_type,omitempty"` +} + +// EnterpriseTeamCreateOrUpdateRequest is used to create or update an enterprise team. +type EnterpriseTeamCreateOrUpdateRequest struct { + // The name of the team. + Name string `json:"name"` + // A description of the team. + Description *string `json:"description,omitempty"` + // Specifies which organizations in the enterprise should have access to this team. + // Possible values are "disabled" , "all" and "selected". If not specified, the default is "disabled". + OrganizationSelectionType *string `json:"organization_selection_type,omitempty"` + // The ID of the IdP group to assign team membership with. + GroupID *string `json:"group_id,omitempty"` +} + +// ListTeams lists all teams in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-teams#list-enterprise-teams +// +//meta:operation GET /enterprises/{enterprise}/teams +func (s *EnterpriseService) ListTeams(ctx context.Context, enterprise string, opts *ListOptions) ([]*EnterpriseTeam, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var teams []*EnterpriseTeam + resp, err := s.client.Do(ctx, req, &teams) + if err != nil { + return nil, resp, err + } + + return teams, resp, nil +} + +// CreateTeam creates a new team in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-teams#create-an-enterprise-team +// +//meta:operation POST /enterprises/{enterprise}/teams +func (s *EnterpriseService) CreateTeam(ctx context.Context, enterprise string, team EnterpriseTeamCreateOrUpdateRequest) (*EnterpriseTeam, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams", enterprise) + + req, err := s.client.NewRequest("POST", u, team) + if err != nil { + return nil, nil, err + } + + var createdTeam *EnterpriseTeam + resp, err := s.client.Do(ctx, req, &createdTeam) + if err != nil { + return nil, resp, err + } + + return createdTeam, resp, nil +} + +// GetTeam retrieves a team in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-teams#get-an-enterprise-team +// +//meta:operation GET /enterprises/{enterprise}/teams/{team_slug} +func (s *EnterpriseService) GetTeam(ctx context.Context, enterprise, teamSlug string) (*EnterpriseTeam, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v", enterprise, teamSlug) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var team *EnterpriseTeam + resp, err := s.client.Do(ctx, req, &team) + if err != nil { + return nil, resp, err + } + + return team, resp, nil +} + +// UpdateTeam updates a team in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-teams#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) { + u := fmt.Sprintf("enterprises/%v/teams/%v", enterprise, teamSlug) + + req, err := s.client.NewRequest("PATCH", u, team) + if err != nil { + return nil, nil, err + } + + var updatedTeam *EnterpriseTeam + resp, err := s.client.Do(ctx, req, &updatedTeam) + if err != nil { + return nil, resp, err + } + + return updatedTeam, resp, nil +} + +// DeleteTeam deletes a team in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-teams#delete-an-enterprise-team +// +//meta:operation DELETE /enterprises/{enterprise}/teams/{team_slug} +func (s *EnterpriseService) DeleteTeam(ctx context.Context, enterprise, teamSlug string) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v", enterprise, teamSlug) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// ListTeamMembers lists all members of an enterprise team. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-members#list-members-in-an-enterprise-team +// +//meta:operation GET /enterprises/{enterprise}/teams/{enterprise-team}/memberships +func (s *EnterpriseService) ListTeamMembers(ctx context.Context, enterprise, enterpriseTeam string, opts *ListOptions) ([]*User, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/memberships", enterprise, enterpriseTeam) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var members []*User + resp, err := s.client.Do(ctx, req, &members) + if err != nil { + return nil, resp, err + } + + return members, resp, nil +} + +// BulkAddTeamMembers adds multiple members to an enterprise team. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-members#bulk-add-team-members +// +//meta:operation POST /enterprises/{enterprise}/teams/{enterprise-team}/memberships/add +func (s *EnterpriseService) BulkAddTeamMembers(ctx context.Context, enterprise, enterpriseTeam string, username []string) ([]*User, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/memberships/add", enterprise, enterpriseTeam) + req, err := s.client.NewRequest("POST", u, map[string][]string{"usernames": username}) + if err != nil { + return nil, nil, err + } + + var members []*User + resp, err := s.client.Do(ctx, req, &members) + if err != nil { + return nil, resp, err + } + + return members, resp, nil +} + +// BulkRemoveTeamMembers removes multiple members from an enterprise team. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-members#bulk-remove-team-members +// +//meta:operation POST /enterprises/{enterprise}/teams/{enterprise-team}/memberships/remove +func (s *EnterpriseService) BulkRemoveTeamMembers(ctx context.Context, enterprise, enterpriseTeam string, username []string) ([]*User, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/memberships/remove", enterprise, enterpriseTeam) + req, err := s.client.NewRequest("POST", u, map[string][]string{"usernames": username}) + if err != nil { + return nil, nil, err + } + + var members []*User + resp, err := s.client.Do(ctx, req, &members) + if err != nil { + return nil, resp, err + } + + return members, resp, nil +} + +// GetTeamMembership retrieves a team membership for a user in an enterprise team. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-members#get-enterprise-team-membership +// +//meta:operation GET /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username} +func (s *EnterpriseService) GetTeamMembership(ctx context.Context, enterprise, enterpriseTeam, username string) (*User, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/memberships/%v", enterprise, enterpriseTeam, username) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var membership *User + resp, err := s.client.Do(ctx, req, &membership) + if err != nil { + return nil, resp, err + } + + return membership, resp, nil +} + +// AddTeamMember adds a member to an enterprise team. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-members#add-team-member +// +//meta:operation PUT /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username} +func (s *EnterpriseService) AddTeamMember(ctx context.Context, enterprise, enterpriseTeam, username string) (*User, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/memberships/%v", enterprise, enterpriseTeam, username) + + req, err := s.client.NewRequest("PUT", u, nil) + if err != nil { + return nil, nil, err + } + + var member *User + resp, err := s.client.Do(ctx, req, &member) + if err != nil { + return nil, resp, err + } + + return member, resp, nil +} + +// RemoveTeamMember removes a member from an enterprise team. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-members#remove-team-membership +// +//meta:operation DELETE /enterprises/{enterprise}/teams/{enterprise-team}/memberships/{username} +func (s *EnterpriseService) RemoveTeamMember(ctx context.Context, enterprise, enterpriseTeam, username string) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/memberships/%v", enterprise, enterpriseTeam, username) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// ListAssignments gets all organizations assigned to an enterprise team. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-organizations#get-organization-assignments +// +//meta:operation GET /enterprises/{enterprise}/teams/{enterprise-team}/organizations +func (s *EnterpriseService) ListAssignments(ctx context.Context, enterprise, enterpriseTeam string, opts *ListOptions) ([]*Organization, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/organizations", enterprise, enterpriseTeam) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var orgs []*Organization + resp, err := s.client.Do(ctx, req, &orgs) + if err != nil { + return nil, resp, err + } + + return orgs, resp, nil +} + +// AddMultipleAssignments assigns an enterprise team to multiple organizations. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-organizations#add-organization-assignments +// +//meta:operation POST /enterprises/{enterprise}/teams/{enterprise-team}/organizations/add +func (s *EnterpriseService) AddMultipleAssignments(ctx context.Context, enterprise, enterpriseTeam string, organizationSlugs []string) ([]*Organization, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/organizations/add", enterprise, enterpriseTeam) + + req, err := s.client.NewRequest("POST", u, map[string][]string{"organization_slugs": organizationSlugs}) + if err != nil { + return nil, nil, err + } + + var orgs []*Organization + resp, err := s.client.Do(ctx, req, &orgs) + if err != nil { + return nil, resp, err + } + + return orgs, resp, nil +} + +// RemoveMultipleAssignments unassigns an enterprise team from multiple organizations. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-organizations#remove-organization-assignments +// +//meta:operation POST /enterprises/{enterprise}/teams/{enterprise-team}/organizations/remove +func (s *EnterpriseService) RemoveMultipleAssignments(ctx context.Context, enterprise, enterpriseTeam string, organizationSlugs []string) ([]*Organization, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/organizations/remove", enterprise, enterpriseTeam) + + req, err := s.client.NewRequest("POST", u, map[string][]string{"organization_slugs": organizationSlugs}) + if err != nil { + return nil, nil, err + } + + var orgs []*Organization + resp, err := s.client.Do(ctx, req, &orgs) + if err != nil { + return nil, resp, err + } + + return orgs, resp, nil +} + +// GetAssignment checks if an enterprise team is assigned to an organization. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-organizations#get-organization-assignment +// +//meta:operation GET /enterprises/{enterprise}/teams/{enterprise-team}/organizations/{org} +func (s *EnterpriseService) GetAssignment(ctx context.Context, enterprise, enterpriseTeam, org string) (*Organization, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/organizations/%v", enterprise, enterpriseTeam, org) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var organization *Organization + resp, err := s.client.Do(ctx, req, &organization) + if err != nil { + return nil, resp, err + } + + return organization, resp, nil +} + +// AddAssignment assigns an enterprise team to an organizations. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-organizations#add-an-organization-assignment +// +//meta:operation PUT /enterprises/{enterprise}/teams/{enterprise-team}/organizations/{org} +func (s *EnterpriseService) AddAssignment(ctx context.Context, enterprise, enterpriseTeam, org string) (*Organization, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/organizations/%v", enterprise, enterpriseTeam, org) + + req, err := s.client.NewRequest("PUT", u, nil) + if err != nil { + return nil, nil, err + } + + var organization *Organization + resp, err := s.client.Do(ctx, req, &organization) + if err != nil { + return nil, resp, err + } + + return organization, resp, nil +} + +// RemoveAssignment unassigns an enterprise team from an organizations. +// +// GitHub API docs: https://docs.github.com/rest/enterprise-teams/enterprise-team-organizations#delete-an-organization-assignment +// +//meta:operation DELETE /enterprises/{enterprise}/teams/{enterprise-team}/organizations/{org} +func (s *EnterpriseService) RemoveAssignment(ctx context.Context, enterprise, enterpriseTeam, org string) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v/organizations/%v", enterprise, enterpriseTeam, org) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v75/github/event.go b/vendor/github.com/google/go-github/v84/github/event.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/event.go rename to vendor/github.com/google/go-github/v84/github/event.go diff --git a/vendor/github.com/google/go-github/v75/github/event_types.go b/vendor/github.com/google/go-github/v84/github/event_types.go similarity index 97% rename from vendor/github.com/google/go-github/v75/github/event_types.go rename to vendor/github.com/google/go-github/v84/github/event_types.go index 480ed8dfb..2a085d47b 100644 --- a/vendor/github.com/google/go-github/v75/github/event_types.go +++ b/vendor/github.com/google/go-github/v84/github/event_types.go @@ -265,7 +265,7 @@ type DeploymentProtectionRuleEvent struct { Environment *string `json:"environment,omitempty"` Event *string `json:"event,omitempty"` - // The URL Github provides for a third-party to use in order to pass/fail a deployment gate + // The URL GitHub provides for a third-party to use in order to pass/fail a deployment gate DeploymentCallbackURL *string `json:"deployment_callback_url,omitempty"` Deployment *Deployment `json:"deployment,omitempty"` Repo *Repository `json:"repository,omitempty"` @@ -859,7 +859,7 @@ type MergeGroup struct { HeadRef *string `json:"head_ref,omitempty"` // The SHA of the merge group's parent commit. BaseSHA *string `json:"base_sha,omitempty"` - // The full ref of the branch the merge group will be merged into. + // The full ref of the branch into which the merge group will be merged. BaseRef *string `json:"base_ref,omitempty"` // An expanded representation of the head_sha commit. HeadCommit *Commit `json:"head_commit,omitempty"` @@ -1111,35 +1111,6 @@ type ProjectV2Event struct { Sender *User `json:"sender,omitempty"` } -// ProjectV2 represents a v2 project. -type ProjectV2 struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Owner *User `json:"owner,omitempty"` - Creator *User `json:"creator,omitempty"` - Title *string `json:"title,omitempty"` - Description *string `json:"description,omitempty"` - Public *bool `json:"public,omitempty"` - ClosedAt *Timestamp `json:"closed_at,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - DeletedAt *Timestamp `json:"deleted_at,omitempty"` - Number *int `json:"number,omitempty"` - ShortDescription *string `json:"short_description,omitempty"` - DeletedBy *User `json:"deleted_by,omitempty"` - - // Fields migrated from the Project (classic) struct: - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - ColumnsURL *string `json:"columns_url,omitempty"` - OwnerURL *string `json:"owner_url,omitempty"` - Name *string `json:"name,omitempty"` - Body *string `json:"body,omitempty"` - State *string `json:"state,omitempty"` - OrganizationPermission *string `json:"organization_permission,omitempty"` - Private *bool `json:"private,omitempty"` -} - // ProjectV2ItemEvent is triggered when there is activity relating to an item on an organization-level project. // The Webhook event name is "projects_v2_item". // @@ -1177,19 +1148,6 @@ type FieldValue struct { To json.RawMessage `json:"to,omitempty"` } -// ProjectV2Item represents an item belonging to a project. -type ProjectV2Item struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - ProjectNodeID *string `json:"project_node_id,omitempty"` - ContentNodeID *string `json:"content_node_id,omitempty"` - ContentType *string `json:"content_type,omitempty"` - Creator *User `json:"creator,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - ArchivedAt *Timestamp `json:"archived_at,omitempty"` -} - // PublicEvent is triggered when a private repository is open sourced. // According to GitHub: "Without a doubt: the best GitHub event." // The Webhook event name is "public". @@ -1237,7 +1195,8 @@ type PullRequestEvent struct { Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` - Label *Label `json:"label,omitempty"` // Populated in "labeled" event deliveries. + Label *Label `json:"label,omitempty"` // Populated in "labeled" event deliveries. + Reason *string `json:"reason,omitempty"` // Populated in "dequeued" event deliveries. // The following field is only present when the webhook is triggered on // a repository belonging to an organization. @@ -1377,7 +1336,8 @@ type PushEvent struct { Size *int `json:"size,omitempty"` // Commits is the list of commits in the push event. // - // Deprecated: GitHub will remove commit summaries from Events API payloads on October 7, 2025. + // This field is only populated for webhook events. + // It has been removed from Events API payloads on October 7, 2025. // Use the Commits REST API endpoint to get detailed commit information. // See: https://docs.github.com/rest/commits/commits#list-commits Commits []*HeadCommit `json:"commits,omitempty"` @@ -1873,7 +1833,7 @@ type WatchEvent struct { } // WorkflowDispatchEvent is triggered when someone triggers a workflow run on GitHub or -// sends a POST request to the create a workflow dispatch event endpoint. +// sends a POST request to the endpoint to create a workflow dispatch event. // // GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch type WorkflowDispatchEvent struct { diff --git a/vendor/github.com/google/go-github/v75/github/gists.go b/vendor/github.com/google/go-github/v84/github/gists.go similarity index 99% rename from vendor/github.com/google/go-github/v75/github/gists.go rename to vendor/github.com/google/go-github/v84/github/gists.go index ee4314b98..8b5dd47d8 100644 --- a/vendor/github.com/google/go-github/v75/github/gists.go +++ b/vendor/github.com/google/go-github/v84/github/gists.go @@ -97,6 +97,7 @@ type GistListOptions struct { // user. // // GitHub API docs: https://docs.github.com/rest/gists/gists#list-gists-for-a-user +// // GitHub API docs: https://docs.github.com/rest/gists/gists#list-gists-for-the-authenticated-user // //meta:operation GET /gists diff --git a/vendor/github.com/google/go-github/v75/github/gists_comments.go b/vendor/github.com/google/go-github/v84/github/gists_comments.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/gists_comments.go rename to vendor/github.com/google/go-github/v84/github/gists_comments.go diff --git a/vendor/github.com/google/go-github/v75/github/git.go b/vendor/github.com/google/go-github/v84/github/git.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/git.go rename to vendor/github.com/google/go-github/v84/github/git.go diff --git a/vendor/github.com/google/go-github/v75/github/git_blobs.go b/vendor/github.com/google/go-github/v84/github/git_blobs.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/git_blobs.go rename to vendor/github.com/google/go-github/v84/github/git_blobs.go diff --git a/vendor/github.com/google/go-github/v75/github/git_commits.go b/vendor/github.com/google/go-github/v84/github/git_commits.go similarity index 96% rename from vendor/github.com/google/go-github/v75/github/git_commits.go rename to vendor/github.com/google/go-github/v84/github/git_commits.go index 4da15bb0d..5bf6cf7aa 100644 --- a/vendor/github.com/google/go-github/v75/github/git_commits.go +++ b/vendor/github.com/google/go-github/v84/github/git_commits.go @@ -202,14 +202,14 @@ func createSignatureMessage(commit *createCommit) (string, error) { var message []string if commit.Tree != nil { - message = append(message, fmt.Sprintf("tree %s", *commit.Tree)) + message = append(message, fmt.Sprintf("tree %v", *commit.Tree)) } for _, parent := range commit.Parents { - message = append(message, fmt.Sprintf("parent %s", parent)) + message = append(message, fmt.Sprintf("parent %v", parent)) } - message = append(message, fmt.Sprintf("author %s <%s> %d %s", commit.Author.GetName(), commit.Author.GetEmail(), commit.Author.GetDate().Unix(), commit.Author.GetDate().Format("-0700"))) + message = append(message, fmt.Sprintf("author %v <%v> %v %v", commit.Author.GetName(), commit.Author.GetEmail(), commit.Author.GetDate().Unix(), commit.Author.GetDate().Format("-0700"))) committer := commit.Committer if committer == nil { @@ -217,7 +217,7 @@ func createSignatureMessage(commit *createCommit) (string, error) { } // There needs to be a double newline after committer - message = append(message, fmt.Sprintf("committer %s <%s> %d %s\n", committer.GetName(), committer.GetEmail(), committer.GetDate().Unix(), committer.GetDate().Format("-0700"))) + message = append(message, fmt.Sprintf("committer %v <%v> %v %v\n", committer.GetName(), committer.GetEmail(), committer.GetDate().Unix(), committer.GetDate().Format("-0700"))) message = append(message, *commit.Message) return strings.Join(message, "\n"), nil diff --git a/vendor/github.com/google/go-github/v75/github/git_refs.go b/vendor/github.com/google/go-github/v84/github/git_refs.go similarity index 90% rename from vendor/github.com/google/go-github/v75/github/git_refs.go rename to vendor/github.com/google/go-github/v84/github/git_refs.go index 735aef006..bca7741d9 100644 --- a/vendor/github.com/google/go-github/v75/github/git_refs.go +++ b/vendor/github.com/google/go-github/v84/github/git_refs.go @@ -82,31 +82,17 @@ func refURLEscape(ref string) string { return strings.Join(parts, "/") } -// ReferenceListOptions specifies optional parameters to the -// GitService.ListMatchingRefs method. -type ReferenceListOptions struct { - // The ref must be formatted as `heads/` for branches and `tags/` for tags. - Ref string `url:"-"` - - ListOptions -} - // ListMatchingRefs lists references in a repository that match a supplied ref. +// The ref in the URL must be formatted as `heads/` for branches and `tags/` for tags. +// If the ref doesn't exist in the repository, but existing refs start with ref, they will be returned as an array. // Use an empty ref to list all references. // // GitHub API docs: https://docs.github.com/rest/git/refs#list-matching-references // //meta:operation GET /repos/{owner}/{repo}/git/matching-refs/{ref} -func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo string, opts *ReferenceListOptions) ([]*Reference, *Response, error) { - var ref string - if opts != nil { - ref = strings.TrimPrefix(opts.Ref, "refs/") - } +func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo, ref string) ([]*Reference, *Response, error) { + ref = strings.TrimPrefix(ref, "refs/") // API expects no "refs/" prefix u := fmt.Sprintf("repos/%v/%v/git/matching-refs/%v", owner, repo, refURLEscape(ref)) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } req, err := s.client.NewRequest("GET", u, nil) if err != nil { diff --git a/vendor/github.com/google/go-github/v75/github/git_tags.go b/vendor/github.com/google/go-github/v84/github/git_tags.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/git_tags.go rename to vendor/github.com/google/go-github/v84/github/git_tags.go diff --git a/vendor/github.com/google/go-github/v75/github/git_trees.go b/vendor/github.com/google/go-github/v84/github/git_trees.go similarity index 85% rename from vendor/github.com/google/go-github/v75/github/git_trees.go rename to vendor/github.com/google/go-github/v84/github/git_trees.go index 2b701a3c6..2ff0dc592 100644 --- a/vendor/github.com/google/go-github/v75/github/git_trees.go +++ b/vendor/github.com/google/go-github/v84/github/git_trees.go @@ -30,6 +30,13 @@ func (t Tree) String() string { // TreeEntry represents the contents of a tree structure. TreeEntry can // represent either a blob, a commit (in the case of a submodule), or another // tree. +// +// When used with [GitService.CreateTree], set Content for small text files, +// or set SHA to reference an existing blob (use [GitService.CreateBlob] for +// binary files or large content). To delete an entry, set both Content and SHA +// to nil; the entry will be serialized with `"sha": null` which the API interprets +// as a deletion. When deleting, the Type and Mode fields are ignored; only Path +// is required. type TreeEntry struct { SHA *string `json:"sha,omitempty"` Path *string `json:"path,omitempty"` @@ -127,6 +134,12 @@ type createTree struct { // path modifying that tree are specified, it will overwrite the contents of // that tree with the new path contents and write a new tree out. // +// When baseTree is provided, entries are merged with that tree: paths not +// mentioned in entries are preserved from the base tree. If the same path +// appears multiple times in entries, the last entry wins. To delete an entry, +// include a [TreeEntry] with the path and both SHA and Content set to nil. +// Entire directories can be deleted this way. +// // GitHub API docs: https://docs.github.com/rest/git/trees#create-a-tree // //meta:operation POST /repos/{owner}/{repo}/git/trees diff --git a/vendor/github.com/google/go-github/v75/github/github-accessors.go b/vendor/github.com/google/go-github/v84/github/github-accessors.go similarity index 91% rename from vendor/github.com/google/go-github/v75/github/github-accessors.go rename to vendor/github.com/google/go-github/v84/github/github-accessors.go index 3de23373e..70b20e70d 100644 --- a/vendor/github.com/google/go-github/v75/github/github-accessors.go +++ b/vendor/github.com/google/go-github/v84/github/github-accessors.go @@ -1,12 +1,12 @@ +// Code generated by gen-accessors; DO NOT EDIT. +// Instead, please run "go generate ./..." as described here: +// https://github.com/google/go-github/blob/master/CONTRIBUTING.md#submitting-a-patch + // Copyright 2017 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. -// Code generated by gen-accessors; DO NOT EDIT. -// Instead, please run "go generate ./..." as described here: -// https://github.com/google/go-github/blob/master/CONTRIBUTING.md#submitting-a-patch - package github import ( @@ -22,6 +22,62 @@ func (a *AbuseRateLimitError) GetRetryAfter() time.Duration { return *a.RetryAfter } +// GetAssignment returns the Assignment field. +func (a *AcceptedAssignment) GetAssignment() *ClassroomAssignment { + if a == nil { + return nil + } + return a.Assignment +} + +// GetCommitCount returns the CommitCount field if it's non-nil, zero value otherwise. +func (a *AcceptedAssignment) GetCommitCount() int { + if a == nil || a.CommitCount == nil { + return 0 + } + return *a.CommitCount +} + +// GetGrade returns the Grade field if it's non-nil, zero value otherwise. +func (a *AcceptedAssignment) GetGrade() string { + if a == nil || a.Grade == nil { + return "" + } + return *a.Grade +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (a *AcceptedAssignment) GetID() int64 { + if a == nil || a.ID == nil { + return 0 + } + return *a.ID +} + +// GetPassing returns the Passing field if it's non-nil, zero value otherwise. +func (a *AcceptedAssignment) GetPassing() bool { + if a == nil || a.Passing == nil { + return false + } + return *a.Passing +} + +// GetRepository returns the Repository field. +func (a *AcceptedAssignment) GetRepository() *Repository { + if a == nil { + return nil + } + return a.Repository +} + +// GetSubmitted returns the Submitted field if it's non-nil, zero value otherwise. +func (a *AcceptedAssignment) GetSubmitted() bool { + if a == nil || a.Submitted == nil { + return false + } + return *a.Submitted +} + // GetGithubOwnedAllowed returns the GithubOwnedAllowed field if it's non-nil, zero value otherwise. func (a *ActionsAllowed) GetGithubOwnedAllowed() bool { if a == nil || a.GithubOwnedAllowed == nil { @@ -150,6 +206,14 @@ func (a *ActionsPermissions) GetSelectedActionsURL() string { return *a.SelectedActionsURL } +// GetSHAPinningRequired returns the SHAPinningRequired field if it's non-nil, zero value otherwise. +func (a *ActionsPermissions) GetSHAPinningRequired() bool { + if a == nil || a.SHAPinningRequired == nil { + return false + } + return *a.SHAPinningRequired +} + // GetAllowedActions returns the AllowedActions field if it's non-nil, zero value otherwise. func (a *ActionsPermissionsEnterprise) GetAllowedActions() string { if a == nil || a.AllowedActions == nil { @@ -198,6 +262,14 @@ func (a *ActionsPermissionsRepository) GetSelectedActionsURL() string { return *a.SelectedActionsURL } +// GetSHAPinningRequired returns the SHAPinningRequired field if it's non-nil, zero value otherwise. +func (a *ActionsPermissionsRepository) GetSHAPinningRequired() bool { + if a == nil || a.SHAPinningRequired == nil { + return false + } + return *a.SHAPinningRequired +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (a *ActionsVariable) GetCreatedAt() Timestamp { if a == nil || a.CreatedAt == nil { @@ -238,6 +310,46 @@ func (a *ActionsVariable) GetVisibility() string { return *a.Visibility } +// GetMaximumAdvancedSecurityCommitters returns the MaximumAdvancedSecurityCommitters field if it's non-nil, zero value otherwise. +func (a *ActiveCommitters) GetMaximumAdvancedSecurityCommitters() int { + if a == nil || a.MaximumAdvancedSecurityCommitters == nil { + return 0 + } + return *a.MaximumAdvancedSecurityCommitters +} + +// GetPurchasedAdvancedSecurityCommitters returns the PurchasedAdvancedSecurityCommitters field if it's non-nil, zero value otherwise. +func (a *ActiveCommitters) GetPurchasedAdvancedSecurityCommitters() int { + if a == nil || a.PurchasedAdvancedSecurityCommitters == nil { + return 0 + } + return *a.PurchasedAdvancedSecurityCommitters +} + +// GetTotalAdvancedSecurityCommitters returns the TotalAdvancedSecurityCommitters field if it's non-nil, zero value otherwise. +func (a *ActiveCommitters) GetTotalAdvancedSecurityCommitters() int { + if a == nil || a.TotalAdvancedSecurityCommitters == nil { + return 0 + } + return *a.TotalAdvancedSecurityCommitters +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (a *ActiveCommitters) GetTotalCount() int { + if a == nil || a.TotalCount == nil { + return 0 + } + return *a.TotalCount +} + +// GetAdvancedSecurityProduct returns the AdvancedSecurityProduct field if it's non-nil, zero value otherwise. +func (a *ActiveCommittersListOptions) GetAdvancedSecurityProduct() string { + if a == nil || a.AdvancedSecurityProduct == nil { + return "" + } + return *a.AdvancedSecurityProduct +} + // GetCountryCode returns the CountryCode field if it's non-nil, zero value otherwise. func (a *ActorLocation) GetCountryCode() string { if a == nil || a.CountryCode == nil { @@ -246,6 +358,30 @@ func (a *ActorLocation) GetCountryCode() string { return *a.CountryCode } +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (a *AddProjectItemOptions) GetID() int64 { + if a == nil || a.ID == nil { + return 0 + } + return *a.ID +} + +// GetType returns the Type field. +func (a *AddProjectItemOptions) GetType() *ProjectV2ItemContentType { + if a == nil { + return nil + } + return a.Type +} + +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (a *AddResourcesToCostCenterResponse) GetMessage() string { + if a == nil || a.Message == nil { + return "" + } + return *a.Message +} + // GetFrom returns the From field if it's non-nil, zero value otherwise. func (a *AdminEnforcedChanges) GetFrom() bool { if a == nil || a.From == nil { @@ -350,22 +486,6 @@ func (a *AdvancedSecurity) GetStatus() string { return *a.Status } -// GetLastPushedDate returns the LastPushedDate field if it's non-nil, zero value otherwise. -func (a *AdvancedSecurityCommittersBreakdown) GetLastPushedDate() string { - if a == nil || a.LastPushedDate == nil { - return "" - } - return *a.LastPushedDate -} - -// GetUserLogin returns the UserLogin field if it's non-nil, zero value otherwise. -func (a *AdvancedSecurityCommittersBreakdown) GetUserLogin() string { - if a == nil || a.UserLogin == nil { - return "" - } - return *a.UserLogin -} - // GetScore returns the Score field. func (a *AdvisoryCVSS) GetScore() *float64 { if a == nil { @@ -686,6 +806,14 @@ func (a *APIMeta) GetVerifiablePasswordAuthentication() bool { return *a.VerifiablePasswordAuthentication } +// GetActionsInbound returns the ActionsInbound field. +func (a *APIMetaDomains) GetActionsInbound() *ActionsInboundDomains { + if a == nil { + return nil + } + return a.ActionsInbound +} + // GetArtifactAttestations returns the ArtifactAttestations field. func (a *APIMetaDomains) GetArtifactAttestations() *APIMetaArtifactAttestations { if a == nil { @@ -1014,6 +1142,94 @@ func (a *Artifact) GetWorkflowRun() *ArtifactWorkflowRun { return a.WorkflowRun } +// GetAttestationID returns the AttestationID field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentRecord) GetAttestationID() int64 { + if a == nil || a.AttestationID == nil { + return 0 + } + return *a.AttestationID +} + +// GetCluster returns the Cluster field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentRecord) GetCluster() string { + if a == nil || a.Cluster == nil { + return "" + } + return *a.Cluster +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentRecord) GetCreatedAt() Timestamp { + if a == nil || a.CreatedAt == nil { + return Timestamp{} + } + return *a.CreatedAt +} + +// GetDeploymentName returns the DeploymentName field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentRecord) GetDeploymentName() string { + if a == nil || a.DeploymentName == nil { + return "" + } + return *a.DeploymentName +} + +// GetDigest returns the Digest field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentRecord) GetDigest() string { + if a == nil || a.Digest == nil { + return "" + } + return *a.Digest +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentRecord) GetID() int64 { + if a == nil || a.ID == nil { + return 0 + } + return *a.ID +} + +// GetLogicalEnvironment returns the LogicalEnvironment field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentRecord) GetLogicalEnvironment() string { + if a == nil || a.LogicalEnvironment == nil { + return "" + } + return *a.LogicalEnvironment +} + +// GetPhysicalEnvironment returns the PhysicalEnvironment field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentRecord) GetPhysicalEnvironment() string { + if a == nil || a.PhysicalEnvironment == nil { + return "" + } + return *a.PhysicalEnvironment +} + +// GetTags returns the Tags map if it's non-nil, an empty map otherwise. +func (a *ArtifactDeploymentRecord) GetTags() map[string]string { + if a == nil || a.Tags == nil { + return map[string]string{} + } + return a.Tags +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentRecord) GetUpdatedAt() Timestamp { + if a == nil || a.UpdatedAt == nil { + return Timestamp{} + } + return *a.UpdatedAt +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (a *ArtifactDeploymentResponse) GetTotalCount() int { + if a == nil || a.TotalCount == nil { + return 0 + } + return *a.TotalCount +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (a *ArtifactList) GetTotalCount() int64 { if a == nil || a.TotalCount == nil { @@ -1046,6 +1262,86 @@ func (a *ArtifactPeriodOpt) GetDays() int { return *a.Days } +// GetArtifactURL returns the ArtifactURL field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageRecord) GetArtifactURL() string { + if a == nil || a.ArtifactURL == nil { + return "" + } + return *a.ArtifactURL +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageRecord) GetCreatedAt() Timestamp { + if a == nil || a.CreatedAt == nil { + return Timestamp{} + } + return *a.CreatedAt +} + +// GetDigest returns the Digest field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageRecord) GetDigest() string { + if a == nil || a.Digest == nil { + return "" + } + return *a.Digest +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageRecord) GetID() int64 { + if a == nil || a.ID == nil { + return 0 + } + return *a.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageRecord) GetName() string { + if a == nil || a.Name == nil { + return "" + } + return *a.Name +} + +// GetRegistryURL returns the RegistryURL field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageRecord) GetRegistryURL() string { + if a == nil || a.RegistryURL == nil { + return "" + } + return *a.RegistryURL +} + +// GetRepository returns the Repository field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageRecord) GetRepository() string { + if a == nil || a.Repository == nil { + return "" + } + return *a.Repository +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageRecord) GetStatus() string { + if a == nil || a.Status == nil { + return "" + } + return *a.Status +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageRecord) GetUpdatedAt() Timestamp { + if a == nil || a.UpdatedAt == nil { + return Timestamp{} + } + return *a.UpdatedAt +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (a *ArtifactStorageResponse) GetTotalCount() int { + if a == nil || a.TotalCount == nil { + return 0 + } + return *a.TotalCount +} + // GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise. func (a *ArtifactWorkflowRun) GetHeadBranch() string { if a == nil || a.HeadBranch == nil { @@ -1086,49 +1382,137 @@ func (a *ArtifactWorkflowRun) GetRepositoryID() int64 { return *a.RepositoryID } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (a *Attachment) GetBody() string { - if a == nil || a.Body == nil { +// GetAssignmentName returns the AssignmentName field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetAssignmentName() string { + if a == nil || a.AssignmentName == nil { return "" } - return *a.Body + return *a.AssignmentName } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (a *Attachment) GetID() int64 { - if a == nil || a.ID == nil { - return 0 +// GetAssignmentURL returns the AssignmentURL field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetAssignmentURL() string { + if a == nil || a.AssignmentURL == nil { + return "" } - return *a.ID + return *a.AssignmentURL } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (a *Attachment) GetTitle() string { - if a == nil || a.Title == nil { +// GetGithubUsername returns the GithubUsername field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetGithubUsername() string { + if a == nil || a.GithubUsername == nil { return "" } - return *a.Title + return *a.GithubUsername } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetAction() string { - if a == nil || a.Action == nil { +// GetGroupName returns the GroupName field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetGroupName() string { + if a == nil || a.GroupName == nil { return "" } - return *a.Action + return *a.GroupName } -// GetActor returns the Actor field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetActor() string { - if a == nil || a.Actor == nil { - return "" +// GetPointsAvailable returns the PointsAvailable field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetPointsAvailable() int { + if a == nil || a.PointsAvailable == nil { + return 0 } - return *a.Actor + return *a.PointsAvailable } -// GetActorID returns the ActorID field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetActorID() int64 { - if a == nil || a.ActorID == nil { +// GetPointsAwarded returns the PointsAwarded field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetPointsAwarded() int { + if a == nil || a.PointsAwarded == nil { + return 0 + } + return *a.PointsAwarded +} + +// GetRosterIdentifier returns the RosterIdentifier field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetRosterIdentifier() string { + if a == nil || a.RosterIdentifier == nil { + return "" + } + return *a.RosterIdentifier +} + +// GetStarterCodeURL returns the StarterCodeURL field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetStarterCodeURL() string { + if a == nil || a.StarterCodeURL == nil { + return "" + } + return *a.StarterCodeURL +} + +// GetStudentRepositoryName returns the StudentRepositoryName field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetStudentRepositoryName() string { + if a == nil || a.StudentRepositoryName == nil { + return "" + } + return *a.StudentRepositoryName +} + +// GetStudentRepositoryURL returns the StudentRepositoryURL field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetStudentRepositoryURL() string { + if a == nil || a.StudentRepositoryURL == nil { + return "" + } + return *a.StudentRepositoryURL +} + +// GetSubmissionTimestamp returns the SubmissionTimestamp field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetSubmissionTimestamp() Timestamp { + if a == nil || a.SubmissionTimestamp == nil { + return Timestamp{} + } + return *a.SubmissionTimestamp +} + +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (a *Attachment) GetBody() string { + if a == nil || a.Body == nil { + return "" + } + return *a.Body +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (a *Attachment) GetID() int64 { + if a == nil || a.ID == nil { + return 0 + } + return *a.ID +} + +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (a *Attachment) GetTitle() string { + if a == nil || a.Title == nil { + return "" + } + return *a.Title +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetAction() string { + if a == nil || a.Action == nil { + return "" + } + return *a.Action +} + +// GetActor returns the Actor field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetActor() string { + if a == nil || a.Actor == nil { + return "" + } + return *a.Actor +} + +// GetActorID returns the ActorID field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetActorID() int64 { + if a == nil || a.ActorID == nil { return 0 } return *a.ActorID @@ -2014,6 +2398,14 @@ func (b *BypassActor) GetBypassMode() *BypassMode { return b.BypassMode } +// GetSecurityConfigurationID returns the SecurityConfigurationID field if it's non-nil, zero value otherwise. +func (b *BypassReviewer) GetSecurityConfigurationID() int64 { + if b == nil || b.SecurityConfigurationID == nil { + return 0 + } + return *b.SecurityConfigurationID +} + // GetApp returns the App field. func (c *CheckRun) GetApp() *App { if c == nil { @@ -2718,6 +3110,70 @@ func (c *ClassroomAssignment) GetType() string { return *c.Type } +// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. +func (c *ClassroomUser) GetAvatarURL() string { + if c == nil || c.AvatarURL == nil { + return "" + } + return *c.AvatarURL +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (c *ClassroomUser) GetHTMLURL() string { + if c == nil || c.HTMLURL == nil { + return "" + } + return *c.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *ClassroomUser) GetID() int64 { + if c == nil || c.ID == nil { + return 0 + } + return *c.ID +} + +// GetLogin returns the Login field if it's non-nil, zero value otherwise. +func (c *ClassroomUser) GetLogin() string { + if c == nil || c.Login == nil { + return "" + } + return *c.Login +} + +// GetGithubRepository returns the GithubRepository field if it's non-nil, zero value otherwise. +func (c *ClusterArtifactDeployment) GetGithubRepository() string { + if c == nil || c.GithubRepository == nil { + return "" + } + return *c.GithubRepository +} + +// GetTags returns the Tags map if it's non-nil, an empty map otherwise. +func (c *ClusterArtifactDeployment) GetTags() map[string]string { + if c == nil || c.Tags == nil { + return map[string]string{} + } + return c.Tags +} + +// GetVersion returns the Version field if it's non-nil, zero value otherwise. +func (c *ClusterArtifactDeployment) GetVersion() string { + if c == nil || c.Version == nil { + return "" + } + return *c.Version +} + +// GetPhysicalEnvironment returns the PhysicalEnvironment field if it's non-nil, zero value otherwise. +func (c *ClusterDeploymentRecordsRequest) GetPhysicalEnvironment() string { + if c == nil || c.PhysicalEnvironment == nil { + return "" + } + return *c.PhysicalEnvironment +} + // GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. func (c *ClusterSSHKey) GetFingerprint() string { if c == nil || c.Fingerprint == nil { @@ -3014,6 +3470,22 @@ func (c *CodeScanningAlertState) GetDismissedReason() string { return *c.DismissedReason } +// GetRunnerLabel returns the RunnerLabel field if it's non-nil, zero value otherwise. +func (c *CodeScanningDefaultSetupOptions) GetRunnerLabel() string { + if c == nil || c.RunnerLabel == nil { + return "" + } + return *c.RunnerLabel +} + +// GetAllowAdvanced returns the AllowAdvanced field if it's non-nil, zero value otherwise. +func (c *CodeScanningOptions) GetAllowAdvanced() bool { + if c == nil || c.AllowAdvanced == nil { + return false + } + return *c.AllowAdvanced +} + // GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. func (c *CodeSearchResult) GetIncompleteResults() bool { if c == nil || c.IncompleteResults == nil { @@ -3046,6 +3518,38 @@ func (c *CodeSecurityConfiguration) GetCodeScanningDefaultSetup() string { return *c.CodeScanningDefaultSetup } +// GetCodeScanningDefaultSetupOptions returns the CodeScanningDefaultSetupOptions field. +func (c *CodeSecurityConfiguration) GetCodeScanningDefaultSetupOptions() *CodeScanningDefaultSetupOptions { + if c == nil { + return nil + } + return c.CodeScanningDefaultSetupOptions +} + +// GetCodeScanningDelegatedAlertDismissal returns the CodeScanningDelegatedAlertDismissal field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetCodeScanningDelegatedAlertDismissal() string { + if c == nil || c.CodeScanningDelegatedAlertDismissal == nil { + return "" + } + return *c.CodeScanningDelegatedAlertDismissal +} + +// GetCodeScanningOptions returns the CodeScanningOptions field. +func (c *CodeSecurityConfiguration) GetCodeScanningOptions() *CodeScanningOptions { + if c == nil { + return nil + } + return c.CodeScanningOptions +} + +// GetCodeSecurity returns the CodeSecurity field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetCodeSecurity() string { + if c == nil || c.CodeSecurity == nil { + return "" + } + return *c.CodeSecurity +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (c *CodeSecurityConfiguration) GetCreatedAt() Timestamp { if c == nil || c.CreatedAt == nil { @@ -3094,14 +3598,6 @@ func (c *CodeSecurityConfiguration) GetDependencyGraphAutosubmitActionOptions() return c.DependencyGraphAutosubmitActionOptions } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetDescription() string { - if c == nil || c.Description == nil { - return "" - } - return *c.Description -} - // GetEnforcement returns the Enforcement field if it's non-nil, zero value otherwise. func (c *CodeSecurityConfiguration) GetEnforcement() string { if c == nil || c.Enforcement == nil { @@ -3126,14 +3622,6 @@ func (c *CodeSecurityConfiguration) GetID() int64 { return *c.ID } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetName() string { - if c == nil || c.Name == nil { - return "" - } - return *c.Name -} - // GetPrivateVulnerabilityReporting returns the PrivateVulnerabilityReporting field if it's non-nil, zero value otherwise. func (c *CodeSecurityConfiguration) GetPrivateVulnerabilityReporting() string { if c == nil || c.PrivateVulnerabilityReporting == nil { @@ -3142,6 +3630,14 @@ func (c *CodeSecurityConfiguration) GetPrivateVulnerabilityReporting() string { return *c.PrivateVulnerabilityReporting } +// GetSecretProtection returns the SecretProtection field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetSecretProtection() string { + if c == nil || c.SecretProtection == nil { + return "" + } + return *c.SecretProtection +} + // GetSecretScanning returns the SecretScanning field if it's non-nil, zero value otherwise. func (c *CodeSecurityConfiguration) GetSecretScanning() string { if c == nil || c.SecretScanning == nil { @@ -3150,6 +3646,38 @@ func (c *CodeSecurityConfiguration) GetSecretScanning() string { return *c.SecretScanning } +// GetSecretScanningDelegatedAlertDismissal returns the SecretScanningDelegatedAlertDismissal field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetSecretScanningDelegatedAlertDismissal() string { + if c == nil || c.SecretScanningDelegatedAlertDismissal == nil { + return "" + } + return *c.SecretScanningDelegatedAlertDismissal +} + +// GetSecretScanningDelegatedBypass returns the SecretScanningDelegatedBypass field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetSecretScanningDelegatedBypass() string { + if c == nil || c.SecretScanningDelegatedBypass == nil { + return "" + } + return *c.SecretScanningDelegatedBypass +} + +// GetSecretScanningDelegatedBypassOptions returns the SecretScanningDelegatedBypassOptions field. +func (c *CodeSecurityConfiguration) GetSecretScanningDelegatedBypassOptions() *SecretScanningDelegatedBypassOptions { + if c == nil { + return nil + } + return c.SecretScanningDelegatedBypassOptions +} + +// GetSecretScanningGenericSecrets returns the SecretScanningGenericSecrets field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetSecretScanningGenericSecrets() string { + if c == nil || c.SecretScanningGenericSecrets == nil { + return "" + } + return *c.SecretScanningGenericSecrets +} + // GetSecretScanningNonProviderPatterns returns the SecretScanningNonProviderPatterns field if it's non-nil, zero value otherwise. func (c *CodeSecurityConfiguration) GetSecretScanningNonProviderPatterns() string { if c == nil || c.SecretScanningNonProviderPatterns == nil { @@ -3454,79 +3982,271 @@ func (c *Codespace) GetWebURL() string { return *c.WebURL } -// GetAhead returns the Ahead field if it's non-nil, zero value otherwise. -func (c *CodespacesGitStatus) GetAhead() int { - if c == nil || c.Ahead == nil { - return 0 +// GetClientIP returns the ClientIP field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetClientIP() string { + if c == nil || c.ClientIP == nil { + return "" } - return *c.Ahead + return *c.ClientIP } -// GetBehind returns the Behind field if it's non-nil, zero value otherwise. -func (c *CodespacesGitStatus) GetBehind() int { - if c == nil || c.Behind == nil { - return 0 +// GetDevcontainerPath returns the DevcontainerPath field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetDevcontainerPath() string { + if c == nil || c.DevcontainerPath == nil { + return "" } - return *c.Behind + return *c.DevcontainerPath } -// GetHasUncommittedChanges returns the HasUncommittedChanges field if it's non-nil, zero value otherwise. -func (c *CodespacesGitStatus) GetHasUncommittedChanges() bool { - if c == nil || c.HasUncommittedChanges == nil { - return false +// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetDisplayName() string { + if c == nil || c.DisplayName == nil { + return "" } - return *c.HasUncommittedChanges + return *c.DisplayName } -// GetHasUnpushedChanges returns the HasUnpushedChanges field if it's non-nil, zero value otherwise. -func (c *CodespacesGitStatus) GetHasUnpushedChanges() bool { - if c == nil || c.HasUnpushedChanges == nil { - return false +// GetGeo returns the Geo field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetGeo() string { + if c == nil || c.Geo == nil { + return "" } - return *c.HasUnpushedChanges + return *c.Geo } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (c *CodespacesGitStatus) GetRef() string { - if c == nil || c.Ref == nil { - return "" +// GetIdleTimeoutMinutes returns the IdleTimeoutMinutes field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetIdleTimeoutMinutes() int { + if c == nil || c.IdleTimeoutMinutes == nil { + return 0 } - return *c.Ref + return *c.IdleTimeoutMinutes } -// GetCPUs returns the CPUs field if it's non-nil, zero value otherwise. -func (c *CodespacesMachine) GetCPUs() int { - if c == nil || c.CPUs == nil { - return 0 +// GetLocation returns the Location field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetLocation() string { + if c == nil || c.Location == nil { + return "" } - return *c.CPUs + return *c.Location } -// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. -func (c *CodespacesMachine) GetDisplayName() string { - if c == nil || c.DisplayName == nil { +// GetMachine returns the Machine field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetMachine() string { + if c == nil || c.Machine == nil { return "" } - return *c.DisplayName + return *c.Machine } -// GetMemoryInBytes returns the MemoryInBytes field if it's non-nil, zero value otherwise. -func (c *CodespacesMachine) GetMemoryInBytes() int64 { - if c == nil || c.MemoryInBytes == nil { - return 0 +// GetMultiRepoPermissionsOptOut returns the MultiRepoPermissionsOptOut field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetMultiRepoPermissionsOptOut() bool { + if c == nil || c.MultiRepoPermissionsOptOut == nil { + return false } - return *c.MemoryInBytes + return *c.MultiRepoPermissionsOptOut } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CodespacesMachine) GetName() string { - if c == nil || c.Name == nil { - return "" +// GetPullRequest returns the PullRequest field. +func (c *CodespaceCreateForUserOptions) GetPullRequest() *CodespacePullRequestOptions { + if c == nil { + return nil } - return *c.Name + return c.PullRequest } -// GetOperatingSystem returns the OperatingSystem field if it's non-nil, zero value otherwise. +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetRef() string { + if c == nil || c.Ref == nil { + return "" + } + return *c.Ref +} + +// GetRetentionPeriodMinutes returns the RetentionPeriodMinutes field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetRetentionPeriodMinutes() int { + if c == nil || c.RetentionPeriodMinutes == nil { + return 0 + } + return *c.RetentionPeriodMinutes +} + +// GetWorkingDirectory returns the WorkingDirectory field if it's non-nil, zero value otherwise. +func (c *CodespaceCreateForUserOptions) GetWorkingDirectory() string { + if c == nil || c.WorkingDirectory == nil { + return "" + } + return *c.WorkingDirectory +} + +// GetBillableOwner returns the BillableOwner field. +func (c *CodespaceDefaultAttributes) GetBillableOwner() *User { + if c == nil { + return nil + } + return c.BillableOwner +} + +// GetDefaults returns the Defaults field. +func (c *CodespaceDefaultAttributes) GetDefaults() *CodespaceDefaults { + if c == nil { + return nil + } + return c.Defaults +} + +// GetDevcontainerPath returns the DevcontainerPath field if it's non-nil, zero value otherwise. +func (c *CodespaceDefaults) GetDevcontainerPath() string { + if c == nil || c.DevcontainerPath == nil { + return "" + } + return *c.DevcontainerPath +} + +// GetBranch returns the Branch field if it's non-nil, zero value otherwise. +func (c *CodespaceExport) GetBranch() string { + if c == nil || c.Branch == nil { + return "" + } + return *c.Branch +} + +// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. +func (c *CodespaceExport) GetCompletedAt() Timestamp { + if c == nil || c.CompletedAt == nil { + return Timestamp{} + } + return *c.CompletedAt +} + +// GetExportURL returns the ExportURL field if it's non-nil, zero value otherwise. +func (c *CodespaceExport) GetExportURL() string { + if c == nil || c.ExportURL == nil { + return "" + } + return *c.ExportURL +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (c *CodespaceExport) GetHTMLURL() string { + if c == nil || c.HTMLURL == nil { + return "" + } + return *c.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *CodespaceExport) GetID() string { + if c == nil || c.ID == nil { + return "" + } + return *c.ID +} + +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (c *CodespaceExport) GetSHA() string { + if c == nil || c.SHA == nil { + return "" + } + return *c.SHA +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (c *CodespaceExport) GetState() string { + if c == nil || c.State == nil { + return "" + } + return *c.State +} + +// GetClientIP returns the ClientIP field if it's non-nil, zero value otherwise. +func (c *CodespaceGetDefaultAttributesOptions) GetClientIP() string { + if c == nil || c.ClientIP == nil { + return "" + } + return *c.ClientIP +} + +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (c *CodespaceGetDefaultAttributesOptions) GetRef() string { + if c == nil || c.Ref == nil { + return "" + } + return *c.Ref +} + +// GetAhead returns the Ahead field if it's non-nil, zero value otherwise. +func (c *CodespacesGitStatus) GetAhead() int { + if c == nil || c.Ahead == nil { + return 0 + } + return *c.Ahead +} + +// GetBehind returns the Behind field if it's non-nil, zero value otherwise. +func (c *CodespacesGitStatus) GetBehind() int { + if c == nil || c.Behind == nil { + return 0 + } + return *c.Behind +} + +// GetHasUncommittedChanges returns the HasUncommittedChanges field if it's non-nil, zero value otherwise. +func (c *CodespacesGitStatus) GetHasUncommittedChanges() bool { + if c == nil || c.HasUncommittedChanges == nil { + return false + } + return *c.HasUncommittedChanges +} + +// GetHasUnpushedChanges returns the HasUnpushedChanges field if it's non-nil, zero value otherwise. +func (c *CodespacesGitStatus) GetHasUnpushedChanges() bool { + if c == nil || c.HasUnpushedChanges == nil { + return false + } + return *c.HasUnpushedChanges +} + +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (c *CodespacesGitStatus) GetRef() string { + if c == nil || c.Ref == nil { + return "" + } + return *c.Ref +} + +// GetCPUs returns the CPUs field if it's non-nil, zero value otherwise. +func (c *CodespacesMachine) GetCPUs() int { + if c == nil || c.CPUs == nil { + return 0 + } + return *c.CPUs +} + +// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. +func (c *CodespacesMachine) GetDisplayName() string { + if c == nil || c.DisplayName == nil { + return "" + } + return *c.DisplayName +} + +// GetMemoryInBytes returns the MemoryInBytes field if it's non-nil, zero value otherwise. +func (c *CodespacesMachine) GetMemoryInBytes() int64 { + if c == nil || c.MemoryInBytes == nil { + return 0 + } + return *c.MemoryInBytes +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *CodespacesMachine) GetName() string { + if c == nil || c.Name == nil { + return "" + } + return *c.Name +} + +// GetOperatingSystem returns the OperatingSystem field if it's non-nil, zero value otherwise. func (c *CodespacesMachine) GetOperatingSystem() string { if c == nil || c.OperatingSystem == nil { return "" @@ -5862,6 +6582,110 @@ func (c *CopilotSeatDetails) GetUpdatedAt() Timestamp { return *c.UpdatedAt } +// GetAzureSubscription returns the AzureSubscription field if it's non-nil, zero value otherwise. +func (c *CostCenter) GetAzureSubscription() string { + if c == nil || c.AzureSubscription == nil { + return "" + } + return *c.AzureSubscription +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (c *CostCenter) GetState() string { + if c == nil || c.State == nil { + return "" + } + return *c.State +} + +// GetCluster returns the Cluster field if it's non-nil, zero value otherwise. +func (c *CreateArtifactDeploymentRequest) GetCluster() string { + if c == nil || c.Cluster == nil { + return "" + } + return *c.Cluster +} + +// GetGithubRepository returns the GithubRepository field if it's non-nil, zero value otherwise. +func (c *CreateArtifactDeploymentRequest) GetGithubRepository() string { + if c == nil || c.GithubRepository == nil { + return "" + } + return *c.GithubRepository +} + +// GetPhysicalEnvironment returns the PhysicalEnvironment field if it's non-nil, zero value otherwise. +func (c *CreateArtifactDeploymentRequest) GetPhysicalEnvironment() string { + if c == nil || c.PhysicalEnvironment == nil { + return "" + } + return *c.PhysicalEnvironment +} + +// GetTags returns the Tags map if it's non-nil, an empty map otherwise. +func (c *CreateArtifactDeploymentRequest) GetTags() map[string]string { + if c == nil || c.Tags == nil { + return map[string]string{} + } + return c.Tags +} + +// GetVersion returns the Version field if it's non-nil, zero value otherwise. +func (c *CreateArtifactDeploymentRequest) GetVersion() string { + if c == nil || c.Version == nil { + return "" + } + return *c.Version +} + +// GetArtifactURL returns the ArtifactURL field if it's non-nil, zero value otherwise. +func (c *CreateArtifactStorageRequest) GetArtifactURL() string { + if c == nil || c.ArtifactURL == nil { + return "" + } + return *c.ArtifactURL +} + +// GetGithubRepository returns the GithubRepository field if it's non-nil, zero value otherwise. +func (c *CreateArtifactStorageRequest) GetGithubRepository() string { + if c == nil || c.GithubRepository == nil { + return "" + } + return *c.GithubRepository +} + +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (c *CreateArtifactStorageRequest) GetPath() string { + if c == nil || c.Path == nil { + return "" + } + return *c.Path +} + +// GetRepository returns the Repository field if it's non-nil, zero value otherwise. +func (c *CreateArtifactStorageRequest) GetRepository() string { + if c == nil || c.Repository == nil { + return "" + } + return *c.Repository +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (c *CreateArtifactStorageRequest) GetStatus() string { + if c == nil || c.Status == nil { + return "" + } + return *c.Status +} + +// GetVersion returns the Version field if it's non-nil, zero value otherwise. +func (c *CreateArtifactStorageRequest) GetVersion() string { + if c == nil || c.Version == nil { + return "" + } + return *c.Version +} + // GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. func (c *CreateCheckRunOptions) GetCompletedAt() Timestamp { if c == nil || c.CompletedAt == nil { @@ -5966,6 +6790,14 @@ func (c *CreateCodespaceOptions) GetIdleTimeoutMinutes() int { return *c.IdleTimeoutMinutes } +// GetLocation returns the Location field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceOptions) GetLocation() string { + if c == nil || c.Location == nil { + return "" + } + return *c.Location +} + // GetMachine returns the Machine field if it's non-nil, zero value otherwise. func (c *CreateCodespaceOptions) GetMachine() string { if c == nil || c.Machine == nil { @@ -6110,20 +6942,52 @@ func (c *CreateEvent) GetSender() *User { return c.Sender } -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (c *CreateOrgInvitationOptions) GetEmail() string { - if c == nil || c.Email == nil { - return "" +// GetEnableStaticIP returns the EnableStaticIP field if it's non-nil, zero value otherwise. +func (c *CreateHostedRunnerRequest) GetEnableStaticIP() bool { + if c == nil || c.EnableStaticIP == nil { + return false } - return *c.Email + return *c.EnableStaticIP } -// GetInviteeID returns the InviteeID field if it's non-nil, zero value otherwise. -func (c *CreateOrgInvitationOptions) GetInviteeID() int64 { - if c == nil || c.InviteeID == nil { +// GetImageGen returns the ImageGen field if it's non-nil, zero value otherwise. +func (c *CreateHostedRunnerRequest) GetImageGen() bool { + if c == nil || c.ImageGen == nil { + return false + } + return *c.ImageGen +} + +// GetMaximumRunners returns the MaximumRunners field if it's non-nil, zero value otherwise. +func (c *CreateHostedRunnerRequest) GetMaximumRunners() int64 { + if c == nil || c.MaximumRunners == nil { return 0 } - return *c.InviteeID + return *c.MaximumRunners +} + +// GetUsername returns the Username field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetUsername() string { + if c == nil || c.Username == nil { + return "" + } + return *c.Username +} + +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (c *CreateOrgInvitationOptions) GetEmail() string { + if c == nil || c.Email == nil { + return "" + } + return *c.Email +} + +// GetInviteeID returns the InviteeID field if it's non-nil, zero value otherwise. +func (c *CreateOrgInvitationOptions) GetInviteeID() int64 { + if c == nil || c.InviteeID == nil { + return 0 + } + return *c.InviteeID } // GetRole returns the Role field if it's non-nil, zero value otherwise. @@ -6230,6 +7094,14 @@ func (c *CreateRunnerGroupRequest) GetName() string { return *c.Name } +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (c *CreateRunnerGroupRequest) GetNetworkConfigurationID() string { + if c == nil || c.NetworkConfigurationID == nil { + return "" + } + return *c.NetworkConfigurationID +} + // GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. func (c *CreateRunnerGroupRequest) GetRestrictedToWorkflows() bool { if c == nil || c.RestrictedToWorkflows == nil { @@ -6310,6 +7182,14 @@ func (c *CreateWorkflowDispatchEventRequest) GetInputs() map[string]any { return c.Inputs } +// GetReturnRunDetails returns the ReturnRunDetails field if it's non-nil, zero value otherwise. +func (c *CreateWorkflowDispatchEventRequest) GetReturnRunDetails() bool { + if c == nil || c.ReturnRunDetails == nil { + return false + } + return *c.ReturnRunDetails +} + // GetCreated returns the Created field if it's non-nil, zero value otherwise. func (c *CreationInfo) GetCreated() Timestamp { if c == nil || c.Created == nil { @@ -6558,12 +7438,20 @@ func (c *CustomOrgRoles) GetUpdatedAt() Timestamp { return *c.UpdatedAt } -// GetDefaultValue returns the DefaultValue field if it's non-nil, zero value otherwise. -func (c *CustomProperty) GetDefaultValue() string { - if c == nil || c.DefaultValue == nil { +// GetPatternScope returns the PatternScope field if it's non-nil, zero value otherwise. +func (c *CustomPatternBackfillScan) GetPatternScope() string { + if c == nil || c.PatternScope == nil { return "" } - return *c.DefaultValue + return *c.PatternScope +} + +// GetPatternSlug returns the PatternSlug field if it's non-nil, zero value otherwise. +func (c *CustomPatternBackfillScan) GetPatternSlug() string { + if c == nil || c.PatternSlug == nil { + return "" + } + return *c.PatternSlug } // GetDescription returns the Description field if it's non-nil, zero value otherwise. @@ -6598,6 +7486,14 @@ func (c *CustomProperty) GetSourceType() string { return *c.SourceType } +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *CustomProperty) GetURL() string { + if c == nil || c.URL == nil { + return "" + } + return *c.URL +} + // GetValuesEditableBy returns the ValuesEditableBy field if it's non-nil, zero value otherwise. func (c *CustomProperty) GetValuesEditableBy() string { if c == nil || c.ValuesEditableBy == nil { @@ -8126,6 +9022,22 @@ func (d *DeploymentStatusRequest) GetState() string { return *d.State } +// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. +func (d *DevContainer) GetDisplayName() string { + if d == nil || d.DisplayName == nil { + return "" + } + return *d.DisplayName +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (d *DevContainer) GetName() string { + if d == nil || d.Name == nil { + return "" + } + return *d.Name +} + // GetActiveLockReason returns the ActiveLockReason field if it's non-nil, zero value otherwise. func (d *Discussion) GetActiveLockReason() string { if d == nil || d.ActiveLockReason == nil { @@ -8902,6 +9814,86 @@ func (e *Enterprise) GetWebsiteURL() string { return *e.WebsiteURL } +// GetOrganizationID returns the OrganizationID field if it's non-nil, zero value otherwise. +func (e *EnterpriseCustomPropertiesValues) GetOrganizationID() int64 { + if e == nil || e.OrganizationID == nil { + return 0 + } + return *e.OrganizationID +} + +// GetOrganizationLogin returns the OrganizationLogin field if it's non-nil, zero value otherwise. +func (e *EnterpriseCustomPropertiesValues) GetOrganizationLogin() string { + if e == nil || e.OrganizationLogin == nil { + return "" + } + return *e.OrganizationLogin +} + +// GetEnterpriseServerUser returns the EnterpriseServerUser field if it's non-nil, zero value otherwise. +func (e *EnterpriseLicensedUsers) GetEnterpriseServerUser() bool { + if e == nil || e.EnterpriseServerUser == nil { + return false + } + return *e.EnterpriseServerUser +} + +// GetGithubComName returns the GithubComName field if it's non-nil, zero value otherwise. +func (e *EnterpriseLicensedUsers) GetGithubComName() string { + if e == nil || e.GithubComName == nil { + return "" + } + return *e.GithubComName +} + +// GetGithubComProfile returns the GithubComProfile field if it's non-nil, zero value otherwise. +func (e *EnterpriseLicensedUsers) GetGithubComProfile() string { + if e == nil || e.GithubComProfile == nil { + return "" + } + return *e.GithubComProfile +} + +// GetGithubComSamlNameID returns the GithubComSamlNameID field if it's non-nil, zero value otherwise. +func (e *EnterpriseLicensedUsers) GetGithubComSamlNameID() string { + if e == nil || e.GithubComSamlNameID == nil { + return "" + } + return *e.GithubComSamlNameID +} + +// GetGithubComTwoFactorAuth returns the GithubComTwoFactorAuth field if it's non-nil, zero value otherwise. +func (e *EnterpriseLicensedUsers) GetGithubComTwoFactorAuth() bool { + if e == nil || e.GithubComTwoFactorAuth == nil { + return false + } + return *e.GithubComTwoFactorAuth +} + +// GetVisualStudioLicenseStatus returns the VisualStudioLicenseStatus field if it's non-nil, zero value otherwise. +func (e *EnterpriseLicensedUsers) GetVisualStudioLicenseStatus() string { + if e == nil || e.VisualStudioLicenseStatus == nil { + return "" + } + return *e.VisualStudioLicenseStatus +} + +// GetVisualStudioSubscriptionEmail returns the VisualStudioSubscriptionEmail field if it's non-nil, zero value otherwise. +func (e *EnterpriseLicensedUsers) GetVisualStudioSubscriptionEmail() string { + if e == nil || e.VisualStudioSubscriptionEmail == nil { + return "" + } + return *e.VisualStudioSubscriptionEmail +} + +// GetProperties returns the Properties field. +func (e *EnterpriseLicenseSyncStatus) GetProperties() *ServerInstanceProperties { + if e == nil { + return nil + } + return e.Properties +} + // GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. func (e *EnterpriseRunnerGroup) GetAllowsPublicRepositories() bool { if e == nil || e.AllowsPublicRepositories == nil { @@ -9030,6 +10022,46 @@ func (e *EnterpriseSecurityAnalysisSettings) GetSecretScanningValidityChecksEnab return *e.SecretScanningValidityChecksEnabled } +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (e *EnterpriseTeam) GetDescription() string { + if e == nil || e.Description == nil { + return "" + } + return *e.Description +} + +// GetOrganizationSelectionType returns the OrganizationSelectionType field if it's non-nil, zero value otherwise. +func (e *EnterpriseTeam) GetOrganizationSelectionType() string { + if e == nil || e.OrganizationSelectionType == nil { + return "" + } + return *e.OrganizationSelectionType +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (e *EnterpriseTeamCreateOrUpdateRequest) GetDescription() string { + if e == nil || e.Description == nil { + return "" + } + return *e.Description +} + +// GetGroupID returns the GroupID field if it's non-nil, zero value otherwise. +func (e *EnterpriseTeamCreateOrUpdateRequest) GetGroupID() string { + if e == nil || e.GroupID == nil { + return "" + } + return *e.GroupID +} + +// GetOrganizationSelectionType returns the OrganizationSelectionType field if it's non-nil, zero value otherwise. +func (e *EnterpriseTeamCreateOrUpdateRequest) GetOrganizationSelectionType() string { + if e == nil || e.OrganizationSelectionType == nil { + return "" + } + return *e.OrganizationSelectionType +} + // GetCanAdminsBypass returns the CanAdminsBypass field if it's non-nil, zero value otherwise. func (e *Environment) GetCanAdminsBypass() bool { if e == nil || e.CanAdminsBypass == nil { @@ -9462,6 +10494,30 @@ func (f *FieldValue) GetProjectNumber() int64 { return *f.ProjectNumber } +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (f *FineGrainedPersonalAccessTokenRequest) GetCreatedAt() Timestamp { + if f == nil || f.CreatedAt == nil { + return Timestamp{} + } + return *f.CreatedAt +} + +// GetTokenExpiresAt returns the TokenExpiresAt field if it's non-nil, zero value otherwise. +func (f *FineGrainedPersonalAccessTokenRequest) GetTokenExpiresAt() Timestamp { + if f == nil || f.TokenExpiresAt == nil { + return Timestamp{} + } + return *f.TokenExpiresAt +} + +// GetTokenLastUsedAt returns the TokenLastUsedAt field if it's non-nil, zero value otherwise. +func (f *FineGrainedPersonalAccessTokenRequest) GetTokenLastUsedAt() Timestamp { + if f == nil || f.TokenLastUsedAt == nil { + return Timestamp{} + } + return *f.TokenLastUsedAt +} + // GetIdentifier returns the Identifier field if it's non-nil, zero value otherwise. func (f *FirstPatchedVersion) GetIdentifier() string { if f == nil || f.Identifier == nil { @@ -9510,6 +10566,14 @@ func (g *GenerateJITConfigRequest) GetWorkFolder() string { return *g.WorkFolder } +// GetConfigurationFilePath returns the ConfigurationFilePath field if it's non-nil, zero value otherwise. +func (g *GenerateNotesOptions) GetConfigurationFilePath() string { + if g == nil || g.ConfigurationFilePath == nil { + return "" + } + return *g.ConfigurationFilePath +} + // GetPreviousTagName returns the PreviousTagName field if it's non-nil, zero value otherwise. func (g *GenerateNotesOptions) GetPreviousTagName() string { if g == nil || g.PreviousTagName == nil { @@ -9550,6 +10614,14 @@ func (g *GetAuditLogOptions) GetPhrase() string { return *g.Phrase } +// GetExcludedAttributes returns the ExcludedAttributes field if it's non-nil, zero value otherwise. +func (g *GetProvisionedSCIMGroupEnterpriseOptions) GetExcludedAttributes() string { + if g == nil || g.ExcludedAttributes == nil { + return "" + } + return *g.ExcludedAttributes +} + // GetComments returns the Comments field if it's non-nil, zero value otherwise. func (g *Gist) GetComments() int { if g == nil || g.Comments == nil { @@ -10598,6 +11670,14 @@ func (h *HostedRunner) GetStatus() string { return *h.Status } +// GetVersion returns the Version field if it's non-nil, zero value otherwise. +func (h *HostedRunnerImage) GetVersion() string { + if h == nil || h.Version == nil { + return "" + } + return *h.Version +} + // GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. func (h *HostedRunnerImageDetail) GetDisplayName() string { if h == nil || h.DisplayName == nil { @@ -10670,6 +11750,30 @@ func (i *IDPGroup) GetGroupName() string { return *i.GroupName } +// GetEnforcedRepositories returns the EnforcedRepositories field if it's non-nil, zero value otherwise. +func (i *ImmutableReleasePolicy) GetEnforcedRepositories() string { + if i == nil || i.EnforcedRepositories == nil { + return "" + } + return *i.EnforcedRepositories +} + +// GetEnforcedRepositories returns the EnforcedRepositories field if it's non-nil, zero value otherwise. +func (i *ImmutableReleaseSettings) GetEnforcedRepositories() string { + if i == nil || i.EnforcedRepositories == nil { + return "" + } + return *i.EnforcedRepositories +} + +// GetSelectedRepositoriesURL returns the SelectedRepositoriesURL field if it's non-nil, zero value otherwise. +func (i *ImmutableReleaseSettings) GetSelectedRepositoriesURL() string { + if i == nil || i.SelectedRepositoriesURL == nil { + return "" + } + return *i.SelectedRepositoriesURL +} + // GetAuthorsCount returns the AuthorsCount field if it's non-nil, zero value otherwise. func (i *Import) GetAuthorsCount() int { if i == nil || i.AuthorsCount == nil { @@ -10846,6 +11950,14 @@ func (i *Import) GetVCSUsername() string { return *i.VCSUsername } +// GetAccessibleRepositoriesURL returns the AccessibleRepositoriesURL field if it's non-nil, zero value otherwise. +func (i *InstallableOrganization) GetAccessibleRepositoriesURL() string { + if i == nil || i.AccessibleRepositoriesURL == nil { + return "" + } + return *i.AccessibleRepositoriesURL +} + // GetAccessTokensURL returns the AccessTokensURL field if it's non-nil, zero value otherwise. func (i *Installation) GetAccessTokensURL() string { if i == nil || i.AccessTokensURL == nil { @@ -10878,6 +11990,14 @@ func (i *Installation) GetAppSlug() string { return *i.AppSlug } +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (i *Installation) GetClientID() string { + if i == nil || i.ClientID == nil { + return "" + } + return *i.ClientID +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (i *Installation) GetCreatedAt() Timestamp { if i == nil || i.CreatedAt == nil { @@ -11342,6 +12462,14 @@ func (i *InstallationPermissions) GetOrganizationCodespacesSettings() string { return *i.OrganizationCodespacesSettings } +// GetOrganizationCopilotMetrics returns the OrganizationCopilotMetrics field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationCopilotMetrics() string { + if i == nil || i.OrganizationCopilotMetrics == nil { + return "" + } + return *i.OrganizationCopilotMetrics +} + // GetOrganizationCopilotSeatManagement returns the OrganizationCopilotSeatManagement field if it's non-nil, zero value otherwise. func (i *InstallationPermissions) GetOrganizationCopilotSeatManagement() string { if i == nil || i.OrganizationCopilotSeatManagement == nil { @@ -12102,6 +13230,14 @@ func (i *Issue) GetNumber() int { return *i.Number } +// GetParentIssueURL returns the ParentIssueURL field if it's non-nil, zero value otherwise. +func (i *Issue) GetParentIssueURL() string { + if i == nil || i.ParentIssueURL == nil { + return "" + } + return *i.ParentIssueURL +} + // GetPullRequestLinks returns the PullRequestLinks field. func (i *Issue) GetPullRequestLinks() *PullRequestLinks { if i == nil { @@ -13238,6 +14374,22 @@ func (l *LargeFile) GetSize() int { return *l.Size } +// GetProperties returns the Properties field. +func (l *LastLicenseSync) GetProperties() *LastLicenseSyncProperties { + if l == nil { + return nil + } + return l.Properties +} + +// GetDate returns the Date field if it's non-nil, zero value otherwise. +func (l *LastLicenseSyncProperties) GetDate() Timestamp { + if l == nil || l.Date == nil { + return Timestamp{} + } + return *l.Date +} + // GetBody returns the Body field if it's non-nil, zero value otherwise. func (l *License) GetBody() string { if l == nil || l.Body == nil { @@ -13630,6 +14782,14 @@ func (l *ListCodespaces) GetTotalCount() int { return *l.TotalCount } +// GetState returns the State field if it's non-nil, zero value otherwise. +func (l *ListCostCenterOptions) GetState() string { + if l == nil || l.State == nil { + return "" + } + return *l.State +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (l *ListCustomDeploymentRuleIntegrationsResponse) GetTotalCount() int { if l == nil || l.TotalCount == nil { @@ -13734,32 +14894,24 @@ func (l *ListGlobalSecurityAdvisoriesOptions) GetUpdated() string { return *l.Updated } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (l *ListOrganizations) GetTotalCount() int { - if l == nil || l.TotalCount == nil { - return 0 +// GetFeatured returns the Featured field if it's non-nil, zero value otherwise. +func (l *ListLicensesOptions) GetFeatured() bool { + if l == nil || l.Featured == nil { + return false } - return *l.TotalCount + return *l.Featured } // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (l *ListRepositories) GetTotalCount() int { +func (l *ListOrganizations) GetTotalCount() int { if l == nil || l.TotalCount == nil { return 0 } return *l.TotalCount } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (l *ListRunnersOptions) GetName() string { - if l == nil || l.Name == nil { - return "" - } - return *l.Name -} - // GetCount returns the Count field if it's non-nil, zero value otherwise. -func (l *ListSCIMProvisionedGroupsForEnterpriseOptions) GetCount() int { +func (l *ListProvisionedSCIMGroupsEnterpriseOptions) GetCount() int { if l == nil || l.Count == nil { return 0 } @@ -13767,7 +14919,7 @@ func (l *ListSCIMProvisionedGroupsForEnterpriseOptions) GetCount() int { } // GetExcludedAttributes returns the ExcludedAttributes field if it's non-nil, zero value otherwise. -func (l *ListSCIMProvisionedGroupsForEnterpriseOptions) GetExcludedAttributes() string { +func (l *ListProvisionedSCIMGroupsEnterpriseOptions) GetExcludedAttributes() string { if l == nil || l.ExcludedAttributes == nil { return "" } @@ -13775,7 +14927,7 @@ func (l *ListSCIMProvisionedGroupsForEnterpriseOptions) GetExcludedAttributes() } // GetFilter returns the Filter field if it's non-nil, zero value otherwise. -func (l *ListSCIMProvisionedGroupsForEnterpriseOptions) GetFilter() string { +func (l *ListProvisionedSCIMGroupsEnterpriseOptions) GetFilter() string { if l == nil || l.Filter == nil { return "" } @@ -13783,7 +14935,7 @@ func (l *ListSCIMProvisionedGroupsForEnterpriseOptions) GetFilter() string { } // GetStartIndex returns the StartIndex field if it's non-nil, zero value otherwise. -func (l *ListSCIMProvisionedGroupsForEnterpriseOptions) GetStartIndex() int { +func (l *ListProvisionedSCIMGroupsEnterpriseOptions) GetStartIndex() int { if l == nil || l.StartIndex == nil { return 0 } @@ -13791,7 +14943,7 @@ func (l *ListSCIMProvisionedGroupsForEnterpriseOptions) GetStartIndex() int { } // GetCount returns the Count field if it's non-nil, zero value otherwise. -func (l *ListSCIMProvisionedIdentitiesOptions) GetCount() int { +func (l *ListProvisionedSCIMUsersEnterpriseOptions) GetCount() int { if l == nil || l.Count == nil { return 0 } @@ -13799,7 +14951,7 @@ func (l *ListSCIMProvisionedIdentitiesOptions) GetCount() int { } // GetFilter returns the Filter field if it's non-nil, zero value otherwise. -func (l *ListSCIMProvisionedIdentitiesOptions) GetFilter() string { +func (l *ListProvisionedSCIMUsersEnterpriseOptions) GetFilter() string { if l == nil || l.Filter == nil { return "" } @@ -13807,49 +14959,113 @@ func (l *ListSCIMProvisionedIdentitiesOptions) GetFilter() string { } // GetStartIndex returns the StartIndex field if it's non-nil, zero value otherwise. -func (l *ListSCIMProvisionedIdentitiesOptions) GetStartIndex() int { +func (l *ListProvisionedSCIMUsersEnterpriseOptions) GetStartIndex() int { if l == nil || l.StartIndex == nil { return 0 } return *l.StartIndex } -// GetEndColumn returns the EndColumn field if it's non-nil, zero value otherwise. -func (l *Location) GetEndColumn() int { - if l == nil || l.EndColumn == nil { - return 0 +// GetClientIP returns the ClientIP field if it's non-nil, zero value otherwise. +func (l *ListRepoMachineTypesOptions) GetClientIP() string { + if l == nil || l.ClientIP == nil { + return "" } - return *l.EndColumn + return *l.ClientIP } -// GetEndLine returns the EndLine field if it's non-nil, zero value otherwise. -func (l *Location) GetEndLine() int { - if l == nil || l.EndLine == nil { - return 0 +// GetLocation returns the Location field if it's non-nil, zero value otherwise. +func (l *ListRepoMachineTypesOptions) GetLocation() string { + if l == nil || l.Location == nil { + return "" } - return *l.EndLine + return *l.Location } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (l *Location) GetPath() string { - if l == nil || l.Path == nil { +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (l *ListRepoMachineTypesOptions) GetRef() string { + if l == nil || l.Ref == nil { return "" } - return *l.Path + return *l.Ref } -// GetStartColumn returns the StartColumn field if it's non-nil, zero value otherwise. -func (l *Location) GetStartColumn() int { - if l == nil || l.StartColumn == nil { +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (l *ListRepositories) GetTotalCount() int { + if l == nil || l.TotalCount == nil { return 0 } - return *l.StartColumn + return *l.TotalCount } -// GetStartLine returns the StartLine field if it's non-nil, zero value otherwise. -func (l *Location) GetStartLine() int { - if l == nil || l.StartLine == nil { - return 0 +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (l *ListRunnersOptions) GetName() string { + if l == nil || l.Name == nil { + return "" + } + return *l.Name +} + +// GetCount returns the Count field if it's non-nil, zero value otherwise. +func (l *ListSCIMProvisionedIdentitiesOptions) GetCount() int { + if l == nil || l.Count == nil { + return 0 + } + return *l.Count +} + +// GetFilter returns the Filter field if it's non-nil, zero value otherwise. +func (l *ListSCIMProvisionedIdentitiesOptions) GetFilter() string { + if l == nil || l.Filter == nil { + return "" + } + return *l.Filter +} + +// GetStartIndex returns the StartIndex field if it's non-nil, zero value otherwise. +func (l *ListSCIMProvisionedIdentitiesOptions) GetStartIndex() int { + if l == nil || l.StartIndex == nil { + return 0 + } + return *l.StartIndex +} + +// GetEndColumn returns the EndColumn field if it's non-nil, zero value otherwise. +func (l *Location) GetEndColumn() int { + if l == nil || l.EndColumn == nil { + return 0 + } + return *l.EndColumn +} + +// GetEndLine returns the EndLine field if it's non-nil, zero value otherwise. +func (l *Location) GetEndLine() int { + if l == nil || l.EndLine == nil { + return 0 + } + return *l.EndLine +} + +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (l *Location) GetPath() string { + if l == nil || l.Path == nil { + return "" + } + return *l.Path +} + +// GetStartColumn returns the StartColumn field if it's non-nil, zero value otherwise. +func (l *Location) GetStartColumn() int { + if l == nil || l.StartColumn == nil { + return 0 + } + return *l.StartColumn +} + +// GetStartLine returns the StartLine field if it's non-nil, zero value otherwise. +func (l *Location) GetStartLine() int { + if l == nil || l.StartLine == nil { + return 0 } return *l.StartLine } @@ -18238,6 +19454,102 @@ func (p *Plan) GetSpace() int { return *p.Space } +// GetModel returns the Model field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReport) GetModel() string { + if p == nil || p.Model == nil { + return "" + } + return *p.Model +} + +// GetOrganization returns the Organization field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReport) GetOrganization() string { + if p == nil || p.Organization == nil { + return "" + } + return *p.Organization +} + +// GetProduct returns the Product field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReport) GetProduct() string { + if p == nil || p.Product == nil { + return "" + } + return *p.Product +} + +// GetUser returns the User field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReport) GetUser() string { + if p == nil || p.User == nil { + return "" + } + return *p.User +} + +// GetDay returns the Day field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReportOptions) GetDay() int { + if p == nil || p.Day == nil { + return 0 + } + return *p.Day +} + +// GetModel returns the Model field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReportOptions) GetModel() string { + if p == nil || p.Model == nil { + return "" + } + return *p.Model +} + +// GetMonth returns the Month field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReportOptions) GetMonth() int { + if p == nil || p.Month == nil { + return 0 + } + return *p.Month +} + +// GetProduct returns the Product field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReportOptions) GetProduct() string { + if p == nil || p.Product == nil { + return "" + } + return *p.Product +} + +// GetUser returns the User field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReportOptions) GetUser() string { + if p == nil || p.User == nil { + return "" + } + return *p.User +} + +// GetYear returns the Year field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReportOptions) GetYear() int { + if p == nil || p.Year == nil { + return 0 + } + return *p.Year +} + +// GetDay returns the Day field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageTimePeriod) GetDay() int { + if p == nil || p.Day == nil { + return 0 + } + return *p.Day +} + +// GetMonth returns the Month field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageTimePeriod) GetMonth() int { + if p == nil || p.Month == nil { + return 0 + } + return *p.Month +} + // GetConfigURL returns the ConfigURL field if it's non-nil, zero value otherwise. func (p *PreReceiveHook) GetConfigURL() string { if p == nil || p.ConfigURL == nil { @@ -18270,6 +19582,62 @@ func (p *PreReceiveHook) GetName() string { return *p.Name } +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (p *PrivateRegistries) GetTotalCount() int { + if p == nil || p.TotalCount == nil { + return 0 + } + return *p.TotalCount +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { + return Timestamp{} + } + return *p.CreatedAt +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetRegistryType returns the RegistryType field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetRegistryType() string { + if p == nil || p.RegistryType == nil { + return "" + } + return *p.RegistryType +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetUpdatedAt() Timestamp { + if p == nil || p.UpdatedAt == nil { + return Timestamp{} + } + return *p.UpdatedAt +} + +// GetUsername returns the Username field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetUsername() string { + if p == nil || p.Username == nil { + return "" + } + return *p.Username +} + +// GetVisibility returns the Visibility field. +func (p *PrivateRegistry) GetVisibility() *PrivateRegistryVisibility { + if p == nil { + return nil + } + return p.Visibility +} + // GetHRef returns the HRef field if it's non-nil, zero value otherwise. func (p *PRLink) GetHRef() string { if p == nil || p.HRef == nil { @@ -18486,6 +19854,22 @@ func (p *ProjectV2) GetID() int64 { return *p.ID } +// GetIsTemplate returns the IsTemplate field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetIsTemplate() bool { + if p == nil || p.IsTemplate == nil { + return false + } + return *p.IsTemplate +} + +// GetLatestStatusUpdate returns the LatestStatusUpdate field. +func (p *ProjectV2) GetLatestStatusUpdate() *ProjectV2StatusUpdate { + if p == nil { + return nil + } + return p.LatestStatusUpdate +} + // GetName returns the Name field if it's non-nil, zero value otherwise. func (p *ProjectV2) GetName() string { if p == nil || p.Name == nil { @@ -18555,79 +19939,279 @@ func (p *ProjectV2) GetShortDescription() string { if p == nil || p.ShortDescription == nil { return "" } - return *p.ShortDescription + return *p.ShortDescription +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetState() string { + if p == nil || p.State == nil { + return "" + } + return *p.State +} + +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetTitle() string { + if p == nil || p.Title == nil { + return "" + } + return *p.Title +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetUpdatedAt() Timestamp { + if p == nil || p.UpdatedAt == nil { + return Timestamp{} + } + return *p.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetURL() string { + if p == nil || p.URL == nil { + return "" + } + return *p.URL +} + +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (p *ProjectV2DraftIssue) GetBody() string { + if p == nil || p.Body == nil { + return "" + } + return *p.Body +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (p *ProjectV2DraftIssue) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { + return Timestamp{} + } + return *p.CreatedAt +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *ProjectV2DraftIssue) GetID() int64 { + if p == nil || p.ID == nil { + return 0 + } + return *p.ID +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (p *ProjectV2DraftIssue) GetNodeID() string { + if p == nil || p.NodeID == nil { + return "" + } + return *p.NodeID +} + +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (p *ProjectV2DraftIssue) GetTitle() string { + if p == nil || p.Title == nil { + return "" + } + return *p.Title +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (p *ProjectV2DraftIssue) GetUpdatedAt() Timestamp { + if p == nil || p.UpdatedAt == nil { + return Timestamp{} + } + return *p.UpdatedAt +} + +// GetUser returns the User field. +func (p *ProjectV2DraftIssue) GetUser() *User { + if p == nil { + return nil + } + return p.User +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (p *ProjectV2Event) GetAction() string { + if p == nil || p.Action == nil { + return "" + } + return *p.Action +} + +// GetInstallation returns the Installation field. +func (p *ProjectV2Event) GetInstallation() *Installation { + if p == nil { + return nil + } + return p.Installation +} + +// GetOrg returns the Org field. +func (p *ProjectV2Event) GetOrg() *Organization { + if p == nil { + return nil + } + return p.Org +} + +// GetProjectsV2 returns the ProjectsV2 field. +func (p *ProjectV2Event) GetProjectsV2() *ProjectV2 { + if p == nil { + return nil + } + return p.ProjectsV2 +} + +// GetSender returns the Sender field. +func (p *ProjectV2Event) GetSender() *User { + if p == nil { + return nil + } + return p.Sender +} + +// GetConfiguration returns the Configuration field. +func (p *ProjectV2Field) GetConfiguration() *ProjectV2FieldConfiguration { + if p == nil { + return nil + } + return p.Configuration +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (p *ProjectV2Field) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { + return Timestamp{} + } + return *p.CreatedAt +} + +// GetDataType returns the DataType field if it's non-nil, zero value otherwise. +func (p *ProjectV2Field) GetDataType() string { + if p == nil || p.DataType == nil { + return "" + } + return *p.DataType +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *ProjectV2Field) GetID() int64 { + if p == nil || p.ID == nil { + return 0 + } + return *p.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *ProjectV2Field) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetState() string { - if p == nil || p.State == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (p *ProjectV2Field) GetNodeID() string { + if p == nil || p.NodeID == nil { return "" } - return *p.State + return *p.NodeID } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetTitle() string { - if p == nil || p.Title == nil { +// GetProjectURL returns the ProjectURL field if it's non-nil, zero value otherwise. +func (p *ProjectV2Field) GetProjectURL() string { + if p == nil || p.ProjectURL == nil { return "" } - return *p.Title + return *p.ProjectURL } // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetUpdatedAt() Timestamp { +func (p *ProjectV2Field) GetUpdatedAt() Timestamp { if p == nil || p.UpdatedAt == nil { return Timestamp{} } return *p.UpdatedAt } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetURL() string { - if p == nil || p.URL == nil { +// GetDuration returns the Duration field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldConfiguration) GetDuration() int { + if p == nil || p.Duration == nil { + return 0 + } + return *p.Duration +} + +// GetStartDay returns the StartDay field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldConfiguration) GetStartDay() int { + if p == nil || p.StartDay == nil { + return 0 + } + return *p.StartDay +} + +// GetDuration returns the Duration field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldIteration) GetDuration() int { + if p == nil || p.Duration == nil { + return 0 + } + return *p.Duration +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldIteration) GetID() string { + if p == nil || p.ID == nil { return "" } - return *p.URL + return *p.ID } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *ProjectV2Event) GetAction() string { - if p == nil || p.Action == nil { +// GetStartDate returns the StartDate field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldIteration) GetStartDate() string { + if p == nil || p.StartDate == nil { return "" } - return *p.Action + return *p.StartDate } -// GetInstallation returns the Installation field. -func (p *ProjectV2Event) GetInstallation() *Installation { +// GetTitle returns the Title field. +func (p *ProjectV2FieldIteration) GetTitle() *ProjectV2TextContent { if p == nil { return nil } - return p.Installation + return p.Title } -// GetOrg returns the Org field. -func (p *ProjectV2Event) GetOrg() *Organization { - if p == nil { - return nil +// GetColor returns the Color field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldOption) GetColor() string { + if p == nil || p.Color == nil { + return "" } - return p.Org + return *p.Color } -// GetProjectsV2 returns the ProjectsV2 field. -func (p *ProjectV2Event) GetProjectsV2() *ProjectV2 { +// GetDescription returns the Description field. +func (p *ProjectV2FieldOption) GetDescription() *ProjectV2TextContent { if p == nil { return nil } - return p.ProjectsV2 + return p.Description } -// GetSender returns the Sender field. -func (p *ProjectV2Event) GetSender() *User { +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldOption) GetID() string { + if p == nil || p.ID == nil { + return "" + } + return *p.ID +} + +// GetName returns the Name field. +func (p *ProjectV2FieldOption) GetName() *ProjectV2TextContent { if p == nil { return nil } - return p.Sender + return p.Name } // GetArchivedAt returns the ArchivedAt field if it's non-nil, zero value otherwise. @@ -18638,6 +20222,14 @@ func (p *ProjectV2Item) GetArchivedAt() Timestamp { return *p.ArchivedAt } +// GetContent returns the Content field. +func (p *ProjectV2Item) GetContent() *ProjectV2ItemContent { + if p == nil { + return nil + } + return p.Content +} + // GetContentNodeID returns the ContentNodeID field if it's non-nil, zero value otherwise. func (p *ProjectV2Item) GetContentNodeID() string { if p == nil || p.ContentNodeID == nil { @@ -18646,12 +20238,12 @@ func (p *ProjectV2Item) GetContentNodeID() string { return *p.ContentNodeID } -// GetContentType returns the ContentType field if it's non-nil, zero value otherwise. -func (p *ProjectV2Item) GetContentType() string { - if p == nil || p.ContentType == nil { - return "" +// GetContentType returns the ContentType field. +func (p *ProjectV2Item) GetContentType() *ProjectV2ItemContentType { + if p == nil { + return nil } - return *p.ContentType + return p.ContentType } // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. @@ -18678,6 +20270,14 @@ func (p *ProjectV2Item) GetID() int64 { return *p.ID } +// GetItemURL returns the ItemURL field if it's non-nil, zero value otherwise. +func (p *ProjectV2Item) GetItemURL() string { + if p == nil || p.ItemURL == nil { + return "" + } + return *p.ItemURL +} + // GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. func (p *ProjectV2Item) GetNodeID() string { if p == nil || p.NodeID == nil { @@ -18694,6 +20294,14 @@ func (p *ProjectV2Item) GetProjectNodeID() string { return *p.ProjectNodeID } +// GetProjectURL returns the ProjectURL field if it's non-nil, zero value otherwise. +func (p *ProjectV2Item) GetProjectURL() string { + if p == nil || p.ProjectURL == nil { + return "" + } + return *p.ProjectURL +} + // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. func (p *ProjectV2Item) GetUpdatedAt() Timestamp { if p == nil || p.UpdatedAt == nil { @@ -18718,6 +20326,30 @@ func (p *ProjectV2ItemChange) GetFieldValue() *FieldValue { return p.FieldValue } +// GetDraftIssue returns the DraftIssue field. +func (p *ProjectV2ItemContent) GetDraftIssue() *ProjectV2DraftIssue { + if p == nil { + return nil + } + return p.DraftIssue +} + +// GetIssue returns the Issue field. +func (p *ProjectV2ItemContent) GetIssue() *Issue { + if p == nil { + return nil + } + return p.Issue +} + +// GetPullRequest returns the PullRequest field. +func (p *ProjectV2ItemContent) GetPullRequest() *PullRequest { + if p == nil { + return nil + } + return p.PullRequest +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (p *ProjectV2ItemEvent) GetAction() string { if p == nil || p.Action == nil { @@ -18766,6 +20398,126 @@ func (p *ProjectV2ItemEvent) GetSender() *User { return p.Sender } +// GetDataType returns the DataType field if it's non-nil, zero value otherwise. +func (p *ProjectV2ItemFieldValue) GetDataType() string { + if p == nil || p.DataType == nil { + return "" + } + return *p.DataType +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *ProjectV2ItemFieldValue) GetID() int64 { + if p == nil || p.ID == nil { + return 0 + } + return *p.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *ProjectV2ItemFieldValue) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (p *ProjectV2StatusUpdate) GetBody() string { + if p == nil || p.Body == nil { + return "" + } + return *p.Body +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (p *ProjectV2StatusUpdate) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { + return Timestamp{} + } + return *p.CreatedAt +} + +// GetCreator returns the Creator field. +func (p *ProjectV2StatusUpdate) GetCreator() *User { + if p == nil { + return nil + } + return p.Creator +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *ProjectV2StatusUpdate) GetID() int64 { + if p == nil || p.ID == nil { + return 0 + } + return *p.ID +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (p *ProjectV2StatusUpdate) GetNodeID() string { + if p == nil || p.NodeID == nil { + return "" + } + return *p.NodeID +} + +// GetProjectNodeID returns the ProjectNodeID field if it's non-nil, zero value otherwise. +func (p *ProjectV2StatusUpdate) GetProjectNodeID() string { + if p == nil || p.ProjectNodeID == nil { + return "" + } + return *p.ProjectNodeID +} + +// GetStartDate returns the StartDate field if it's non-nil, zero value otherwise. +func (p *ProjectV2StatusUpdate) GetStartDate() string { + if p == nil || p.StartDate == nil { + return "" + } + return *p.StartDate +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (p *ProjectV2StatusUpdate) GetStatus() string { + if p == nil || p.Status == nil { + return "" + } + return *p.Status +} + +// GetTargetDate returns the TargetDate field if it's non-nil, zero value otherwise. +func (p *ProjectV2StatusUpdate) GetTargetDate() string { + if p == nil || p.TargetDate == nil { + return "" + } + return *p.TargetDate +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (p *ProjectV2StatusUpdate) GetUpdatedAt() Timestamp { + if p == nil || p.UpdatedAt == nil { + return Timestamp{} + } + return *p.UpdatedAt +} + +// GetHTML returns the HTML field if it's non-nil, zero value otherwise. +func (p *ProjectV2TextContent) GetHTML() string { + if p == nil || p.HTML == nil { + return "" + } + return *p.HTML +} + +// GetRaw returns the Raw field if it's non-nil, zero value otherwise. +func (p *ProjectV2TextContent) GetRaw() string { + if p == nil || p.Raw == nil { + return "" + } + return *p.Raw +} + // GetAllowDeletions returns the AllowDeletions field. func (p *Protection) GetAllowDeletions() *AllowDeletions { if p == nil { @@ -19166,6 +20918,22 @@ func (p *PublicKey) GetKeyID() string { return *p.KeyID } +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *PublishCodespaceOptions) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetPrivate returns the Private field if it's non-nil, zero value otherwise. +func (p *PublishCodespaceOptions) GetPrivate() bool { + if p == nil || p.Private == nil { + return false + } + return *p.Private +} + // GetActiveLockReason returns the ActiveLockReason field if it's non-nil, zero value otherwise. func (p *PullRequest) GetActiveLockReason() string { if p == nil || p.ActiveLockReason == nil { @@ -19910,6 +21678,14 @@ func (p *PullRequestEvent) GetPullRequest() *PullRequest { return p.PullRequest } +// GetReason returns the Reason field if it's non-nil, zero value otherwise. +func (p *PullRequestEvent) GetReason() string { + if p == nil || p.Reason == nil { + return "" + } + return *p.Reason +} + // GetRepo returns the Repo field. func (p *PullRequestEvent) GetRepo() *Repository { if p == nil { @@ -20390,14 +22166,6 @@ func (p *PullRequestReviewThreadEvent) GetThread() *PullRequestThread { return p.Thread } -// GetAutomaticCopilotCodeReviewEnabled returns the AutomaticCopilotCodeReviewEnabled field if it's non-nil, zero value otherwise. -func (p *PullRequestRuleParameters) GetAutomaticCopilotCodeReviewEnabled() bool { - if p == nil || p.AutomaticCopilotCodeReviewEnabled == nil { - return false - } - return *p.AutomaticCopilotCodeReviewEnabled -} - // GetAction returns the Action field if it's non-nil, zero value otherwise. func (p *PullRequestTargetEvent) GetAction() string { if p == nil || p.Action == nil { @@ -21062,6 +22830,14 @@ func (p *PushEventRepository) GetWatchersCount() int { return *p.WatchersCount } +// GetExpireAt returns the ExpireAt field if it's non-nil, zero value otherwise. +func (p *PushProtectionBypass) GetExpireAt() Timestamp { + if p == nil || p.ExpireAt == nil { + return Timestamp{} + } + return *p.ExpireAt +} + // GetActionsRunnerRegistration returns the ActionsRunnerRegistration field. func (r *RateLimits) GetActionsRunnerRegistration() *Rate { if r == nil { @@ -21102,6 +22878,14 @@ func (r *RateLimits) GetCore() *Rate { return r.Core } +// GetDependencySBOM returns the DependencySBOM field. +func (r *RateLimits) GetDependencySBOM() *Rate { + if r == nil { + return nil + } + return r.DependencySBOM +} + // GetDependencySnapshots returns the DependencySnapshots field. func (r *RateLimits) GetDependencySnapshots() *Rate { if r == nil { @@ -21270,6 +23054,30 @@ func (r *Reactions) GetURL() string { return *r.URL } +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (r *ReassignedResource) GetName() string { + if r == nil || r.Name == nil { + return "" + } + return *r.Name +} + +// GetPreviousCostCenter returns the PreviousCostCenter field if it's non-nil, zero value otherwise. +func (r *ReassignedResource) GetPreviousCostCenter() string { + if r == nil || r.PreviousCostCenter == nil { + return "" + } + return *r.PreviousCostCenter +} + +// GetResourceType returns the ResourceType field if it's non-nil, zero value otherwise. +func (r *ReassignedResource) GetResourceType() string { + if r == nil || r.ResourceType == nil { + return "" + } + return *r.ResourceType +} + // GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. func (r *Reference) GetNodeID() string { if r == nil || r.NodeID == nil { @@ -21590,6 +23398,14 @@ func (r *ReleaseVersion) GetVersion() string { return *r.Version } +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (r *RemoveResourcesFromCostCenterResponse) GetMessage() string { + if r == nil || r.Message == nil { + return "" + } + return *r.Message +} + // GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. func (r *RemoveToken) GetExpiresAt() Timestamp { if r == nil || r.ExpiresAt == nil { @@ -22374,10 +24190,10 @@ func (r *Repository) GetParent() *Repository { return r.Parent } -// GetPermissions returns the Permissions map if it's non-nil, an empty map otherwise. -func (r *Repository) GetPermissions() map[string]bool { - if r == nil || r.Permissions == nil { - return map[string]bool{} +// GetPermissions returns the Permissions field. +func (r *Repository) GetPermissions() *RepositoryPermissions { + if r == nil { + return nil } return r.Permissions } @@ -22630,22 +24446,6 @@ func (r *RepositoryActionsAccessLevel) GetAccessLevel() string { return *r.AccessLevel } -// GetAdvancedSecurityCommitters returns the AdvancedSecurityCommitters field if it's non-nil, zero value otherwise. -func (r *RepositoryActiveCommitters) GetAdvancedSecurityCommitters() int { - if r == nil || r.AdvancedSecurityCommitters == nil { - return 0 - } - return *r.AdvancedSecurityCommitters -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *RepositoryActiveCommitters) GetName() string { - if r == nil || r.Name == nil { - return "" - } - return *r.Name -} - // GetActor returns the Actor field. func (r *RepositoryActivity) GetActor() *RepositoryActor { if r == nil { @@ -22814,6 +24614,22 @@ func (r *RepositoryActor) GetUserViewType() string { return *r.UserViewType } +// GetRepository returns the Repository field. +func (r *RepositoryAttachment) GetRepository() *Repository { + if r == nil { + return nil + } + return r.Repository +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (r *RepositoryAttachment) GetStatus() string { + if r == nil || r.Status == nil { + return "" + } + return *r.Status +} + // GetConfiguration returns the Configuration field. func (r *RepositoryCodeSecurityConfiguration) GetConfiguration() *CodeSecurityConfiguration { if r == nil { @@ -23494,6 +25310,46 @@ func (r *RepositoryPermissionLevel) GetUser() *User { return r.User } +// GetAdmin returns the Admin field if it's non-nil, zero value otherwise. +func (r *RepositoryPermissions) GetAdmin() bool { + if r == nil || r.Admin == nil { + return false + } + return *r.Admin +} + +// GetMaintain returns the Maintain field if it's non-nil, zero value otherwise. +func (r *RepositoryPermissions) GetMaintain() bool { + if r == nil || r.Maintain == nil { + return false + } + return *r.Maintain +} + +// GetPull returns the Pull field if it's non-nil, zero value otherwise. +func (r *RepositoryPermissions) GetPull() bool { + if r == nil || r.Pull == nil { + return false + } + return *r.Pull +} + +// GetPush returns the Push field if it's non-nil, zero value otherwise. +func (r *RepositoryPermissions) GetPush() bool { + if r == nil || r.Push == nil { + return false + } + return *r.Push +} + +// GetTriage returns the Triage field if it's non-nil, zero value otherwise. +func (r *RepositoryPermissions) GetTriage() bool { + if r == nil || r.Triage == nil { + return false + } + return *r.Triage +} + // GetAssetsURL returns the AssetsURL field if it's non-nil, zero value otherwise. func (r *RepositoryRelease) GetAssetsURL() string { if r == nil || r.AssetsURL == nil { @@ -23566,6 +25422,14 @@ func (r *RepositoryRelease) GetID() int64 { return *r.ID } +// GetImmutable returns the Immutable field if it's non-nil, zero value otherwise. +func (r *RepositoryRelease) GetImmutable() bool { + if r == nil || r.Immutable == nil { + return false + } + return *r.Immutable +} + // GetMakeLatest returns the MakeLatest field if it's non-nil, zero value otherwise. func (r *RepositoryRelease) GetMakeLatest() string { if r == nil || r.MakeLatest == nil { @@ -23814,6 +25678,14 @@ func (r *RepositoryRulesetConditions) GetOrganizationName() *RepositoryRulesetOr return r.OrganizationName } +// GetOrganizationProperty returns the OrganizationProperty field. +func (r *RepositoryRulesetConditions) GetOrganizationProperty() *RepositoryRulesetOrganizationPropertyConditionParameters { + if r == nil { + return nil + } + return r.OrganizationProperty +} + // GetRefName returns the RefName field. func (r *RepositoryRulesetConditions) GetRefName() *RepositoryRulesetRefConditionParameters { if r == nil { @@ -23990,6 +25862,14 @@ func (r *RepositoryRulesetRules) GetCommitterEmailPattern() *PatternRuleParamete return r.CommitterEmailPattern } +// GetCopilotCodeReview returns the CopilotCodeReview field. +func (r *RepositoryRulesetRules) GetCopilotCodeReview() *CopilotCodeReviewRuleParameters { + if r == nil { + return nil + } + return r.CopilotCodeReview +} + // GetCreation returns the Creation field. func (r *RepositoryRulesetRules) GetCreation() *EmptyRuleParameters { if r == nil { @@ -24062,6 +25942,46 @@ func (r *RepositoryRulesetRules) GetPullRequest() *PullRequestRuleParameters { return r.PullRequest } +// GetRepositoryCreate returns the RepositoryCreate field. +func (r *RepositoryRulesetRules) GetRepositoryCreate() *EmptyRuleParameters { + if r == nil { + return nil + } + return r.RepositoryCreate +} + +// GetRepositoryDelete returns the RepositoryDelete field. +func (r *RepositoryRulesetRules) GetRepositoryDelete() *EmptyRuleParameters { + if r == nil { + return nil + } + return r.RepositoryDelete +} + +// GetRepositoryName returns the RepositoryName field. +func (r *RepositoryRulesetRules) GetRepositoryName() *SimplePatternRuleParameters { + if r == nil { + return nil + } + return r.RepositoryName +} + +// GetRepositoryTransfer returns the RepositoryTransfer field. +func (r *RepositoryRulesetRules) GetRepositoryTransfer() *EmptyRuleParameters { + if r == nil { + return nil + } + return r.RepositoryTransfer +} + +// GetRepositoryVisibility returns the RepositoryVisibility field. +func (r *RepositoryRulesetRules) GetRepositoryVisibility() *RepositoryVisibilityRuleParameters { + if r == nil { + return nil + } + return r.RepositoryVisibility +} + // GetRequiredDeployments returns the RequiredDeployments field. func (r *RepositoryRulesetRules) GetRequiredDeployments() *RequiredDeploymentsRuleParameters { if r == nil { @@ -24670,6 +26590,38 @@ func (r *Rule) GetSeverity() string { return *r.Severity } +// GetMinimumApprovals returns the MinimumApprovals field if it's non-nil, zero value otherwise. +func (r *RulesetRequiredReviewer) GetMinimumApprovals() int { + if r == nil || r.MinimumApprovals == nil { + return 0 + } + return *r.MinimumApprovals +} + +// GetReviewer returns the Reviewer field. +func (r *RulesetRequiredReviewer) GetReviewer() *RulesetReviewer { + if r == nil { + return nil + } + return r.Reviewer +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (r *RulesetReviewer) GetID() int64 { + if r == nil || r.ID == nil { + return 0 + } + return *r.ID +} + +// GetType returns the Type field. +func (r *RulesetReviewer) GetType() *RulesetReviewerType { + if r == nil { + return nil + } + return r.Type +} + // GetIntegrationID returns the IntegrationID field if it's non-nil, zero value otherwise. func (r *RuleStatusCheck) GetIntegrationID() int64 { if r == nil || r.IntegrationID == nil { @@ -24806,6 +26758,14 @@ func (r *RunnerGroup) GetDefault() bool { return *r.Default } +// GetHostedRunnersURL returns the HostedRunnersURL field if it's non-nil, zero value otherwise. +func (r *RunnerGroup) GetHostedRunnersURL() string { + if r == nil || r.HostedRunnersURL == nil { + return "" + } + return *r.HostedRunnersURL +} + // GetID returns the ID field if it's non-nil, zero value otherwise. func (r *RunnerGroup) GetID() int64 { if r == nil || r.ID == nil { @@ -24830,6 +26790,14 @@ func (r *RunnerGroup) GetName() string { return *r.Name } +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (r *RunnerGroup) GetNetworkConfigurationID() string { + if r == nil || r.NetworkConfigurationID == nil { + return "" + } + return *r.NetworkConfigurationID +} + // GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. func (r *RunnerGroup) GetRestrictedToWorkflows() bool { if r == nil || r.RestrictedToWorkflows == nil { @@ -25150,44 +27118,196 @@ func (s *ScanningAnalysis) GetWarning() string { return *s.Warning } +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseAttributeOperation) GetPath() string { + if s == nil || s.Path == nil { + return "" + } + return *s.Path +} + +// GetDisplay returns the Display field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseDisplayReference) GetDisplay() string { + if s == nil || s.Display == nil { + return "" + } + return *s.Display +} + +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseDisplayReference) GetRef() string { + if s == nil || s.Ref == nil { + return "" + } + return *s.Ref +} + +// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseGroupAttributes) GetDisplayName() string { + if s == nil || s.DisplayName == nil { + return "" + } + return *s.DisplayName +} + +// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseGroupAttributes) GetExternalID() string { + if s == nil || s.ExternalID == nil { + return "" + } + return *s.ExternalID +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseGroupAttributes) GetID() string { + if s == nil || s.ID == nil { + return "" + } + return *s.ID +} + +// GetMeta returns the Meta field. +func (s *SCIMEnterpriseGroupAttributes) GetMeta() *SCIMEnterpriseMeta { + if s == nil { + return nil + } + return s.Meta +} + +// GetItemsPerPage returns the ItemsPerPage field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseGroups) GetItemsPerPage() int { + if s == nil || s.ItemsPerPage == nil { + return 0 + } + return *s.ItemsPerPage +} + +// GetStartIndex returns the StartIndex field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseGroups) GetStartIndex() int { + if s == nil || s.StartIndex == nil { + return 0 + } + return *s.StartIndex +} + +// GetTotalResults returns the TotalResults field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseGroups) GetTotalResults() int { + if s == nil || s.TotalResults == nil { + return 0 + } + return *s.TotalResults +} + +// GetCreated returns the Created field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseMeta) GetCreated() Timestamp { + if s == nil || s.Created == nil { + return Timestamp{} + } + return *s.Created +} + +// GetLastModified returns the LastModified field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseMeta) GetLastModified() Timestamp { + if s == nil || s.LastModified == nil { + return Timestamp{} + } + return *s.LastModified +} + +// GetLocation returns the Location field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseMeta) GetLocation() string { + if s == nil || s.Location == nil { + return "" + } + return *s.Location +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseUserAttributes) GetID() string { + if s == nil || s.ID == nil { + return "" + } + return *s.ID +} + +// GetMeta returns the Meta field. +func (s *SCIMEnterpriseUserAttributes) GetMeta() *SCIMEnterpriseMeta { + if s == nil { + return nil + } + return s.Meta +} + +// GetName returns the Name field. +func (s *SCIMEnterpriseUserAttributes) GetName() *SCIMEnterpriseUserName { + if s == nil { + return nil + } + return s.Name +} + +// GetFormatted returns the Formatted field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseUserName) GetFormatted() string { + if s == nil || s.Formatted == nil { + return "" + } + return *s.Formatted +} + +// GetMiddleName returns the MiddleName field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseUserName) GetMiddleName() string { + if s == nil || s.MiddleName == nil { + return "" + } + return *s.MiddleName +} + // GetDisplay returns the Display field if it's non-nil, zero value otherwise. -func (s *SCIMDisplayReference) GetDisplay() string { +func (s *SCIMEnterpriseUserRole) GetDisplay() string { if s == nil || s.Display == nil { return "" } - return *s.Display + return *s.Display +} + +// GetPrimary returns the Primary field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseUserRole) GetPrimary() bool { + if s == nil || s.Primary == nil { + return false + } + return *s.Primary } -// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. -func (s *SCIMGroupAttributes) GetDisplayName() string { - if s == nil || s.DisplayName == nil { +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseUserRole) GetType() string { + if s == nil || s.Type == nil { return "" } - return *s.DisplayName + return *s.Type } -// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. -func (s *SCIMGroupAttributes) GetExternalID() string { - if s == nil || s.ExternalID == nil { - return "" +// GetItemsPerPage returns the ItemsPerPage field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseUsers) GetItemsPerPage() int { + if s == nil || s.ItemsPerPage == nil { + return 0 } - return *s.ExternalID + return *s.ItemsPerPage } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (s *SCIMGroupAttributes) GetID() string { - if s == nil || s.ID == nil { - return "" +// GetStartIndex returns the StartIndex field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseUsers) GetStartIndex() int { + if s == nil || s.StartIndex == nil { + return 0 } - return *s.ID + return *s.StartIndex } -// GetMeta returns the Meta field. -func (s *SCIMGroupAttributes) GetMeta() *SCIMMeta { - if s == nil { - return nil +// GetTotalResults returns the TotalResults field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseUsers) GetTotalResults() int { + if s == nil || s.TotalResults == nil { + return 0 } - return s.Meta + return *s.TotalResults } // GetCreated returns the Created field if it's non-nil, zero value otherwise. @@ -25222,30 +27342,6 @@ func (s *SCIMMeta) GetResourceType() string { return *s.ResourceType } -// GetItemsPerPage returns the ItemsPerPage field if it's non-nil, zero value otherwise. -func (s *SCIMProvisionedGroups) GetItemsPerPage() int { - if s == nil || s.ItemsPerPage == nil { - return 0 - } - return *s.ItemsPerPage -} - -// GetStartIndex returns the StartIndex field if it's non-nil, zero value otherwise. -func (s *SCIMProvisionedGroups) GetStartIndex() int { - if s == nil || s.StartIndex == nil { - return 0 - } - return *s.StartIndex -} - -// GetTotalResults returns the TotalResults field if it's non-nil, zero value otherwise. -func (s *SCIMProvisionedGroups) GetTotalResults() int { - if s == nil || s.TotalResults == nil { - return 0 - } - return *s.TotalResults -} - // GetItemsPerPage returns the ItemsPerPage field if it's non-nil, zero value otherwise. func (s *SCIMProvisionedIdentities) GetItemsPerPage() int { if s == nil || s.ItemsPerPage == nil { @@ -25334,6 +27430,38 @@ func (s *SCIMUserName) GetFormatted() string { return *s.Formatted } +// GetDisplay returns the Display field if it's non-nil, zero value otherwise. +func (s *SCIMUserRole) GetDisplay() string { + if s == nil || s.Display == nil { + return "" + } + return *s.Display +} + +// GetPrimary returns the Primary field if it's non-nil, zero value otherwise. +func (s *SCIMUserRole) GetPrimary() bool { + if s == nil || s.Primary == nil { + return false + } + return *s.Primary +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (s *SCIMUserRole) GetType() string { + if s == nil || s.Type == nil { + return "" + } + return *s.Type +} + +// GetAdvancedSearch returns the AdvancedSearch field if it's non-nil, zero value otherwise. +func (s *SearchOptions) GetAdvancedSearch() bool { + if s == nil || s.AdvancedSearch == nil { + return false + } + return *s.AdvancedSearch +} + // GetStatus returns the Status field if it's non-nil, zero value otherwise. func (s *SecretScanning) GetStatus() string { if s == nil || s.Status == nil { @@ -25934,6 +28062,22 @@ func (s *SecretScanningValidityChecks) GetStatus() string { return *s.Status } +// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. +func (s *SecretsScan) GetCompletedAt() Timestamp { + if s == nil || s.CompletedAt == nil { + return Timestamp{} + } + return *s.CompletedAt +} + +// GetStartedAt returns the StartedAt field if it's non-nil, zero value otherwise. +func (s *SecretsScan) GetStartedAt() Timestamp { + if s == nil || s.StartedAt == nil { + return Timestamp{} + } + return *s.StartedAt +} + // GetAuthor returns the Author field. func (s *SecurityAdvisory) GetAuthor() *User { if s == nil { @@ -26286,6 +28430,38 @@ func (s *SelfHostRunnerPermissionsEnterprise) GetDisableSelfHostedRunnersForAllO return *s.DisableSelfHostedRunnersForAllOrgs } +// GetServerInstances returns the ServerInstances field. +func (s *ServerInstanceProperties) GetServerInstances() *ServerInstances { + if s == nil { + return nil + } + return s.ServerInstances +} + +// GetItems returns the Items field. +func (s *ServerInstances) GetItems() *ServiceInstanceItems { + if s == nil { + return nil + } + return s.Items +} + +// GetLastSync returns the LastSync field. +func (s *ServerItemProperties) GetLastSync() *LastLicenseSync { + if s == nil { + return nil + } + return s.LastSync +} + +// GetProperties returns the Properties field. +func (s *ServiceInstanceItems) GetProperties() *ServerItemProperties { + if s == nil { + return nil + } + return s.Properties +} + // GetFrom returns the From field if it's non-nil, zero value otherwise. func (s *SignatureRequirementEnforcementLevelChanges) GetFrom() string { if s == nil || s.From == nil { @@ -27182,6 +29358,14 @@ func (t *Team) GetSlug() string { return *t.Slug } +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (t *Team) GetType() string { + if t == nil || t.Type == nil { + return "" + } + return *t.Type +} + // GetURL returns the URL field if it's non-nil, zero value otherwise. func (t *Team) GetURL() string { if t == nil || t.URL == nil { @@ -28198,6 +30382,14 @@ func (t *TreeEntry) GetURL() string { return *t.URL } +// GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise. +func (u *UpdateAppInstallationRepositoriesOptions) GetRepositorySelection() string { + if u == nil || u.RepositorySelection == nil { + return "" + } + return *u.RepositorySelection +} + // GetPath returns the Path field if it's non-nil, zero value otherwise. func (u *UpdateAttributeForSCIMUserOperations) GetPath() string { if u == nil || u.Path == nil { @@ -28254,6 +30446,14 @@ func (u *UpdateCheckRunOptions) GetStatus() string { return *u.Status } +// GetMachine returns the Machine field if it's non-nil, zero value otherwise. +func (u *UpdateCodespaceOptions) GetMachine() string { + if u == nil || u.Machine == nil { + return "" + } + return *u.Machine +} + // GetQuerySuite returns the QuerySuite field if it's non-nil, zero value otherwise. func (u *UpdateDefaultSetupConfigurationOptions) GetQuerySuite() string { if u == nil || u.QuerySuite == nil { @@ -28310,132 +30510,180 @@ func (u *UpdateEnterpriseRunnerGroupRequest) GetVisibility() string { return *u.Visibility } -// GetForce returns the Force field if it's non-nil, zero value otherwise. -func (u *UpdateRef) GetForce() bool { - if u == nil || u.Force == nil { +// GetEnableStaticIP returns the EnableStaticIP field if it's non-nil, zero value otherwise. +func (u *UpdateHostedRunnerRequest) GetEnableStaticIP() bool { + if u == nil || u.EnableStaticIP == nil { return false } - return *u.Force + return *u.EnableStaticIP } -// GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. -func (u *UpdateRunnerGroupRequest) GetAllowsPublicRepositories() bool { - if u == nil || u.AllowsPublicRepositories == nil { - return false +// GetImageID returns the ImageID field if it's non-nil, zero value otherwise. +func (u *UpdateHostedRunnerRequest) GetImageID() string { + if u == nil || u.ImageID == nil { + return "" } - return *u.AllowsPublicRepositories + return *u.ImageID +} + +// GetImageVersion returns the ImageVersion field if it's non-nil, zero value otherwise. +func (u *UpdateHostedRunnerRequest) GetImageVersion() string { + if u == nil || u.ImageVersion == nil { + return "" + } + return *u.ImageVersion +} + +// GetMaximumRunners returns the MaximumRunners field if it's non-nil, zero value otherwise. +func (u *UpdateHostedRunnerRequest) GetMaximumRunners() int64 { + if u == nil || u.MaximumRunners == nil { + return 0 + } + return *u.MaximumRunners } // GetName returns the Name field if it's non-nil, zero value otherwise. -func (u *UpdateRunnerGroupRequest) GetName() string { +func (u *UpdateHostedRunnerRequest) GetName() string { if u == nil || u.Name == nil { return "" } return *u.Name } -// GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. -func (u *UpdateRunnerGroupRequest) GetRestrictedToWorkflows() bool { - if u == nil || u.RestrictedToWorkflows == nil { - return false +// GetRunnerGroupID returns the RunnerGroupID field if it's non-nil, zero value otherwise. +func (u *UpdateHostedRunnerRequest) GetRunnerGroupID() int64 { + if u == nil || u.RunnerGroupID == nil { + return 0 } - return *u.RestrictedToWorkflows + return *u.RunnerGroupID } -// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. -func (u *UpdateRunnerGroupRequest) GetVisibility() string { - if u == nil || u.Visibility == nil { +// GetSize returns the Size field if it's non-nil, zero value otherwise. +func (u *UpdateHostedRunnerRequest) GetSize() string { + if u == nil || u.Size == nil { return "" } - return *u.Visibility + return *u.Size } -// GetDate returns the Date field if it's non-nil, zero value otherwise. -func (u *UsageItem) GetDate() string { - if u == nil || u.Date == nil { +// GetEncryptedValue returns the EncryptedValue field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetEncryptedValue() string { + if u == nil || u.EncryptedValue == nil { return "" } - return *u.Date + return *u.EncryptedValue } -// GetDiscountAmount returns the DiscountAmount field. -func (u *UsageItem) GetDiscountAmount() *float64 { - if u == nil { - return nil +// GetKeyID returns the KeyID field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetKeyID() string { + if u == nil || u.KeyID == nil { + return "" } - return u.DiscountAmount + return *u.KeyID } -// GetGrossAmount returns the GrossAmount field. -func (u *UsageItem) GetGrossAmount() *float64 { - if u == nil { - return nil +// GetRegistryType returns the RegistryType field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetRegistryType() string { + if u == nil || u.RegistryType == nil { + return "" } - return u.GrossAmount + return *u.RegistryType } -// GetNetAmount returns the NetAmount field. -func (u *UsageItem) GetNetAmount() *float64 { - if u == nil { - return nil +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetURL() string { + if u == nil || u.URL == nil { + return "" } - return u.NetAmount + return *u.URL } -// GetOrganizationName returns the OrganizationName field if it's non-nil, zero value otherwise. -func (u *UsageItem) GetOrganizationName() string { - if u == nil || u.OrganizationName == nil { +// GetUsername returns the Username field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetUsername() string { + if u == nil || u.Username == nil { return "" } - return *u.OrganizationName + return *u.Username } -// GetPricePerUnit returns the PricePerUnit field. -func (u *UsageItem) GetPricePerUnit() *float64 { +// GetVisibility returns the Visibility field. +func (u *UpdateOrganizationPrivateRegistry) GetVisibility() *PrivateRegistryVisibility { if u == nil { return nil } - return u.PricePerUnit + return u.Visibility } -// GetProduct returns the Product field if it's non-nil, zero value otherwise. -func (u *UsageItem) GetProduct() string { - if u == nil || u.Product == nil { +// GetArchived returns the Archived field if it's non-nil, zero value otherwise. +func (u *UpdateProjectItemOptions) GetArchived() bool { + if u == nil || u.Archived == nil { + return false + } + return *u.Archived +} + +// GetForce returns the Force field if it's non-nil, zero value otherwise. +func (u *UpdateRef) GetForce() bool { + if u == nil || u.Force == nil { + return false + } + return *u.Force +} + +// GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. +func (u *UpdateRunnerGroupRequest) GetAllowsPublicRepositories() bool { + if u == nil || u.AllowsPublicRepositories == nil { + return false + } + return *u.AllowsPublicRepositories +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (u *UpdateRunnerGroupRequest) GetName() string { + if u == nil || u.Name == nil { return "" } - return *u.Product + return *u.Name } -// GetQuantity returns the Quantity field. -func (u *UsageItem) GetQuantity() *float64 { - if u == nil { - return nil +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (u *UpdateRunnerGroupRequest) GetNetworkConfigurationID() string { + if u == nil || u.NetworkConfigurationID == nil { + return "" } - return u.Quantity + return *u.NetworkConfigurationID } -// GetRepositoryName returns the RepositoryName field if it's non-nil, zero value otherwise. -func (u *UsageItem) GetRepositoryName() string { - if u == nil || u.RepositoryName == nil { +// GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. +func (u *UpdateRunnerGroupRequest) GetRestrictedToWorkflows() bool { + if u == nil || u.RestrictedToWorkflows == nil { + return false + } + return *u.RestrictedToWorkflows +} + +// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. +func (u *UpdateRunnerGroupRequest) GetVisibility() string { + if u == nil || u.Visibility == nil { return "" } - return *u.RepositoryName + return *u.Visibility } -// GetSKU returns the SKU field if it's non-nil, zero value otherwise. -func (u *UsageItem) GetSKU() string { - if u == nil || u.SKU == nil { +// GetOrganizationName returns the OrganizationName field if it's non-nil, zero value otherwise. +func (u *UsageItem) GetOrganizationName() string { + if u == nil || u.OrganizationName == nil { return "" } - return *u.SKU + return *u.OrganizationName } -// GetUnitType returns the UnitType field if it's non-nil, zero value otherwise. -func (u *UsageItem) GetUnitType() string { - if u == nil || u.UnitType == nil { +// GetRepositoryName returns the RepositoryName field if it's non-nil, zero value otherwise. +func (u *UsageItem) GetRepositoryName() string { + if u == nil || u.RepositoryName == nil { return "" } - return *u.UnitType + return *u.RepositoryName } // GetDay returns the Day field if it's non-nil, zero value otherwise. @@ -28678,10 +30926,10 @@ func (u *User) GetOwnedPrivateRepos() int64 { return *u.OwnedPrivateRepos } -// GetPermissions returns the Permissions map if it's non-nil, an empty map otherwise. -func (u *User) GetPermissions() map[string]bool { - if u == nil || u.Permissions == nil { - return map[string]bool{} +// GetPermissions returns the Permissions field. +func (u *User) GetPermissions() *RepositoryPermissions { + if u == nil { + return nil } return u.Permissions } @@ -29486,6 +31734,30 @@ func (w *WorkflowDispatchEvent) GetWorkflow() string { return *w.Workflow } +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (w *WorkflowDispatchRunDetails) GetHTMLURL() string { + if w == nil || w.HTMLURL == nil { + return "" + } + return *w.HTMLURL +} + +// GetRunURL returns the RunURL field if it's non-nil, zero value otherwise. +func (w *WorkflowDispatchRunDetails) GetRunURL() string { + if w == nil || w.RunURL == nil { + return "" + } + return *w.RunURL +} + +// GetWorkflowRunID returns the WorkflowRunID field if it's non-nil, zero value otherwise. +func (w *WorkflowDispatchRunDetails) GetWorkflowRunID() int64 { + if w == nil || w.WorkflowRunID == nil { + return 0 + } + return *w.WorkflowRunID +} + // GetCheckRunURL returns the CheckRunURL field if it's non-nil, zero value otherwise. func (w *WorkflowJob) GetCheckRunURL() string { if w == nil || w.CheckRunURL == nil { diff --git a/vendor/github.com/google/go-github/v84/github/github-iterators.go b/vendor/github.com/google/go-github/v84/github/github-iterators.go new file mode 100644 index 000000000..96a0c7b37 --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/github-iterators.go @@ -0,0 +1,7390 @@ +// Code generated by gen-iterators; DO NOT EDIT. +// Instead, please run "go generate ./..." as described here: +// https://github.com/google/go-github/blob/master/CONTRIBUTING.md#submitting-a-patch + +// 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" + "iter" +) + +// ListArtifactsIter returns an iterator that paginates through all results of ListArtifacts. +func (s *ActionsService) ListArtifactsIter(ctx context.Context, owner string, repo string, opts *ListArtifactsOptions) iter.Seq2[*Artifact, error] { + return func(yield func(*Artifact, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListArtifactsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListArtifacts(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Artifact + if results != nil { + iterItems = results.Artifacts + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCacheUsageByRepoForOrgIter returns an iterator that paginates through all results of ListCacheUsageByRepoForOrg. +func (s *ActionsService) ListCacheUsageByRepoForOrgIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*ActionsCacheUsage, error] { + return func(yield func(*ActionsCacheUsage, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCacheUsageByRepoForOrg(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*ActionsCacheUsage + if results != nil { + iterItems = results.RepoCacheUsage + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCachesIter returns an iterator that paginates through all results of ListCaches. +func (s *ActionsService) ListCachesIter(ctx context.Context, owner string, repo string, opts *ActionsCacheListOptions) iter.Seq2[*ActionsCache, error] { + return func(yield func(*ActionsCache, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ActionsCacheListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCaches(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*ActionsCache + if results != nil { + iterItems = results.ActionsCaches + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListEnabledOrgsInEnterpriseIter returns an iterator that paginates through all results of ListEnabledOrgsInEnterprise. +func (s *ActionsService) ListEnabledOrgsInEnterpriseIter(ctx context.Context, owner string, opts *ListOptions) iter.Seq2[*Organization, error] { + return func(yield func(*Organization, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEnabledOrgsInEnterprise(ctx, owner, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Organization + if results != nil { + iterItems = results.Organizations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListEnabledReposInOrgIter returns an iterator that paginates through all results of ListEnabledReposInOrg. +func (s *ActionsService) ListEnabledReposInOrgIter(ctx context.Context, owner string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEnabledReposInOrg(ctx, owner, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListEnvSecretsIter returns an iterator that paginates through all results of ListEnvSecrets. +func (s *ActionsService) ListEnvSecretsIter(ctx context.Context, repoID int, env string, opts *ListOptions) iter.Seq2[*Secret, error] { + return func(yield func(*Secret, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEnvSecrets(ctx, repoID, env, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListEnvVariablesIter returns an iterator that paginates through all results of ListEnvVariables. +func (s *ActionsService) ListEnvVariablesIter(ctx context.Context, owner string, repo string, env string, opts *ListOptions) iter.Seq2[*ActionsVariable, error] { + return func(yield func(*ActionsVariable, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEnvVariables(ctx, owner, repo, env, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*ActionsVariable + if results != nil { + iterItems = results.Variables + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListHostedRunnersIter returns an iterator that paginates through all results of ListHostedRunners. +func (s *ActionsService) ListHostedRunnersIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*HostedRunner, error] { + return func(yield func(*HostedRunner, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListHostedRunners(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*HostedRunner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrgSecretsIter returns an iterator that paginates through all results of ListOrgSecrets. +func (s *ActionsService) ListOrgSecretsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Secret, error] { + return func(yield func(*Secret, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrgSecrets(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrgVariablesIter returns an iterator that paginates through all results of ListOrgVariables. +func (s *ActionsService) ListOrgVariablesIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*ActionsVariable, error] { + return func(yield func(*ActionsVariable, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrgVariables(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*ActionsVariable + if results != nil { + iterItems = results.Variables + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrganizationRunnerGroupsIter returns an iterator that paginates through all results of ListOrganizationRunnerGroups. +func (s *ActionsService) ListOrganizationRunnerGroupsIter(ctx context.Context, org string, opts *ListOrgRunnerGroupOptions) iter.Seq2[*RunnerGroup, error] { + return func(yield func(*RunnerGroup, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOrgRunnerGroupOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrganizationRunnerGroups(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*RunnerGroup + if results != nil { + iterItems = results.RunnerGroups + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListOrganizationRunnersIter returns an iterator that paginates through all results of ListOrganizationRunners. +func (s *ActionsService) ListOrganizationRunnersIter(ctx context.Context, org string, opts *ListRunnersOptions) iter.Seq2[*Runner, error] { + return func(yield func(*Runner, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListRunnersOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrganizationRunners(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Runner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListRepoOrgSecretsIter returns an iterator that paginates through all results of ListRepoOrgSecrets. +func (s *ActionsService) ListRepoOrgSecretsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Secret, error] { + return func(yield func(*Secret, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepoOrgSecrets(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepoOrgVariablesIter returns an iterator that paginates through all results of ListRepoOrgVariables. +func (s *ActionsService) ListRepoOrgVariablesIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*ActionsVariable, error] { + return func(yield func(*ActionsVariable, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepoOrgVariables(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*ActionsVariable + if results != nil { + iterItems = results.Variables + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepoSecretsIter returns an iterator that paginates through all results of ListRepoSecrets. +func (s *ActionsService) ListRepoSecretsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Secret, error] { + return func(yield func(*Secret, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepoSecrets(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepoVariablesIter returns an iterator that paginates through all results of ListRepoVariables. +func (s *ActionsService) ListRepoVariablesIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*ActionsVariable, error] { + return func(yield func(*ActionsVariable, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepoVariables(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*ActionsVariable + if results != nil { + iterItems = results.Variables + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter returns an iterator that paginates through all results of ListRepositoriesSelfHostedRunnersAllowedInOrganization. +func (s *ActionsService) ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositoriesSelfHostedRunnersAllowedInOrganization(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepositoryAccessRunnerGroupIter returns an iterator that paginates through all results of ListRepositoryAccessRunnerGroup. +func (s *ActionsService) ListRepositoryAccessRunnerGroupIter(ctx context.Context, org string, groupID int64, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositoryAccessRunnerGroup(ctx, org, groupID, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepositoryWorkflowRunsIter returns an iterator that paginates through all results of ListRepositoryWorkflowRuns. +func (s *ActionsService) ListRepositoryWorkflowRunsIter(ctx context.Context, owner string, repo string, opts *ListWorkflowRunsOptions) iter.Seq2[*WorkflowRun, error] { + return func(yield func(*WorkflowRun, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListWorkflowRunsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositoryWorkflowRuns(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*WorkflowRun + if results != nil { + iterItems = results.WorkflowRuns + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListRunnerGroupRunnersIter returns an iterator that paginates through all results of ListRunnerGroupRunners. +func (s *ActionsService) ListRunnerGroupRunnersIter(ctx context.Context, org string, groupID int64, opts *ListOptions) iter.Seq2[*Runner, error] { + return func(yield func(*Runner, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRunnerGroupRunners(ctx, org, groupID, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Runner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRunnersIter returns an iterator that paginates through all results of ListRunners. +func (s *ActionsService) ListRunnersIter(ctx context.Context, owner string, repo string, opts *ListRunnersOptions) iter.Seq2[*Runner, error] { + return func(yield func(*Runner, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListRunnersOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRunners(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Runner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListSelectedReposForOrgSecretIter returns an iterator that paginates through all results of ListSelectedReposForOrgSecret. +func (s *ActionsService) ListSelectedReposForOrgSecretIter(ctx context.Context, org string, name string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListSelectedReposForOrgSecret(ctx, org, name, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListSelectedReposForOrgVariableIter returns an iterator that paginates through all results of ListSelectedReposForOrgVariable. +func (s *ActionsService) ListSelectedReposForOrgVariableIter(ctx context.Context, org string, name string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListSelectedReposForOrgVariable(ctx, org, name, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListWorkflowJobsIter returns an iterator that paginates through all results of ListWorkflowJobs. +func (s *ActionsService) ListWorkflowJobsIter(ctx context.Context, owner string, repo string, runID int64, opts *ListWorkflowJobsOptions) iter.Seq2[*WorkflowJob, error] { + return func(yield func(*WorkflowJob, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListWorkflowJobsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListWorkflowJobs(ctx, owner, repo, runID, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*WorkflowJob + if results != nil { + iterItems = results.Jobs + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListWorkflowJobsAttemptIter returns an iterator that paginates through all results of ListWorkflowJobsAttempt. +func (s *ActionsService) ListWorkflowJobsAttemptIter(ctx context.Context, owner string, repo string, runID int64, attemptNumber int64, opts *ListOptions) iter.Seq2[*WorkflowJob, error] { + return func(yield func(*WorkflowJob, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListWorkflowJobsAttempt(ctx, owner, repo, runID, attemptNumber, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*WorkflowJob + if results != nil { + iterItems = results.Jobs + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListWorkflowRunArtifactsIter returns an iterator that paginates through all results of ListWorkflowRunArtifacts. +func (s *ActionsService) ListWorkflowRunArtifactsIter(ctx context.Context, owner string, repo string, runID int64, opts *ListOptions) iter.Seq2[*Artifact, error] { + return func(yield func(*Artifact, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListWorkflowRunArtifacts(ctx, owner, repo, runID, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Artifact + if results != nil { + iterItems = results.Artifacts + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListWorkflowRunsByFileNameIter returns an iterator that paginates through all results of ListWorkflowRunsByFileName. +func (s *ActionsService) ListWorkflowRunsByFileNameIter(ctx context.Context, owner string, repo string, workflowFileName string, opts *ListWorkflowRunsOptions) iter.Seq2[*WorkflowRun, error] { + return func(yield func(*WorkflowRun, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListWorkflowRunsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListWorkflowRunsByFileName(ctx, owner, repo, workflowFileName, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*WorkflowRun + if results != nil { + iterItems = results.WorkflowRuns + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListWorkflowRunsByIDIter returns an iterator that paginates through all results of ListWorkflowRunsByID. +func (s *ActionsService) ListWorkflowRunsByIDIter(ctx context.Context, owner string, repo string, workflowID int64, opts *ListWorkflowRunsOptions) iter.Seq2[*WorkflowRun, error] { + return func(yield func(*WorkflowRun, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListWorkflowRunsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListWorkflowRunsByID(ctx, owner, repo, workflowID, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*WorkflowRun + if results != nil { + iterItems = results.WorkflowRuns + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListWorkflowsIter returns an iterator that paginates through all results of ListWorkflows. +func (s *ActionsService) ListWorkflowsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Workflow, error] { + return func(yield func(*Workflow, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListWorkflows(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Workflow + if results != nil { + iterItems = results.Workflows + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListEventsIter returns an iterator that paginates through all results of ListEvents. +func (s *ActivityService) ListEventsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Event, error] { + return func(yield func(*Event, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEvents(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListEventsForOrganizationIter returns an iterator that paginates through all results of ListEventsForOrganization. +func (s *ActivityService) ListEventsForOrganizationIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Event, error] { + return func(yield func(*Event, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEventsForOrganization(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListEventsForRepoNetworkIter returns an iterator that paginates through all results of ListEventsForRepoNetwork. +func (s *ActivityService) ListEventsForRepoNetworkIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Event, error] { + return func(yield func(*Event, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEventsForRepoNetwork(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListEventsPerformedByUserIter returns an iterator that paginates through all results of ListEventsPerformedByUser. +func (s *ActivityService) ListEventsPerformedByUserIter(ctx context.Context, user string, publicOnly bool, opts *ListOptions) iter.Seq2[*Event, error] { + return func(yield func(*Event, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEventsPerformedByUser(ctx, user, publicOnly, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListEventsReceivedByUserIter returns an iterator that paginates through all results of ListEventsReceivedByUser. +func (s *ActivityService) ListEventsReceivedByUserIter(ctx context.Context, user string, publicOnly bool, opts *ListOptions) iter.Seq2[*Event, error] { + return func(yield func(*Event, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEventsReceivedByUser(ctx, user, publicOnly, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListIssueEventsForRepositoryIter returns an iterator that paginates through all results of ListIssueEventsForRepository. +func (s *ActivityService) ListIssueEventsForRepositoryIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*IssueEvent, error] { + return func(yield func(*IssueEvent, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListIssueEventsForRepository(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListNotificationsIter returns an iterator that paginates through all results of ListNotifications. +func (s *ActivityService) ListNotificationsIter(ctx context.Context, opts *NotificationListOptions) iter.Seq2[*Notification, error] { + return func(yield func(*Notification, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &NotificationListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListNotifications(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListRepositoryEventsIter returns an iterator that paginates through all results of ListRepositoryEvents. +func (s *ActivityService) ListRepositoryEventsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Event, error] { + return func(yield func(*Event, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositoryEvents(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepositoryNotificationsIter returns an iterator that paginates through all results of ListRepositoryNotifications. +func (s *ActivityService) ListRepositoryNotificationsIter(ctx context.Context, owner string, repo string, opts *NotificationListOptions) iter.Seq2[*Notification, error] { + return func(yield func(*Notification, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &NotificationListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositoryNotifications(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListStargazersIter returns an iterator that paginates through all results of ListStargazers. +func (s *ActivityService) ListStargazersIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Stargazer, error] { + return func(yield func(*Stargazer, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListStargazers(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListStarredIter returns an iterator that paginates through all results of ListStarred. +func (s *ActivityService) ListStarredIter(ctx context.Context, user string, opts *ActivityListStarredOptions) iter.Seq2[*StarredRepository, error] { + return func(yield func(*StarredRepository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ActivityListStarredOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListStarred(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListUserEventsForOrganizationIter returns an iterator that paginates through all results of ListUserEventsForOrganization. +func (s *ActivityService) ListUserEventsForOrganizationIter(ctx context.Context, org string, user string, opts *ListOptions) iter.Seq2[*Event, error] { + return func(yield func(*Event, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserEventsForOrganization(ctx, org, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListWatchedIter returns an iterator that paginates through all results of ListWatched. +func (s *ActivityService) ListWatchedIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListWatched(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListWatchersIter returns an iterator that paginates through all results of ListWatchers. +func (s *ActivityService) ListWatchersIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListWatchers(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListHookDeliveriesIter returns an iterator that paginates through all results of ListHookDeliveries. +func (s *AppsService) ListHookDeliveriesIter(ctx context.Context, opts *ListCursorOptions) iter.Seq2[*HookDelivery, error] { + return func(yield func(*HookDelivery, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCursorOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListHookDeliveries(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListInstallationRequestsIter returns an iterator that paginates through all results of ListInstallationRequests. +func (s *AppsService) ListInstallationRequestsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*InstallationRequest, error] { + return func(yield func(*InstallationRequest, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListInstallationRequests(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListInstallationsIter returns an iterator that paginates through all results of ListInstallations. +func (s *AppsService) ListInstallationsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Installation, error] { + return func(yield func(*Installation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListInstallations(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListReposIter returns an iterator that paginates through all results of ListRepos. +func (s *AppsService) ListReposIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepos(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListUserInstallationsIter returns an iterator that paginates through all results of ListUserInstallations. +func (s *AppsService) ListUserInstallationsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Installation, error] { + return func(yield func(*Installation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserInstallations(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListUserReposIter returns an iterator that paginates through all results of ListUserRepos. +func (s *AppsService) ListUserReposIter(ctx context.Context, id int64, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserRepos(ctx, id, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCheckRunAnnotationsIter returns an iterator that paginates through all results of ListCheckRunAnnotations. +func (s *ChecksService) ListCheckRunAnnotationsIter(ctx context.Context, owner string, repo string, checkRunID int64, opts *ListOptions) iter.Seq2[*CheckRunAnnotation, error] { + return func(yield func(*CheckRunAnnotation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCheckRunAnnotations(ctx, owner, repo, checkRunID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCheckRunsCheckSuiteIter returns an iterator that paginates through all results of ListCheckRunsCheckSuite. +func (s *ChecksService) ListCheckRunsCheckSuiteIter(ctx context.Context, owner string, repo string, checkSuiteID int64, opts *ListCheckRunsOptions) iter.Seq2[*CheckRun, error] { + return func(yield func(*CheckRun, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCheckRunsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCheckRunsCheckSuite(ctx, owner, repo, checkSuiteID, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*CheckRun + if results != nil { + iterItems = results.CheckRuns + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCheckRunsForRefIter returns an iterator that paginates through all results of ListCheckRunsForRef. +func (s *ChecksService) ListCheckRunsForRefIter(ctx context.Context, owner string, repo string, ref string, opts *ListCheckRunsOptions) iter.Seq2[*CheckRun, error] { + return func(yield func(*CheckRun, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCheckRunsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCheckRunsForRef(ctx, owner, repo, ref, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*CheckRun + if results != nil { + iterItems = results.CheckRuns + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCheckSuitesForRefIter returns an iterator that paginates through all results of ListCheckSuitesForRef. +func (s *ChecksService) ListCheckSuitesForRefIter(ctx context.Context, owner string, repo string, ref string, opts *ListCheckSuiteOptions) iter.Seq2[*CheckSuite, error] { + return func(yield func(*CheckSuite, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCheckSuiteOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCheckSuitesForRef(ctx, owner, repo, ref, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*CheckSuite + if results != nil { + iterItems = results.CheckSuites + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAcceptedAssignmentsIter returns an iterator that paginates through all results of ListAcceptedAssignments. +func (s *ClassroomService) ListAcceptedAssignmentsIter(ctx context.Context, assignmentID int64, opts *ListOptions) iter.Seq2[*AcceptedAssignment, error] { + return func(yield func(*AcceptedAssignment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAcceptedAssignments(ctx, assignmentID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListClassroomAssignmentsIter returns an iterator that paginates through all results of ListClassroomAssignments. +func (s *ClassroomService) ListClassroomAssignmentsIter(ctx context.Context, classroomID int64, opts *ListOptions) iter.Seq2[*ClassroomAssignment, error] { + return func(yield func(*ClassroomAssignment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListClassroomAssignments(ctx, classroomID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListClassroomsIter returns an iterator that paginates through all results of ListClassrooms. +func (s *ClassroomService) ListClassroomsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Classroom, error] { + return func(yield func(*Classroom, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListClassrooms(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListAlertInstancesIter returns an iterator that paginates through all results of ListAlertInstances. +func (s *CodeScanningService) ListAlertInstancesIter(ctx context.Context, owner string, repo string, id int64, opts *AlertInstancesListOptions) iter.Seq2[*MostRecentInstance, error] { + return func(yield func(*MostRecentInstance, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &AlertInstancesListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAlertInstances(ctx, owner, repo, id, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAlertsForOrgIter returns an iterator that paginates through all results of ListAlertsForOrg. +func (s *CodeScanningService) ListAlertsForOrgIter(ctx context.Context, org string, opts *AlertListOptions) iter.Seq2[*Alert, error] { + return func(yield func(*Alert, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &AlertListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAlertsForOrg(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" && resp.NextPage == 0 { + break + } + opts.ListCursorOptions.After = resp.After + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAlertsForRepoIter returns an iterator that paginates through all results of ListAlertsForRepo. +func (s *CodeScanningService) ListAlertsForRepoIter(ctx context.Context, owner string, repo string, opts *AlertListOptions) iter.Seq2[*Alert, error] { + return func(yield func(*Alert, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &AlertListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAlertsForRepo(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" && resp.NextPage == 0 { + break + } + opts.ListCursorOptions.After = resp.After + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAnalysesForRepoIter returns an iterator that paginates through all results of ListAnalysesForRepo. +func (s *CodeScanningService) ListAnalysesForRepoIter(ctx context.Context, owner string, repo string, opts *AnalysesListOptions) iter.Seq2[*ScanningAnalysis, error] { + return func(yield func(*ScanningAnalysis, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &AnalysesListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAnalysesForRepo(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListIter returns an iterator that paginates through all results of List. +func (s *CodespacesService) ListIter(ctx context.Context, opts *ListCodespacesOptions) iter.Seq2[*Codespace, error] { + return func(yield func(*Codespace, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCodespacesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.List(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Codespace + if results != nil { + iterItems = results.Codespaces + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListDevContainerConfigurationsIter returns an iterator that paginates through all results of ListDevContainerConfigurations. +func (s *CodespacesService) ListDevContainerConfigurationsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*DevContainer, error] { + return func(yield func(*DevContainer, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListDevContainerConfigurations(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*DevContainer + if results != nil { + iterItems = results.Devcontainers + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListInOrgIter returns an iterator that paginates through all results of ListInOrg. +func (s *CodespacesService) ListInOrgIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Codespace, error] { + return func(yield func(*Codespace, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListInOrg(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Codespace + if results != nil { + iterItems = results.Codespaces + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListInRepoIter returns an iterator that paginates through all results of ListInRepo. +func (s *CodespacesService) ListInRepoIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Codespace, error] { + return func(yield func(*Codespace, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListInRepo(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Codespace + if results != nil { + iterItems = results.Codespaces + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrgSecretsIter returns an iterator that paginates through all results of ListOrgSecrets. +func (s *CodespacesService) ListOrgSecretsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Secret, error] { + return func(yield func(*Secret, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrgSecrets(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepoSecretsIter returns an iterator that paginates through all results of ListRepoSecrets. +func (s *CodespacesService) ListRepoSecretsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Secret, error] { + return func(yield func(*Secret, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepoSecrets(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListSelectedReposForOrgSecretIter returns an iterator that paginates through all results of ListSelectedReposForOrgSecret. +func (s *CodespacesService) ListSelectedReposForOrgSecretIter(ctx context.Context, org string, name string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListSelectedReposForOrgSecret(ctx, org, name, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListSelectedReposForUserSecretIter returns an iterator that paginates through all results of ListSelectedReposForUserSecret. +func (s *CodespacesService) ListSelectedReposForUserSecretIter(ctx context.Context, name string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListSelectedReposForUserSecret(ctx, name, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListUserCodespacesInOrgIter returns an iterator that paginates through all results of ListUserCodespacesInOrg. +func (s *CodespacesService) ListUserCodespacesInOrgIter(ctx context.Context, org string, username string, opts *ListOptions) iter.Seq2[*Codespace, error] { + return func(yield func(*Codespace, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserCodespacesInOrg(ctx, org, username, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Codespace + if results != nil { + iterItems = results.Codespaces + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListUserSecretsIter returns an iterator that paginates through all results of ListUserSecrets. +func (s *CodespacesService) ListUserSecretsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Secret, error] { + return func(yield func(*Secret, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserSecrets(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCopilotEnterpriseSeatsIter returns an iterator that paginates through all results of ListCopilotEnterpriseSeats. +func (s *CopilotService) ListCopilotEnterpriseSeatsIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*CopilotSeatDetails, error] { + return func(yield func(*CopilotSeatDetails, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCopilotEnterpriseSeats(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*CopilotSeatDetails + if results != nil { + iterItems = results.Seats + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCopilotSeatsIter returns an iterator that paginates through all results of ListCopilotSeats. +func (s *CopilotService) ListCopilotSeatsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*CopilotSeatDetails, error] { + return func(yield func(*CopilotSeatDetails, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCopilotSeats(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*CopilotSeatDetails + if results != nil { + iterItems = results.Seats + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrgAlertsIter returns an iterator that paginates through all results of ListOrgAlerts. +func (s *DependabotService) ListOrgAlertsIter(ctx context.Context, org string, opts *ListAlertsOptions) iter.Seq2[*DependabotAlert, error] { + return func(yield func(*DependabotAlert, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListAlertsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrgAlerts(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" && resp.NextPage == 0 { + break + } + opts.ListCursorOptions.After = resp.After + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListOrgSecretsIter returns an iterator that paginates through all results of ListOrgSecrets. +func (s *DependabotService) ListOrgSecretsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Secret, error] { + return func(yield func(*Secret, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrgSecrets(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepoAlertsIter returns an iterator that paginates through all results of ListRepoAlerts. +func (s *DependabotService) ListRepoAlertsIter(ctx context.Context, owner string, repo string, opts *ListAlertsOptions) iter.Seq2[*DependabotAlert, error] { + return func(yield func(*DependabotAlert, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListAlertsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepoAlerts(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" && resp.NextPage == 0 { + break + } + opts.ListCursorOptions.After = resp.After + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListRepoSecretsIter returns an iterator that paginates through all results of ListRepoSecrets. +func (s *DependabotService) ListRepoSecretsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Secret, error] { + return func(yield func(*Secret, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepoSecrets(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Secret + if results != nil { + iterItems = results.Secrets + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListSelectedReposForOrgSecretIter returns an iterator that paginates through all results of ListSelectedReposForOrgSecret. +func (s *DependabotService) ListSelectedReposForOrgSecretIter(ctx context.Context, org string, name string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListSelectedReposForOrgSecret(ctx, org, name, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListAppAccessibleOrganizationRepositoriesIter returns an iterator that paginates through all results of ListAppAccessibleOrganizationRepositories. +func (s *EnterpriseService) ListAppAccessibleOrganizationRepositoriesIter(ctx context.Context, enterprise string, org string, opts *ListOptions) iter.Seq2[*AccessibleRepository, error] { + return func(yield func(*AccessibleRepository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAppAccessibleOrganizationRepositories(ctx, enterprise, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListAppInstallableOrganizationsIter returns an iterator that paginates through all results of ListAppInstallableOrganizations. +func (s *EnterpriseService) ListAppInstallableOrganizationsIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*InstallableOrganization, error] { + return func(yield func(*InstallableOrganization, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAppInstallableOrganizations(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListAppInstallationsIter returns an iterator that paginates through all results of ListAppInstallations. +func (s *EnterpriseService) ListAppInstallationsIter(ctx context.Context, enterprise string, org string, opts *ListOptions) iter.Seq2[*Installation, error] { + return func(yield func(*Installation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAppInstallations(ctx, enterprise, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListAssignmentsIter returns an iterator that paginates through all results of ListAssignments. +func (s *EnterpriseService) ListAssignmentsIter(ctx context.Context, enterprise string, enterpriseTeam string, opts *ListOptions) iter.Seq2[*Organization, error] { + return func(yield func(*Organization, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAssignments(ctx, enterprise, enterpriseTeam, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCodeSecurityConfigurationRepositoriesIter returns an iterator that paginates through all results of ListCodeSecurityConfigurationRepositories. +func (s *EnterpriseService) ListCodeSecurityConfigurationRepositoriesIter(ctx context.Context, enterprise string, configurationID int64, opts *ListCodeSecurityConfigurationRepositoriesOptions) iter.Seq2[*RepositoryAttachment, error] { + return func(yield func(*RepositoryAttachment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCodeSecurityConfigurationRepositoriesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCodeSecurityConfigurationRepositories(ctx, enterprise, configurationID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListCodeSecurityConfigurationsIter returns an iterator that paginates through all results of ListCodeSecurityConfigurations. +func (s *EnterpriseService) ListCodeSecurityConfigurationsIter(ctx context.Context, enterprise string, opts *ListEnterpriseCodeSecurityConfigurationOptions) iter.Seq2[*CodeSecurityConfiguration, error] { + return func(yield func(*CodeSecurityConfiguration, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListEnterpriseCodeSecurityConfigurationOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCodeSecurityConfigurations(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListEnterpriseNetworkConfigurationsIter returns an iterator that paginates through all results of ListEnterpriseNetworkConfigurations. +func (s *EnterpriseService) ListEnterpriseNetworkConfigurationsIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*NetworkConfiguration, error] { + return func(yield func(*NetworkConfiguration, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEnterpriseNetworkConfigurations(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*NetworkConfiguration + if results != nil { + iterItems = results.NetworkConfigurations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListHostedRunnersIter returns an iterator that paginates through all results of ListHostedRunners. +func (s *EnterpriseService) ListHostedRunnersIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*HostedRunner, error] { + return func(yield func(*HostedRunner, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListHostedRunners(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*HostedRunner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrganizationAccessRunnerGroupIter returns an iterator that paginates through all results of ListOrganizationAccessRunnerGroup. +func (s *EnterpriseService) ListOrganizationAccessRunnerGroupIter(ctx context.Context, enterprise string, groupID int64, opts *ListOptions) iter.Seq2[*Organization, error] { + return func(yield func(*Organization, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrganizationAccessRunnerGroup(ctx, enterprise, groupID, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Organization + if results != nil { + iterItems = results.Organizations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrganizationCustomPropertyValuesIter returns an iterator that paginates through all results of ListOrganizationCustomPropertyValues. +func (s *EnterpriseService) ListOrganizationCustomPropertyValuesIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*EnterpriseCustomPropertiesValues, error] { + return func(yield func(*EnterpriseCustomPropertiesValues, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrganizationCustomPropertyValues(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepositoriesForOrgAppInstallationIter returns an iterator that paginates through all results of ListRepositoriesForOrgAppInstallation. +func (s *EnterpriseService) ListRepositoriesForOrgAppInstallationIter(ctx context.Context, enterprise string, org string, installationID int64, opts *ListOptions) iter.Seq2[*AccessibleRepository, error] { + return func(yield func(*AccessibleRepository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositoriesForOrgAppInstallation(ctx, enterprise, org, installationID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRunnerGroupRunnersIter returns an iterator that paginates through all results of ListRunnerGroupRunners. +func (s *EnterpriseService) ListRunnerGroupRunnersIter(ctx context.Context, enterprise string, groupID int64, opts *ListOptions) iter.Seq2[*Runner, error] { + return func(yield func(*Runner, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRunnerGroupRunners(ctx, enterprise, groupID, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Runner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRunnerGroupsIter returns an iterator that paginates through all results of ListRunnerGroups. +func (s *EnterpriseService) ListRunnerGroupsIter(ctx context.Context, enterprise string, opts *ListEnterpriseRunnerGroupOptions) iter.Seq2[*EnterpriseRunnerGroup, error] { + return func(yield func(*EnterpriseRunnerGroup, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListEnterpriseRunnerGroupOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRunnerGroups(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*EnterpriseRunnerGroup + if results != nil { + iterItems = results.RunnerGroups + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListRunnersIter returns an iterator that paginates through all results of ListRunners. +func (s *EnterpriseService) ListRunnersIter(ctx context.Context, enterprise string, opts *ListRunnersOptions) iter.Seq2[*Runner, error] { + return func(yield func(*Runner, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListRunnersOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRunners(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Runner + if results != nil { + iterItems = results.Runners + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListTeamMembersIter returns an iterator that paginates through all results of ListTeamMembers. +func (s *EnterpriseService) ListTeamMembersIter(ctx context.Context, enterprise string, enterpriseTeam string, opts *ListOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeamMembers(ctx, enterprise, enterpriseTeam, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListTeamsIter returns an iterator that paginates through all results of ListTeams. +func (s *EnterpriseService) ListTeamsIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*EnterpriseTeam, error] { + return func(yield func(*EnterpriseTeam, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeams(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListIter returns an iterator that paginates through all results of List. +func (s *GistsService) ListIter(ctx context.Context, user string, opts *GistListOptions) iter.Seq2[*Gist, error] { + return func(yield func(*Gist, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &GistListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.List(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAllIter returns an iterator that paginates through all results of ListAll. +func (s *GistsService) ListAllIter(ctx context.Context, opts *GistListOptions) iter.Seq2[*Gist, error] { + return func(yield func(*Gist, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &GistListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAll(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCommentsIter returns an iterator that paginates through all results of ListComments. +func (s *GistsService) ListCommentsIter(ctx context.Context, gistID string, opts *ListOptions) iter.Seq2[*GistComment, error] { + return func(yield func(*GistComment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListComments(ctx, gistID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCommitsIter returns an iterator that paginates through all results of ListCommits. +func (s *GistsService) ListCommitsIter(ctx context.Context, id string, opts *ListOptions) iter.Seq2[*GistCommit, error] { + return func(yield func(*GistCommit, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCommits(ctx, id, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListForksIter returns an iterator that paginates through all results of ListForks. +func (s *GistsService) ListForksIter(ctx context.Context, id string, opts *ListOptions) iter.Seq2[*GistFork, error] { + return func(yield func(*GistFork, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListForks(ctx, id, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListStarredIter returns an iterator that paginates through all results of ListStarred. +func (s *GistsService) ListStarredIter(ctx context.Context, opts *GistListOptions) iter.Seq2[*Gist, error] { + return func(yield func(*Gist, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &GistListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListStarred(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAllIssuesIter returns an iterator that paginates through all results of ListAllIssues. +func (s *IssuesService) ListAllIssuesIter(ctx context.Context, opts *ListAllIssuesOptions) iter.Seq2[*Issue, error] { + return func(yield func(*Issue, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListAllIssuesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAllIssues(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAssigneesIter returns an iterator that paginates through all results of ListAssignees. +func (s *IssuesService) ListAssigneesIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAssignees(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListByOrgIter returns an iterator that paginates through all results of ListByOrg. +func (s *IssuesService) ListByOrgIter(ctx context.Context, org string, opts *IssueListByOrgOptions) iter.Seq2[*Issue, error] { + return func(yield func(*Issue, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &IssueListByOrgOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListByOrg(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListByRepoIter returns an iterator that paginates through all results of ListByRepo. +func (s *IssuesService) ListByRepoIter(ctx context.Context, owner string, repo string, opts *IssueListByRepoOptions) iter.Seq2[*Issue, error] { + return func(yield func(*Issue, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &IssueListByRepoOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListByRepo(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" && resp.NextPage == 0 { + break + } + opts.ListCursorOptions.After = resp.After + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCommentsIter returns an iterator that paginates through all results of ListComments. +func (s *IssuesService) ListCommentsIter(ctx context.Context, owner string, repo string, number int, opts *IssueListCommentsOptions) iter.Seq2[*IssueComment, error] { + return func(yield func(*IssueComment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &IssueListCommentsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListComments(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListIssueEventsIter returns an iterator that paginates through all results of ListIssueEvents. +func (s *IssuesService) ListIssueEventsIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*IssueEvent, error] { + return func(yield func(*IssueEvent, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListIssueEvents(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListIssueTimelineIter returns an iterator that paginates through all results of ListIssueTimeline. +func (s *IssuesService) ListIssueTimelineIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*Timeline, error] { + return func(yield func(*Timeline, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListIssueTimeline(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListLabelsIter returns an iterator that paginates through all results of ListLabels. +func (s *IssuesService) ListLabelsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Label, error] { + return func(yield func(*Label, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListLabels(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListLabelsByIssueIter returns an iterator that paginates through all results of ListLabelsByIssue. +func (s *IssuesService) ListLabelsByIssueIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*Label, error] { + return func(yield func(*Label, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListLabelsByIssue(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListLabelsForMilestoneIter returns an iterator that paginates through all results of ListLabelsForMilestone. +func (s *IssuesService) ListLabelsForMilestoneIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*Label, error] { + return func(yield func(*Label, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListLabelsForMilestone(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListMilestonesIter returns an iterator that paginates through all results of ListMilestones. +func (s *IssuesService) ListMilestonesIter(ctx context.Context, owner string, repo string, opts *MilestoneListOptions) iter.Seq2[*Milestone, error] { + return func(yield func(*Milestone, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &MilestoneListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListMilestones(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListRepositoryEventsIter returns an iterator that paginates through all results of ListRepositoryEvents. +func (s *IssuesService) ListRepositoryEventsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*IssueEvent, error] { + return func(yield func(*IssueEvent, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositoryEvents(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListUserIssuesIter returns an iterator that paginates through all results of ListUserIssues. +func (s *IssuesService) ListUserIssuesIter(ctx context.Context, opts *ListUserIssuesOptions) iter.Seq2[*Issue, error] { + return func(yield func(*Issue, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListUserIssuesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserIssues(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListIter returns an iterator that paginates through all results of List. +func (s *LicensesService) ListIter(ctx context.Context, opts *ListLicensesOptions) iter.Seq2[*License, error] { + return func(yield func(*License, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListLicensesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.List(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListMarketplacePurchasesForUserIter returns an iterator that paginates through all results of ListMarketplacePurchasesForUser. +func (s *MarketplaceService) ListMarketplacePurchasesForUserIter(ctx context.Context, opts *ListOptions) iter.Seq2[*MarketplacePurchase, error] { + return func(yield func(*MarketplacePurchase, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListMarketplacePurchasesForUser(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListPlanAccountsForPlanIter returns an iterator that paginates through all results of ListPlanAccountsForPlan. +func (s *MarketplaceService) ListPlanAccountsForPlanIter(ctx context.Context, planID int64, opts *ListOptions) iter.Seq2[*MarketplacePlanAccount, error] { + return func(yield func(*MarketplacePlanAccount, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPlanAccountsForPlan(ctx, planID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListPlansIter returns an iterator that paginates through all results of ListPlans. +func (s *MarketplaceService) ListPlansIter(ctx context.Context, opts *ListOptions) iter.Seq2[*MarketplacePlan, error] { + return func(yield func(*MarketplacePlan, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPlans(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListMigrationsIter returns an iterator that paginates through all results of ListMigrations. +func (s *MigrationService) ListMigrationsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Migration, error] { + return func(yield func(*Migration, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListMigrations(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListUserMigrationsIter returns an iterator that paginates through all results of ListUserMigrations. +func (s *MigrationService) ListUserMigrationsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*UserMigration, error] { + return func(yield func(*UserMigration, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserMigrations(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListIter returns an iterator that paginates through all results of List. +func (s *OrganizationsService) ListIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*Organization, error] { + return func(yield func(*Organization, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.List(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListAttestationsIter returns an iterator that paginates through all results of ListAttestations. +func (s *OrganizationsService) ListAttestationsIter(ctx context.Context, org string, subjectDigest string, opts *ListOptions) iter.Seq2[*Attestation, error] { + return func(yield func(*Attestation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAttestations(ctx, org, subjectDigest, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Attestation + if results != nil { + iterItems = results.Attestations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListBlockedUsersIter returns an iterator that paginates through all results of ListBlockedUsers. +func (s *OrganizationsService) ListBlockedUsersIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListBlockedUsers(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCodeSecurityConfigurationRepositoriesIter returns an iterator that paginates through all results of ListCodeSecurityConfigurationRepositories. +func (s *OrganizationsService) ListCodeSecurityConfigurationRepositoriesIter(ctx context.Context, org string, configurationID int64, opts *ListCodeSecurityConfigurationRepositoriesOptions) iter.Seq2[*RepositoryAttachment, error] { + return func(yield func(*RepositoryAttachment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCodeSecurityConfigurationRepositoriesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCodeSecurityConfigurationRepositories(ctx, org, configurationID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListCodeSecurityConfigurationsIter returns an iterator that paginates through all results of ListCodeSecurityConfigurations. +func (s *OrganizationsService) ListCodeSecurityConfigurationsIter(ctx context.Context, org string, opts *ListOrgCodeSecurityConfigurationOptions) iter.Seq2[*CodeSecurityConfiguration, error] { + return func(yield func(*CodeSecurityConfiguration, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOrgCodeSecurityConfigurationOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCodeSecurityConfigurations(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListCredentialAuthorizationsIter returns an iterator that paginates through all results of ListCredentialAuthorizations. +func (s *OrganizationsService) ListCredentialAuthorizationsIter(ctx context.Context, org string, opts *CredentialAuthorizationsListOptions) iter.Seq2[*CredentialAuthorization, error] { + return func(yield func(*CredentialAuthorization, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &CredentialAuthorizationsListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCredentialAuthorizations(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCustomPropertyValuesIter returns an iterator that paginates through all results of ListCustomPropertyValues. +func (s *OrganizationsService) ListCustomPropertyValuesIter(ctx context.Context, org string, opts *ListCustomPropertyValuesOptions) iter.Seq2[*RepoCustomPropertyValue, error] { + return func(yield func(*RepoCustomPropertyValue, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCustomPropertyValuesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCustomPropertyValues(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListFailedOrgInvitationsIter returns an iterator that paginates through all results of ListFailedOrgInvitations. +func (s *OrganizationsService) ListFailedOrgInvitationsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Invitation, error] { + return func(yield func(*Invitation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListFailedOrgInvitations(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListFineGrainedPersonalAccessTokenRequestsIter returns an iterator that paginates through all results of ListFineGrainedPersonalAccessTokenRequests. +func (s *OrganizationsService) ListFineGrainedPersonalAccessTokenRequestsIter(ctx context.Context, org string, opts *ListFineGrainedPATOptions) iter.Seq2[*FineGrainedPersonalAccessTokenRequest, error] { + return func(yield func(*FineGrainedPersonalAccessTokenRequest, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListFineGrainedPATOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListFineGrainedPersonalAccessTokenRequests(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListFineGrainedPersonalAccessTokensIter returns an iterator that paginates through all results of ListFineGrainedPersonalAccessTokens. +func (s *OrganizationsService) ListFineGrainedPersonalAccessTokensIter(ctx context.Context, org string, opts *ListFineGrainedPATOptions) iter.Seq2[*PersonalAccessToken, error] { + return func(yield func(*PersonalAccessToken, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListFineGrainedPATOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListFineGrainedPersonalAccessTokens(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListHookDeliveriesIter returns an iterator that paginates through all results of ListHookDeliveries. +func (s *OrganizationsService) ListHookDeliveriesIter(ctx context.Context, org string, id int64, opts *ListCursorOptions) iter.Seq2[*HookDelivery, error] { + return func(yield func(*HookDelivery, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCursorOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListHookDeliveries(ctx, org, id, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListHooksIter returns an iterator that paginates through all results of ListHooks. +func (s *OrganizationsService) ListHooksIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Hook, error] { + return func(yield func(*Hook, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListHooks(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListImmutableReleaseRepositoriesIter returns an iterator that paginates through all results of ListImmutableReleaseRepositories. +func (s *OrganizationsService) ListImmutableReleaseRepositoriesIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListImmutableReleaseRepositories(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Repository + if results != nil { + iterItems = results.Repositories + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListInstallationsIter returns an iterator that paginates through all results of ListInstallations. +func (s *OrganizationsService) ListInstallationsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Installation, error] { + return func(yield func(*Installation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListInstallations(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Installation + if results != nil { + iterItems = results.Installations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListMembersIter returns an iterator that paginates through all results of ListMembers. +func (s *OrganizationsService) ListMembersIter(ctx context.Context, org string, opts *ListMembersOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListMembersOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListMembers(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListNetworkConfigurationsIter returns an iterator that paginates through all results of ListNetworkConfigurations. +func (s *OrganizationsService) ListNetworkConfigurationsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*NetworkConfiguration, error] { + return func(yield func(*NetworkConfiguration, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListNetworkConfigurations(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*NetworkConfiguration + if results != nil { + iterItems = results.NetworkConfigurations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrgInvitationTeamsIter returns an iterator that paginates through all results of ListOrgInvitationTeams. +func (s *OrganizationsService) ListOrgInvitationTeamsIter(ctx context.Context, org string, invitationID string, opts *ListOptions) iter.Seq2[*Team, error] { + return func(yield func(*Team, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrgInvitationTeams(ctx, org, invitationID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrgMembershipsIter returns an iterator that paginates through all results of ListOrgMemberships. +func (s *OrganizationsService) ListOrgMembershipsIter(ctx context.Context, opts *ListOrgMembershipsOptions) iter.Seq2[*Membership, error] { + return func(yield func(*Membership, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOrgMembershipsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrgMemberships(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListOutsideCollaboratorsIter returns an iterator that paginates through all results of ListOutsideCollaborators. +func (s *OrganizationsService) ListOutsideCollaboratorsIter(ctx context.Context, org string, opts *ListOutsideCollaboratorsOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOutsideCollaboratorsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOutsideCollaborators(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListPackagesIter returns an iterator that paginates through all results of ListPackages. +func (s *OrganizationsService) ListPackagesIter(ctx context.Context, org string, opts *PackageListOptions) iter.Seq2[*Package, error] { + return func(yield func(*Package, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &PackageListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPackages(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListPendingOrgInvitationsIter returns an iterator that paginates through all results of ListPendingOrgInvitations. +func (s *OrganizationsService) ListPendingOrgInvitationsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Invitation, error] { + return func(yield func(*Invitation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPendingOrgInvitations(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListTeamsAssignedToOrgRoleIter returns an iterator that paginates through all results of ListTeamsAssignedToOrgRole. +func (s *OrganizationsService) ListTeamsAssignedToOrgRoleIter(ctx context.Context, org string, roleID int64, opts *ListOptions) iter.Seq2[*Team, error] { + return func(yield func(*Team, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeamsAssignedToOrgRole(ctx, org, roleID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListUsersAssignedToOrgRoleIter returns an iterator that paginates through all results of ListUsersAssignedToOrgRole. +func (s *OrganizationsService) ListUsersAssignedToOrgRoleIter(ctx context.Context, org string, roleID int64, opts *ListOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUsersAssignedToOrgRole(ctx, org, roleID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrganizationPrivateRegistriesIter returns an iterator that paginates through all results of ListOrganizationPrivateRegistries. +func (s *PrivateRegistriesService) ListOrganizationPrivateRegistriesIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*PrivateRegistry, error] { + return func(yield func(*PrivateRegistry, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrganizationPrivateRegistries(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*PrivateRegistry + if results != nil { + iterItems = results.Configurations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListOrganizationProjectFieldsIter returns an iterator that paginates through all results of ListOrganizationProjectFields. +func (s *ProjectsService) ListOrganizationProjectFieldsIter(ctx context.Context, org string, projectNumber int, opts *ListProjectsOptions) iter.Seq2[*ProjectV2Field, error] { + return func(yield func(*ProjectV2Field, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListProjectsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrganizationProjectFields(ctx, org, projectNumber, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListOrganizationProjectItemsIter returns an iterator that paginates through all results of ListOrganizationProjectItems. +func (s *ProjectsService) ListOrganizationProjectItemsIter(ctx context.Context, org string, projectNumber int, opts *ListProjectItemsOptions) iter.Seq2[*ProjectV2Item, error] { + return func(yield func(*ProjectV2Item, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListProjectItemsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrganizationProjectItems(ctx, org, projectNumber, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListOrganizationProjectsIter returns an iterator that paginates through all results of ListOrganizationProjects. +func (s *ProjectsService) ListOrganizationProjectsIter(ctx context.Context, org string, opts *ListProjectsOptions) iter.Seq2[*ProjectV2, error] { + return func(yield func(*ProjectV2, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListProjectsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListOrganizationProjects(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListUserProjectFieldsIter returns an iterator that paginates through all results of ListUserProjectFields. +func (s *ProjectsService) ListUserProjectFieldsIter(ctx context.Context, user string, projectNumber int, opts *ListProjectsOptions) iter.Seq2[*ProjectV2Field, error] { + return func(yield func(*ProjectV2Field, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListProjectsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserProjectFields(ctx, user, projectNumber, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListUserProjectItemsIter returns an iterator that paginates through all results of ListUserProjectItems. +func (s *ProjectsService) ListUserProjectItemsIter(ctx context.Context, username string, projectNumber int, opts *ListProjectItemsOptions) iter.Seq2[*ProjectV2Item, error] { + return func(yield func(*ProjectV2Item, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListProjectItemsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserProjectItems(ctx, username, projectNumber, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListUserProjectsIter returns an iterator that paginates through all results of ListUserProjects. +func (s *ProjectsService) ListUserProjectsIter(ctx context.Context, username string, opts *ListProjectsOptions) iter.Seq2[*ProjectV2, error] { + return func(yield func(*ProjectV2, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListProjectsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserProjects(ctx, username, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListIter returns an iterator that paginates through all results of List. +func (s *PullRequestsService) ListIter(ctx context.Context, owner string, repo string, opts *PullRequestListOptions) iter.Seq2[*PullRequest, error] { + return func(yield func(*PullRequest, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &PullRequestListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.List(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCommentsIter returns an iterator that paginates through all results of ListComments. +func (s *PullRequestsService) ListCommentsIter(ctx context.Context, owner string, repo string, number int, opts *PullRequestListCommentsOptions) iter.Seq2[*PullRequestComment, error] { + return func(yield func(*PullRequestComment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &PullRequestListCommentsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListComments(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCommitsIter returns an iterator that paginates through all results of ListCommits. +func (s *PullRequestsService) ListCommitsIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*RepositoryCommit, error] { + return func(yield func(*RepositoryCommit, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCommits(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListFilesIter returns an iterator that paginates through all results of ListFiles. +func (s *PullRequestsService) ListFilesIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*CommitFile, error] { + return func(yield func(*CommitFile, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListFiles(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListPullRequestsWithCommitIter returns an iterator that paginates through all results of ListPullRequestsWithCommit. +func (s *PullRequestsService) ListPullRequestsWithCommitIter(ctx context.Context, owner string, repo string, sha string, opts *ListOptions) iter.Seq2[*PullRequest, error] { + return func(yield func(*PullRequest, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPullRequestsWithCommit(ctx, owner, repo, sha, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListReviewCommentsIter returns an iterator that paginates through all results of ListReviewComments. +func (s *PullRequestsService) ListReviewCommentsIter(ctx context.Context, owner string, repo string, number int, reviewID int64, opts *ListOptions) iter.Seq2[*PullRequestComment, error] { + return func(yield func(*PullRequestComment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListReviewComments(ctx, owner, repo, number, reviewID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListReviewsIter returns an iterator that paginates through all results of ListReviews. +func (s *PullRequestsService) ListReviewsIter(ctx context.Context, owner string, repo string, number int, opts *ListOptions) iter.Seq2[*PullRequestReview, error] { + return func(yield func(*PullRequestReview, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListReviews(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCommentReactionsIter returns an iterator that paginates through all results of ListCommentReactions. +func (s *ReactionsService) ListCommentReactionsIter(ctx context.Context, owner string, repo string, id int64, opts *ListReactionOptions) iter.Seq2[*Reaction, error] { + return func(yield func(*Reaction, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListReactionOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCommentReactions(ctx, owner, repo, id, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListIssueCommentReactionsIter returns an iterator that paginates through all results of ListIssueCommentReactions. +func (s *ReactionsService) ListIssueCommentReactionsIter(ctx context.Context, owner string, repo string, id int64, opts *ListReactionOptions) iter.Seq2[*Reaction, error] { + return func(yield func(*Reaction, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListReactionOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListIssueCommentReactions(ctx, owner, repo, id, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListIssueReactionsIter returns an iterator that paginates through all results of ListIssueReactions. +func (s *ReactionsService) ListIssueReactionsIter(ctx context.Context, owner string, repo string, number int, opts *ListReactionOptions) iter.Seq2[*Reaction, error] { + return func(yield func(*Reaction, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListReactionOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListIssueReactions(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListPullRequestCommentReactionsIter returns an iterator that paginates through all results of ListPullRequestCommentReactions. +func (s *ReactionsService) ListPullRequestCommentReactionsIter(ctx context.Context, owner string, repo string, id int64, opts *ListReactionOptions) iter.Seq2[*Reaction, error] { + return func(yield func(*Reaction, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListReactionOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPullRequestCommentReactions(ctx, owner, repo, id, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListReleaseReactionsIter returns an iterator that paginates through all results of ListReleaseReactions. +func (s *ReactionsService) ListReleaseReactionsIter(ctx context.Context, owner string, repo string, releaseID int64, opts *ListReactionOptions) iter.Seq2[*Reaction, error] { + return func(yield func(*Reaction, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListReactionOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListReleaseReactions(ctx, owner, repo, releaseID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListTeamDiscussionCommentReactionsIter returns an iterator that paginates through all results of ListTeamDiscussionCommentReactions. +func (s *ReactionsService) ListTeamDiscussionCommentReactionsIter(ctx context.Context, teamID int64, discussionNumber int, commentNumber int, opts *ListReactionOptions) iter.Seq2[*Reaction, error] { + return func(yield func(*Reaction, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListReactionOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeamDiscussionCommentReactions(ctx, teamID, discussionNumber, commentNumber, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListTeamDiscussionReactionsIter returns an iterator that paginates through all results of ListTeamDiscussionReactions. +func (s *ReactionsService) ListTeamDiscussionReactionsIter(ctx context.Context, teamID int64, discussionNumber int, opts *ListReactionOptions) iter.Seq2[*Reaction, error] { + return func(yield func(*Reaction, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListReactionOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeamDiscussionReactions(ctx, teamID, discussionNumber, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListIter returns an iterator that paginates through all results of List. +func (s *RepositoriesService) ListIter(ctx context.Context, user string, opts *RepositoryListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &RepositoryListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.List(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAllTopicsIter returns an iterator that paginates through all results of ListAllTopics. +func (s *RepositoriesService) ListAllTopicsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[string, error] { + return func(yield func(string, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAllTopics(ctx, owner, repo, opts) + if err != nil { + yield(*new(string), err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListAttestationsIter returns an iterator that paginates through all results of ListAttestations. +func (s *RepositoriesService) ListAttestationsIter(ctx context.Context, owner string, repo string, subjectDigest string, opts *ListOptions) iter.Seq2[*Attestation, error] { + return func(yield func(*Attestation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAttestations(ctx, owner, repo, subjectDigest, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Attestation + if results != nil { + iterItems = results.Attestations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListBranchesIter returns an iterator that paginates through all results of ListBranches. +func (s *RepositoriesService) ListBranchesIter(ctx context.Context, owner string, repo string, opts *BranchListOptions) iter.Seq2[*Branch, error] { + return func(yield func(*Branch, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &BranchListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListBranches(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListByAuthenticatedUserIter returns an iterator that paginates through all results of ListByAuthenticatedUser. +func (s *RepositoriesService) ListByAuthenticatedUserIter(ctx context.Context, opts *RepositoryListByAuthenticatedUserOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &RepositoryListByAuthenticatedUserOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListByAuthenticatedUser(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListByOrgIter returns an iterator that paginates through all results of ListByOrg. +func (s *RepositoriesService) ListByOrgIter(ctx context.Context, org string, opts *RepositoryListByOrgOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &RepositoryListByOrgOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListByOrg(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListByUserIter returns an iterator that paginates through all results of ListByUser. +func (s *RepositoriesService) ListByUserIter(ctx context.Context, user string, opts *RepositoryListByUserOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &RepositoryListByUserOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListByUser(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCollaboratorsIter returns an iterator that paginates through all results of ListCollaborators. +func (s *RepositoriesService) ListCollaboratorsIter(ctx context.Context, owner string, repo string, opts *ListCollaboratorsOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCollaboratorsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCollaborators(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCommentsIter returns an iterator that paginates through all results of ListComments. +func (s *RepositoriesService) ListCommentsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*RepositoryComment, error] { + return func(yield func(*RepositoryComment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListComments(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCommitCommentsIter returns an iterator that paginates through all results of ListCommitComments. +func (s *RepositoriesService) ListCommitCommentsIter(ctx context.Context, owner string, repo string, sha string, opts *ListOptions) iter.Seq2[*RepositoryComment, error] { + return func(yield func(*RepositoryComment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCommitComments(ctx, owner, repo, sha, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCommitsIter returns an iterator that paginates through all results of ListCommits. +func (s *RepositoriesService) ListCommitsIter(ctx context.Context, owner string, repo string, opts *CommitsListOptions) iter.Seq2[*RepositoryCommit, error] { + return func(yield func(*RepositoryCommit, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &CommitsListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCommits(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListContributorsIter returns an iterator that paginates through all results of ListContributors. +func (s *RepositoriesService) ListContributorsIter(ctx context.Context, owner string, repository string, opts *ListContributorsOptions) iter.Seq2[*Contributor, error] { + return func(yield func(*Contributor, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListContributorsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListContributors(ctx, owner, repository, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListCustomDeploymentRuleIntegrationsIter returns an iterator that paginates through all results of ListCustomDeploymentRuleIntegrations. +func (s *RepositoriesService) ListCustomDeploymentRuleIntegrationsIter(ctx context.Context, owner string, repo string, environment string, opts *ListOptions) iter.Seq2[*CustomDeploymentProtectionRuleApp, error] { + return func(yield func(*CustomDeploymentProtectionRuleApp, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListCustomDeploymentRuleIntegrations(ctx, owner, repo, environment, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*CustomDeploymentProtectionRuleApp + if results != nil { + iterItems = results.AvailableIntegrations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListDeploymentBranchPoliciesIter returns an iterator that paginates through all results of ListDeploymentBranchPolicies. +func (s *RepositoriesService) ListDeploymentBranchPoliciesIter(ctx context.Context, owner string, repo string, environment string, opts *ListOptions) iter.Seq2[*DeploymentBranchPolicy, error] { + return func(yield func(*DeploymentBranchPolicy, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListDeploymentBranchPolicies(ctx, owner, repo, environment, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*DeploymentBranchPolicy + if results != nil { + iterItems = results.BranchPolicies + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListDeploymentStatusesIter returns an iterator that paginates through all results of ListDeploymentStatuses. +func (s *RepositoriesService) ListDeploymentStatusesIter(ctx context.Context, owner string, repo string, deployment int64, opts *ListOptions) iter.Seq2[*DeploymentStatus, error] { + return func(yield func(*DeploymentStatus, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListDeploymentStatuses(ctx, owner, repo, deployment, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListDeploymentsIter returns an iterator that paginates through all results of ListDeployments. +func (s *RepositoriesService) ListDeploymentsIter(ctx context.Context, owner string, repo string, opts *DeploymentsListOptions) iter.Seq2[*Deployment, error] { + return func(yield func(*Deployment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &DeploymentsListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListDeployments(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListEnvironmentsIter returns an iterator that paginates through all results of ListEnvironments. +func (s *RepositoriesService) ListEnvironmentsIter(ctx context.Context, owner string, repo string, opts *EnvironmentListOptions) iter.Seq2[*Environment, error] { + return func(yield func(*Environment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &EnvironmentListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEnvironments(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Environment + if results != nil { + iterItems = results.Environments + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListForksIter returns an iterator that paginates through all results of ListForks. +func (s *RepositoriesService) ListForksIter(ctx context.Context, owner string, repo string, opts *RepositoryListForksOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &RepositoryListForksOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListForks(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListHookDeliveriesIter returns an iterator that paginates through all results of ListHookDeliveries. +func (s *RepositoriesService) ListHookDeliveriesIter(ctx context.Context, owner string, repo string, id int64, opts *ListCursorOptions) iter.Seq2[*HookDelivery, error] { + return func(yield func(*HookDelivery, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCursorOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListHookDeliveries(ctx, owner, repo, id, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListHooksIter returns an iterator that paginates through all results of ListHooks. +func (s *RepositoriesService) ListHooksIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Hook, error] { + return func(yield func(*Hook, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListHooks(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListInvitationsIter returns an iterator that paginates through all results of ListInvitations. +func (s *RepositoriesService) ListInvitationsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*RepositoryInvitation, error] { + return func(yield func(*RepositoryInvitation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListInvitations(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListKeysIter returns an iterator that paginates through all results of ListKeys. +func (s *RepositoriesService) ListKeysIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Key, error] { + return func(yield func(*Key, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListKeys(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListPagesBuildsIter returns an iterator that paginates through all results of ListPagesBuilds. +func (s *RepositoriesService) ListPagesBuildsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*PagesBuild, error] { + return func(yield func(*PagesBuild, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPagesBuilds(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListPreReceiveHooksIter returns an iterator that paginates through all results of ListPreReceiveHooks. +func (s *RepositoriesService) ListPreReceiveHooksIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*PreReceiveHook, error] { + return func(yield func(*PreReceiveHook, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPreReceiveHooks(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListReleaseAssetsIter returns an iterator that paginates through all results of ListReleaseAssets. +func (s *RepositoriesService) ListReleaseAssetsIter(ctx context.Context, owner string, repo string, id int64, opts *ListOptions) iter.Seq2[*ReleaseAsset, error] { + return func(yield func(*ReleaseAsset, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListReleaseAssets(ctx, owner, repo, id, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListReleasesIter returns an iterator that paginates through all results of ListReleases. +func (s *RepositoriesService) ListReleasesIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*RepositoryRelease, error] { + return func(yield func(*RepositoryRelease, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListReleases(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListRepositoryActivitiesIter returns an iterator that paginates through all results of ListRepositoryActivities. +func (s *RepositoriesService) ListRepositoryActivitiesIter(ctx context.Context, owner string, repo string, opts *ListRepositoryActivityOptions) iter.Seq2[*RepositoryActivity, error] { + return func(yield func(*RepositoryActivity, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListRepositoryActivityOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositoryActivities(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// ListStatusesIter returns an iterator that paginates through all results of ListStatuses. +func (s *RepositoriesService) ListStatusesIter(ctx context.Context, owner string, repo string, ref string, opts *ListOptions) iter.Seq2[*RepoStatus, error] { + return func(yield func(*RepoStatus, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListStatuses(ctx, owner, repo, ref, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListTagsIter returns an iterator that paginates through all results of ListTags. +func (s *RepositoriesService) ListTagsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*RepositoryTag, error] { + return func(yield func(*RepositoryTag, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTags(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListTeamsIter returns an iterator that paginates through all results of ListTeams. +func (s *RepositoriesService) ListTeamsIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*Team, error] { + return func(yield func(*Team, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeams(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListAlertsForEnterpriseIter returns an iterator that paginates through all results of ListAlertsForEnterprise. +func (s *SecretScanningService) ListAlertsForEnterpriseIter(ctx context.Context, enterprise string, opts *SecretScanningAlertListOptions) iter.Seq2[*SecretScanningAlert, error] { + return func(yield func(*SecretScanningAlert, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &SecretScanningAlertListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAlertsForEnterprise(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" && resp.NextPage == 0 { + break + } + opts.ListCursorOptions.After = resp.After + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAlertsForOrgIter returns an iterator that paginates through all results of ListAlertsForOrg. +func (s *SecretScanningService) ListAlertsForOrgIter(ctx context.Context, org string, opts *SecretScanningAlertListOptions) iter.Seq2[*SecretScanningAlert, error] { + return func(yield func(*SecretScanningAlert, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &SecretScanningAlertListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAlertsForOrg(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" && resp.NextPage == 0 { + break + } + opts.ListCursorOptions.After = resp.After + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListAlertsForRepoIter returns an iterator that paginates through all results of ListAlertsForRepo. +func (s *SecretScanningService) ListAlertsForRepoIter(ctx context.Context, owner string, repo string, opts *SecretScanningAlertListOptions) iter.Seq2[*SecretScanningAlert, error] { + return func(yield func(*SecretScanningAlert, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &SecretScanningAlertListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAlertsForRepo(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" && resp.NextPage == 0 { + break + } + opts.ListCursorOptions.After = resp.After + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListLocationsForAlertIter returns an iterator that paginates through all results of ListLocationsForAlert. +func (s *SecretScanningService) ListLocationsForAlertIter(ctx context.Context, owner string, repo string, number int64, opts *ListOptions) iter.Seq2[*SecretScanningAlertLocation, error] { + return func(yield func(*SecretScanningAlertLocation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListLocationsForAlert(ctx, owner, repo, number, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListGlobalSecurityAdvisoriesIter returns an iterator that paginates through all results of ListGlobalSecurityAdvisories. +func (s *SecurityAdvisoriesService) ListGlobalSecurityAdvisoriesIter(ctx context.Context, opts *ListGlobalSecurityAdvisoriesOptions) iter.Seq2[*GlobalSecurityAdvisory, error] { + return func(yield func(*GlobalSecurityAdvisory, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListGlobalSecurityAdvisoriesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListGlobalSecurityAdvisories(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.ListCursorOptions.After = resp.After + } + } +} + +// ListRepositorySecurityAdvisoriesIter returns an iterator that paginates through all results of ListRepositorySecurityAdvisories. +func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesIter(ctx context.Context, owner string, repo string, opts *ListRepositorySecurityAdvisoriesOptions) iter.Seq2[*SecurityAdvisory, error] { + return func(yield func(*SecurityAdvisory, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListRepositorySecurityAdvisoriesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositorySecurityAdvisories(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.ListCursorOptions.After = resp.After + } + } +} + +// ListRepositorySecurityAdvisoriesForOrgIter returns an iterator that paginates through all results of ListRepositorySecurityAdvisoriesForOrg. +func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesForOrgIter(ctx context.Context, org string, opts *ListRepositorySecurityAdvisoriesOptions) iter.Seq2[*SecurityAdvisory, error] { + return func(yield func(*SecurityAdvisory, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListRepositorySecurityAdvisoriesOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListRepositorySecurityAdvisoriesForOrg(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.ListCursorOptions.After = resp.After + } + } +} + +// ListByIssueIter returns an iterator that paginates through all results of ListByIssue. +func (s *SubIssueService) ListByIssueIter(ctx context.Context, owner string, repo string, issueNumber int64, opts *ListOptions) iter.Seq2[*SubIssue, error] { + return func(yield func(*SubIssue, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListByIssue(ctx, owner, repo, issueNumber, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListChildTeamsByParentIDIter returns an iterator that paginates through all results of ListChildTeamsByParentID. +func (s *TeamsService) ListChildTeamsByParentIDIter(ctx context.Context, orgID int64, teamID int64, opts *ListOptions) iter.Seq2[*Team, error] { + return func(yield func(*Team, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListChildTeamsByParentID(ctx, orgID, teamID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListChildTeamsByParentSlugIter returns an iterator that paginates through all results of ListChildTeamsByParentSlug. +func (s *TeamsService) ListChildTeamsByParentSlugIter(ctx context.Context, org string, slug string, opts *ListOptions) iter.Seq2[*Team, error] { + return func(yield func(*Team, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListChildTeamsByParentSlug(ctx, org, slug, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCommentsByIDIter returns an iterator that paginates through all results of ListCommentsByID. +func (s *TeamsService) ListCommentsByIDIter(ctx context.Context, orgID int64, teamID int64, discussionNumber int, options *DiscussionCommentListOptions) iter.Seq2[*DiscussionComment, error] { + return func(yield func(*DiscussionComment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if options == nil { + options = &DiscussionCommentListOptions{} + } else { + options = Ptr(*options) + } + + for { + results, resp, err := s.ListCommentsByID(ctx, orgID, teamID, discussionNumber, options) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + options.ListOptions.Page = resp.NextPage + } + } +} + +// ListCommentsBySlugIter returns an iterator that paginates through all results of ListCommentsBySlug. +func (s *TeamsService) ListCommentsBySlugIter(ctx context.Context, org string, slug string, discussionNumber int, options *DiscussionCommentListOptions) iter.Seq2[*DiscussionComment, error] { + return func(yield func(*DiscussionComment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if options == nil { + options = &DiscussionCommentListOptions{} + } else { + options = Ptr(*options) + } + + for { + results, resp, err := s.ListCommentsBySlug(ctx, org, slug, discussionNumber, options) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + options.ListOptions.Page = resp.NextPage + } + } +} + +// ListDiscussionsByIDIter returns an iterator that paginates through all results of ListDiscussionsByID. +func (s *TeamsService) ListDiscussionsByIDIter(ctx context.Context, orgID int64, teamID int64, opts *DiscussionListOptions) iter.Seq2[*TeamDiscussion, error] { + return func(yield func(*TeamDiscussion, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &DiscussionListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListDiscussionsByID(ctx, orgID, teamID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListDiscussionsBySlugIter returns an iterator that paginates through all results of ListDiscussionsBySlug. +func (s *TeamsService) ListDiscussionsBySlugIter(ctx context.Context, org string, slug string, opts *DiscussionListOptions) iter.Seq2[*TeamDiscussion, error] { + return func(yield func(*TeamDiscussion, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &DiscussionListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListDiscussionsBySlug(ctx, org, slug, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListExternalGroupsIter returns an iterator that paginates through all results of ListExternalGroups. +func (s *TeamsService) ListExternalGroupsIter(ctx context.Context, org string, opts *ListExternalGroupsOptions) iter.Seq2[*ExternalGroup, error] { + return func(yield func(*ExternalGroup, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListExternalGroupsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListExternalGroups(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*ExternalGroup + if results != nil { + iterItems = results.Groups + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListIDPGroupsInOrganizationIter returns an iterator that paginates through all results of ListIDPGroupsInOrganization. +func (s *TeamsService) ListIDPGroupsInOrganizationIter(ctx context.Context, org string, opts *ListIDPGroupsOptions) iter.Seq2[*IDPGroup, error] { + return func(yield func(*IDPGroup, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListIDPGroupsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListIDPGroupsInOrganization(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*IDPGroup + if results != nil { + iterItems = results.Groups + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.ListCursorOptions.After = resp.After + } + } +} + +// ListPendingTeamInvitationsByIDIter returns an iterator that paginates through all results of ListPendingTeamInvitationsByID. +func (s *TeamsService) ListPendingTeamInvitationsByIDIter(ctx context.Context, orgID int64, teamID int64, opts *ListOptions) iter.Seq2[*Invitation, error] { + return func(yield func(*Invitation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPendingTeamInvitationsByID(ctx, orgID, teamID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListPendingTeamInvitationsBySlugIter returns an iterator that paginates through all results of ListPendingTeamInvitationsBySlug. +func (s *TeamsService) ListPendingTeamInvitationsBySlugIter(ctx context.Context, org string, slug string, opts *ListOptions) iter.Seq2[*Invitation, error] { + return func(yield func(*Invitation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPendingTeamInvitationsBySlug(ctx, org, slug, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListTeamMembersByIDIter returns an iterator that paginates through all results of ListTeamMembersByID. +func (s *TeamsService) ListTeamMembersByIDIter(ctx context.Context, orgID int64, teamID int64, opts *TeamListTeamMembersOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &TeamListTeamMembersOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeamMembersByID(ctx, orgID, teamID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListTeamMembersBySlugIter returns an iterator that paginates through all results of ListTeamMembersBySlug. +func (s *TeamsService) ListTeamMembersBySlugIter(ctx context.Context, org string, slug string, opts *TeamListTeamMembersOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &TeamListTeamMembersOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeamMembersBySlug(ctx, org, slug, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListTeamReposByIDIter returns an iterator that paginates through all results of ListTeamReposByID. +func (s *TeamsService) ListTeamReposByIDIter(ctx context.Context, orgID int64, teamID int64, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeamReposByID(ctx, orgID, teamID, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListTeamReposBySlugIter returns an iterator that paginates through all results of ListTeamReposBySlug. +func (s *TeamsService) ListTeamReposBySlugIter(ctx context.Context, org string, slug string, opts *ListOptions) iter.Seq2[*Repository, error] { + return func(yield func(*Repository, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeamReposBySlug(ctx, org, slug, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListTeamsIter returns an iterator that paginates through all results of ListTeams. +func (s *TeamsService) ListTeamsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*Team, error] { + return func(yield func(*Team, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListTeams(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListUserTeamsIter returns an iterator that paginates through all results of ListUserTeams. +func (s *TeamsService) ListUserTeamsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*Team, error] { + return func(yield func(*Team, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserTeams(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListAttestationsIter returns an iterator that paginates through all results of ListAttestations. +func (s *UsersService) ListAttestationsIter(ctx context.Context, user string, subjectDigest string, opts *ListOptions) iter.Seq2[*Attestation, error] { + return func(yield func(*Attestation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListAttestations(ctx, user, subjectDigest, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*Attestation + if results != nil { + iterItems = results.Attestations + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListBlockedUsersIter returns an iterator that paginates through all results of ListBlockedUsers. +func (s *UsersService) ListBlockedUsersIter(ctx context.Context, opts *ListOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListBlockedUsers(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListEmailsIter returns an iterator that paginates through all results of ListEmails. +func (s *UsersService) ListEmailsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*UserEmail, error] { + return func(yield func(*UserEmail, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListEmails(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListFollowersIter returns an iterator that paginates through all results of ListFollowers. +func (s *UsersService) ListFollowersIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListFollowers(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListFollowingIter returns an iterator that paginates through all results of ListFollowing. +func (s *UsersService) ListFollowingIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*User, error] { + return func(yield func(*User, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListFollowing(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListGPGKeysIter returns an iterator that paginates through all results of ListGPGKeys. +func (s *UsersService) ListGPGKeysIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*GPGKey, error] { + return func(yield func(*GPGKey, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListGPGKeys(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListInvitationsIter returns an iterator that paginates through all results of ListInvitations. +func (s *UsersService) ListInvitationsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*RepositoryInvitation, error] { + return func(yield func(*RepositoryInvitation, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListInvitations(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListKeysIter returns an iterator that paginates through all results of ListKeys. +func (s *UsersService) ListKeysIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*Key, error] { + return func(yield func(*Key, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListKeys(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListPackageVersionsIter returns an iterator that paginates through all results of ListPackageVersions. +func (s *UsersService) ListPackageVersionsIter(ctx context.Context, packageType string, packageName string, opts *ListPackageVersionsOptions) iter.Seq2[*PackageVersion, error] { + return func(yield func(*PackageVersion, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListPackageVersionsOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPackageVersions(ctx, packageType, packageName, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListPackagesIter returns an iterator that paginates through all results of ListPackages. +func (s *UsersService) ListPackagesIter(ctx context.Context, user string, opts *PackageListOptions) iter.Seq2[*Package, error] { + return func(yield func(*Package, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &PackageListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListPackages(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListSSHSigningKeysIter returns an iterator that paginates through all results of ListSSHSigningKeys. +func (s *UsersService) ListSSHSigningKeysIter(ctx context.Context, user string, opts *ListOptions) iter.Seq2[*SSHSigningKey, error] { + return func(yield func(*SSHSigningKey, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListSSHSigningKeys(ctx, user, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListSocialAccountsIter returns an iterator that paginates through all results of ListSocialAccounts. +func (s *UsersService) ListSocialAccountsIter(ctx context.Context, opts *ListOptions) iter.Seq2[*SocialAccount, error] { + return func(yield func(*SocialAccount, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListSocialAccounts(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListUserSocialAccountsIter returns an iterator that paginates through all results of ListUserSocialAccounts. +func (s *UsersService) ListUserSocialAccountsIter(ctx context.Context, username string, opts *ListOptions) iter.Seq2[*SocialAccount, error] { + return func(yield func(*SocialAccount, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = Ptr(*opts) + } + + for { + results, resp, err := s.ListUserSocialAccounts(ctx, username, opts) + if err != nil { + yield(nil, err) + return + } + + for _, item := range results { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} diff --git a/vendor/github.com/google/go-github/v75/github/github.go b/vendor/github.com/google/go-github/v84/github/github.go similarity index 93% rename from vendor/github.com/google/go-github/v75/github/github.go rename to vendor/github.com/google/go-github/v84/github/github.go index ac2a961d6..9c2cafcce 100644 --- a/vendor/github.com/google/go-github/v75/github/github.go +++ b/vendor/github.com/google/go-github/v84/github/github.go @@ -4,8 +4,9 @@ // license that can be found in the LICENSE file. //go:generate go run gen-accessors.go +//go:generate go run gen-iterators.go //go:generate go run gen-stringify-test.go -//go:generate ../script/metadata.sh update-go +//go:generate sh ../script/metadata.sh update-go package github @@ -18,7 +19,6 @@ import ( "io" "net/http" "net/url" - "reflect" "regexp" "strconv" "strings" @@ -29,21 +29,23 @@ import ( ) const ( - Version = "v75.0.0" + Version = "v84.0.0" + + HeaderRateLimit = "X-Ratelimit-Limit" + HeaderRateRemaining = "X-Ratelimit-Remaining" + HeaderRateReset = "X-Ratelimit-Reset" + HeaderRateResource = "X-Ratelimit-Resource" + HeaderRateUsed = "X-Ratelimit-Used" + HeaderRequestID = "X-Github-Request-Id" defaultAPIVersion = "2022-11-28" defaultBaseURL = "https://api.github.com/" defaultUserAgent = "go-github" + "/" + Version uploadBaseURL = "https://uploads.github.com/" - headerAPIVersion = "X-Github-Api-Version" - headerRateLimit = "X-Ratelimit-Limit" - headerRateRemaining = "X-Ratelimit-Remaining" - headerRateUsed = "X-Ratelimit-Used" - headerRateReset = "X-Ratelimit-Reset" - headerRateResource = "X-Ratelimit-Resource" - headerOTP = "X-Github-Otp" - headerRetryAfter = "Retry-After" + headerAPIVersion = "X-Github-Api-Version" + headerOTP = "X-Github-Otp" + headerRetryAfter = "Retry-After" headerTokenExpiration = "Github-Authentication-Token-Expiration" @@ -55,8 +57,9 @@ const ( mediaTypeOrgPermissionRepo = "application/vnd.github.v3.repository+json" mediaTypeIssueImportAPI = "application/vnd.github.golden-comet-preview+json" mediaTypeStarring = "application/vnd.github.star+json" + mediaTypeSCIM = "application/scim+json" - // Media Type values to access preview APIs + // Media Type values to access preview APIs. // These media types will be added to the API request as headers // and used to enable particular features on GitHub API that are still in preview. // After some time, specific media types will be promoted (to a "stable" state). @@ -71,7 +74,7 @@ const ( // versions. Additionally, non-functional (preview) headers don't create any side effects // on GitHub Cloud version. // - // See https://github.com/google/go-github/pull/2125 for full context. + // See https://github.com/google/go-github/pull/2125 and https://github.com/google/go-github/pull/2188 for full context. // https://help.github.com/enterprise/2.4/admin/guides/migrations/exporting-the-github-com-organization-s-repositories/ mediaTypeMigrationsPreview = "application/vnd.github.wyandotte-preview+json" @@ -202,6 +205,7 @@ type Client struct { CodesOfConduct *CodesOfConductService Codespaces *CodespacesService Copilot *CopilotService + Credentials *CredentialsService Dependabot *DependabotService DependencyGraph *DependencyGraphService Emojis *EmojisService @@ -218,6 +222,8 @@ type Client struct { Meta *MetaService Migrations *MigrationService Organizations *OrganizationsService + PrivateRegistries *PrivateRegistriesService + Projects *ProjectsService PullRequests *PullRequestsService RateLimit *RateLimitService Reactions *ReactionsService @@ -305,11 +311,12 @@ type RawOptions struct { Type RawType } +type structPtr[T any] interface{ *T } + // addOptions adds the parameters in opts as URL query parameters to s. opts // must be a struct whose fields may contain "url" tags. -func addOptions(s string, opts any) (string, error) { - v := reflect.ValueOf(opts) - if v.Kind() == reflect.Ptr && v.IsNil() { +func addOptions[P structPtr[T], T any](s string, opts P) (string, error) { + if opts == nil { return s, nil } @@ -332,6 +339,10 @@ func addOptions(s string, opts any) (string, error) { // authentication, either use Client.WithAuthToken or provide NewClient with // an http.Client that will perform the authentication for you (such as that // provided by the golang.org/x/oauth2 library). +// +// Note: When using a nil httpClient, the default client has no timeout set. +// This may not be suitable for production environments. It is recommended to +// provide a custom http.Client with an appropriate timeout. func NewClient(httpClient *http.Client) *Client { if httpClient == nil { httpClient = &http.Client{} @@ -353,7 +364,9 @@ func (c *Client) WithAuthToken(token string) *Client { c2.client.Transport = roundTripperFunc( func(req *http.Request) (*http.Response, error) { req = req.Clone(req.Context()) - req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) + if token != "" { + req.Header.Set("Authorization", fmt.Sprintf("Bearer %v", token)) + } return transport.RoundTrip(req) }, ) @@ -399,7 +412,8 @@ func (c *Client) WithEnterpriseURLs(baseURL, uploadURL string) (*Client, error) } if !strings.HasSuffix(c2.UploadURL.Path, "/api/uploads/") && !strings.HasPrefix(c2.UploadURL.Host, "api.") && - !strings.Contains(c2.UploadURL.Host, ".api.") { + !strings.Contains(c2.UploadURL.Host, ".api.") && + !strings.HasPrefix(c2.UploadURL.Host, "uploads.") { c2.UploadURL.Path += "api/uploads/" } return c2, nil @@ -440,6 +454,7 @@ func (c *Client) initialize() { c.Codespaces = (*CodespacesService)(&c.common) c.CodesOfConduct = (*CodesOfConductService)(&c.common) c.Copilot = (*CopilotService)(&c.common) + c.Credentials = (*CredentialsService)(&c.common) c.Dependabot = (*DependabotService)(&c.common) c.DependencyGraph = (*DependencyGraphService)(&c.common) c.Emojis = (*EmojisService)(&c.common) @@ -456,6 +471,8 @@ func (c *Client) initialize() { c.Meta = (*MetaService)(&c.common) c.Migrations = (*MigrationService)(&c.common) c.Organizations = (*OrganizationsService)(&c.common) + c.PrivateRegistries = (*PrivateRegistriesService)(&c.common) + c.Projects = (*ProjectsService)(&c.common) c.PullRequests = (*PullRequestsService)(&c.common) c.RateLimit = (*RateLimitService)(&c.common) c.Reactions = (*ReactionsService)(&c.common) @@ -500,6 +517,7 @@ func NewClientWithEnvProxy() *Client { } // NewTokenClient returns a new GitHub API client authenticated with the provided token. +// // Deprecated: Use NewClient(nil).WithAuthToken(token) instead. func NewTokenClient(_ context.Context, token string) *Client { // This always returns a nil error. @@ -587,7 +605,7 @@ func (c *Client) NewFormRequest(urlStr string, body io.Reader, opts ...RequestOp return nil, err } - req, err := http.NewRequest(http.MethodPost, u.String(), body) + req, err := http.NewRequest("POST", u.String(), body) if err != nil { return nil, err } @@ -703,7 +721,7 @@ func newResponse(r *http.Response) *Response { // various pagination link values in the Response. func (r *Response) populatePageValues() { if links, ok := r.Response.Header["Link"]; ok && len(links) > 0 { - for _, link := range strings.Split(links[0], ",") { + for link := range strings.SplitSeq(links[0], ",") { segments := strings.Split(strings.TrimSpace(link), ";") // link must at least have href and rel @@ -726,8 +744,7 @@ func (r *Response) populatePageValues() { if cursor := q.Get("cursor"); cursor != "" { for _, segment := range segments[1:] { - switch strings.TrimSpace(segment) { - case `rel="next"`: + if strings.TrimSpace(segment) == `rel="next"` { r.Cursor = cursor } } @@ -771,21 +788,21 @@ func (r *Response) populatePageValues() { // parseRate parses the rate related headers. func parseRate(r *http.Response) Rate { var rate Rate - if limit := r.Header.Get(headerRateLimit); limit != "" { + if limit := r.Header.Get(HeaderRateLimit); limit != "" { rate.Limit, _ = strconv.Atoi(limit) } - if remaining := r.Header.Get(headerRateRemaining); remaining != "" { + if remaining := r.Header.Get(HeaderRateRemaining); remaining != "" { rate.Remaining, _ = strconv.Atoi(remaining) } - if used := r.Header.Get(headerRateUsed); used != "" { + if used := r.Header.Get(HeaderRateUsed); used != "" { rate.Used, _ = strconv.Atoi(used) } - if reset := r.Header.Get(headerRateReset); reset != "" { + if reset := r.Header.Get(HeaderRateReset); reset != "" { if v, _ := strconv.ParseInt(reset, 10, 64); v != 0 { rate.Reset = Timestamp{time.Unix(v, 0)} } } - if resource := r.Header.Get(headerRateResource); resource != "" { + if resource := r.Header.Get(HeaderRateResource); resource != "" { rate.Resource = resource } return rate @@ -806,7 +823,7 @@ func parseSecondaryRate(r *http.Response) *time.Duration { // According to GitHub support, endpoints might return x-ratelimit-reset instead, // as an integer which represents the number of seconds since epoch UTC, // representing the time to resume making requests. - if v := r.Header.Get(headerRateReset); v != "" { + if v := r.Header.Get(HeaderRateReset); v != "" { secondsSinceEpoch, _ := strconv.ParseInt(v, 10, 64) // Error handling is noop. retryAfter := time.Until(time.Unix(secondsSinceEpoch, 0)) return &retryAfter @@ -844,7 +861,7 @@ const ( // bareDo sends an API request using `caller` http.Client passed in the parameters // and lets you handle the api response. If an error or API Error occurs, the error -// will contain more information. Otherwise you are supposed to read and close the +// will contain more information. Otherwise, you are supposed to read and close the // response's Body. If rate limit is exceeded and reset time is in the future, // bareDo returns *RateLimitError immediately without making a network API call. // @@ -896,7 +913,8 @@ func (c *Client) bareDo(ctx context.Context, caller *http.Client, req *http.Requ } // If the error type is *url.Error, sanitize its URL before returning. - if e, ok := err.(*url.Error); ok { + var e *url.Error + if errors.As(err, &e) { if url, err := url.Parse(e.URL); err == nil { e.URL = sanitizeURL(url).String() return response, e @@ -923,8 +941,8 @@ func (c *Client) bareDo(ctx context.Context, caller *http.Client, req *http.Requ // added to the AcceptedError and returned. // // Issue #1022 - aerr, ok := err.(*AcceptedError) - if ok { + var aerr *AcceptedError + if errors.As(err, &aerr) { b, readErr := io.ReadAll(resp.Body) if readErr != nil { return response, readErr @@ -934,8 +952,9 @@ func (c *Client) bareDo(ctx context.Context, caller *http.Client, req *http.Requ err = aerr } - rateLimitError, ok := err.(*RateLimitError) - if ok && req.Context().Value(SleepUntilPrimaryRateLimitResetWhenRateLimited) != nil { + var rateLimitError *RateLimitError + if errors.As(err, &rateLimitError) && + req.Context().Value(SleepUntilPrimaryRateLimitResetWhenRateLimited) != nil { if err := sleepUntilResetWithBuffer(req.Context(), rateLimitError.Rate.Reset.Time); err != nil { return response, err } @@ -944,8 +963,8 @@ func (c *Client) bareDo(ctx context.Context, caller *http.Client, req *http.Requ } // Update the secondary rate limit if we hit it. - rerr, ok := err.(*AbuseRateLimitError) - if ok && rerr.RetryAfter != nil { + var rerr *AbuseRateLimitError + if errors.As(err, &rerr) && rerr.RetryAfter != nil { // if a max duration is specified, make sure that we are waiting at most this duration if c.MaxSecondaryRateLimitRetryAfterDuration > 0 && rerr.GetRetryAfter() > c.MaxSecondaryRateLimitRetryAfterDuration { rerr.RetryAfter = &c.MaxSecondaryRateLimitRetryAfterDuration @@ -959,7 +978,7 @@ func (c *Client) bareDo(ctx context.Context, caller *http.Client, req *http.Requ } // BareDo sends an API request and lets you handle the api response. If an error -// or API Error occurs, the error will contain more information. Otherwise you +// or API Error occurs, the error will contain more information. Otherwise, you // are supposed to read and close the response's Body. If rate limit is exceeded // and reset time is in the future, BareDo returns *RateLimitError immediately // without making a network API call. @@ -992,8 +1011,8 @@ var errInvalidLocation = errors.New("invalid or empty Location header in redirec func (c *Client) bareDoUntilFound(ctx context.Context, req *http.Request, maxRedirects int) (*url.URL, *Response, error) { response, err := c.bareDoIgnoreRedirects(ctx, req) if err != nil { - rerr, ok := err.(*RedirectionError) - if ok { + var rerr *RedirectionError + if errors.As(err, &rerr) { // If we receive a 302, transform potential relative locations into absolute and return it. if rerr.StatusCode == http.StatusFound { if rerr.Location == nil { @@ -1167,13 +1186,13 @@ type ErrorBlock struct { func (r *ErrorResponse) Error() string { if r.Response != nil && r.Response.Request != nil { - return fmt.Sprintf("%v %v: %d %v %+v", + return fmt.Sprintf("%v %v: %v %v %+v", r.Response.Request.Method, sanitizeURL(r.Response.Request.URL), r.Response.StatusCode, r.Message, r.Errors) } if r.Response != nil { - return fmt.Sprintf("%d %v %+v", r.Response.StatusCode, r.Message, r.Errors) + return fmt.Sprintf("%v %v %+v", r.Response.StatusCode, r.Message, r.Errors) } return fmt.Sprintf("%v %+v", r.Message, r.Errors) @@ -1181,8 +1200,8 @@ func (r *ErrorResponse) Error() string { // Is returns whether the provided error equals this error. func (r *ErrorResponse) Is(target error) bool { - v, ok := target.(*ErrorResponse) - if !ok { + var v *ErrorResponse + if !errors.As(target, &v) { return false } @@ -1239,15 +1258,15 @@ type RateLimitError struct { } func (r *RateLimitError) Error() string { - return fmt.Sprintf("%v %v: %d %v %v", + return fmt.Sprintf("%v %v: %v %v %v", r.Response.Request.Method, sanitizeURL(r.Response.Request.URL), r.Response.StatusCode, r.Message, formatRateReset(time.Until(r.Rate.Reset.Time))) } // Is returns whether the provided error equals this error. func (r *RateLimitError) Is(target error) bool { - v, ok := target.(*RateLimitError) - if !ok { + var v *RateLimitError + if !errors.As(target, &v) { return false } @@ -1273,8 +1292,8 @@ func (*AcceptedError) Error() string { // Is returns whether the provided error equals this error. func (ae *AcceptedError) Is(target error) bool { - v, ok := target.(*AcceptedError) - if !ok { + var v *AcceptedError + if !errors.As(target, &v) { return false } return bytes.Equal(ae.Raw, v.Raw) @@ -1293,15 +1312,15 @@ type AbuseRateLimitError struct { } func (r *AbuseRateLimitError) Error() string { - return fmt.Sprintf("%v %v: %d %v", + return fmt.Sprintf("%v %v: %v %v", r.Response.Request.Method, sanitizeURL(r.Response.Request.URL), r.Response.StatusCode, r.Message) } // Is returns whether the provided error equals this error. func (r *AbuseRateLimitError) Is(target error) bool { - v, ok := target.(*AbuseRateLimitError) - if !ok { + var v *AbuseRateLimitError + if !errors.As(target, &v) { return false } @@ -1327,15 +1346,15 @@ type RedirectionError struct { } func (r *RedirectionError) Error() string { - return fmt.Sprintf("%v %v: %d location %v", + return fmt.Sprintf("%v %v: %v location %v", r.Response.Request.Method, sanitizeURL(r.Response.Request.URL), r.StatusCode, sanitizeURL(r.Location)) } // Is returns whether the provided error equals this error. func (r *RedirectionError) Is(target error) bool { - v, ok := target.(*RedirectionError) - if !ok { + var v *RedirectionError + if !errors.As(target, &v) { return false } @@ -1435,13 +1454,18 @@ func CheckResponse(r *http.Response) error { switch { case r.StatusCode == http.StatusUnauthorized && strings.HasPrefix(r.Header.Get(headerOTP), "required"): return (*TwoFactorAuthError)(errorResponse) - case r.StatusCode == http.StatusForbidden && r.Header.Get(headerRateRemaining) == "0": + // Primary rate limit exceeded: GitHub returns 403 or 429 with X-RateLimit-Remaining: 0 + // See: https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api + case (r.StatusCode == http.StatusForbidden || r.StatusCode == http.StatusTooManyRequests) && + r.Header.Get(HeaderRateRemaining) == "0": return &RateLimitError{ Rate: parseRate(r), Response: errorResponse.Response, Message: errorResponse.Message, } - case r.StatusCode == http.StatusForbidden && + // Secondary rate limit exceeded: GitHub returns 403 or 429 with specific documentation_url + // See: https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api#about-secondary-rate-limits + case (r.StatusCode == http.StatusForbidden || r.StatusCode == http.StatusTooManyRequests) && (strings.HasSuffix(errorResponse.DocumentationURL, "#abuse-rate-limits") || strings.HasSuffix(errorResponse.DocumentationURL, "secondary-rate-limits")): abuseRateLimitError := &AbuseRateLimitError{ @@ -1486,7 +1510,8 @@ func parseBoolResponse(err error) (bool, error) { return true, nil } - if err, ok := err.(*ErrorResponse); ok && err.Response.StatusCode == http.StatusNotFound { + var rerr *ErrorResponse + if errors.As(err, &rerr) && rerr.Response.StatusCode == http.StatusNotFound { // Simply false. In this one case, we do not pass the error through. return false, nil } @@ -1510,6 +1535,7 @@ const ( DependencySnapshotsCategory CodeSearchCategory AuditLogCategory + DependencySBOMCategory Categories // An array of this length will be able to contain all rate limit categories. ) @@ -1525,7 +1551,7 @@ func GetRateLimitCategory(method, path string) RateLimitCategory { // https://docs.github.com/en/rest/search/search#search-code case strings.HasPrefix(path, "/search/code") && - method == http.MethodGet: + method == "GET": return CodeSearchCategory case strings.HasPrefix(path, "/search/"): @@ -1534,13 +1560,13 @@ func GetRateLimitCategory(method, path string) RateLimitCategory { return GraphqlCategory case strings.HasPrefix(path, "/app-manifests/") && strings.HasSuffix(path, "/conversions") && - method == http.MethodPost: + method == "POST": return IntegrationManifestCategory // https://docs.github.com/rest/migrations/source-imports#start-an-import case strings.HasPrefix(path, "/repos/") && strings.HasSuffix(path, "/import") && - method == http.MethodPut: + method == "PUT": return SourceImportCategory // https://docs.github.com/rest/code-scanning#upload-an-analysis-as-sarif-data @@ -1554,12 +1580,17 @@ func GetRateLimitCategory(method, path string) RateLimitCategory { // https://docs.github.com/en/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository case strings.HasPrefix(path, "/repos/") && strings.HasSuffix(path, "/dependency-graph/snapshots") && - method == http.MethodPost: + method == "POST": return DependencySnapshotsCategory // https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/orgs?apiVersion=2022-11-28#get-the-audit-log-for-an-organization case strings.HasSuffix(path, "/audit-log"): return AuditLogCategory + + // https://docs.github.com/en/rest/dependency-graph/sboms?apiVersion=2022-11-28#export-a-software-bill-of-materials-sbom-for-a-repository + case strings.HasPrefix(path, "/repos/") && + strings.HasSuffix(path, "/dependency-graph/sbom"): + return DependencySBOMCategory } } @@ -1696,9 +1727,9 @@ func formatRateReset(d time.Duration) string { var timeString string if minutes > 0 { - timeString = fmt.Sprintf("%dm%02ds", minutes, seconds) + timeString = fmt.Sprintf("%vm%02ds", minutes, seconds) } else { - timeString = fmt.Sprintf("%ds", seconds) + timeString = fmt.Sprintf("%vs", seconds) } if isNegative { @@ -1760,25 +1791,33 @@ func Ptr[T any](v T) *T { // to store v and returns a pointer to it. // // Deprecated: use Ptr instead. -func Bool(v bool) *bool { return &v } +// +//go:fix inline +func Bool(v bool) *bool { return Ptr(v) } // Int is a helper routine that allocates a new int value // to store v and returns a pointer to it. // // Deprecated: use Ptr instead. -func Int(v int) *int { return &v } +// +//go:fix inline +func Int(v int) *int { return Ptr(v) } // Int64 is a helper routine that allocates a new int64 value // to store v and returns a pointer to it. // // Deprecated: use Ptr instead. -func Int64(v int64) *int64 { return &v } +// +//go:fix inline +func Int64(v int64) *int64 { return Ptr(v) } // String is a helper routine that allocates a new string value // to store v and returns a pointer to it. // // Deprecated: use Ptr instead. -func String(v string) *string { return &v } +// +//go:fix inline +func String(v string) *string { return Ptr(v) } // roundTripperFunc creates a RoundTripper (transport). type roundTripperFunc func(*http.Request) (*http.Response, error) diff --git a/vendor/github.com/google/go-github/v75/github/gitignore.go b/vendor/github.com/google/go-github/v84/github/gitignore.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/gitignore.go rename to vendor/github.com/google/go-github/v84/github/gitignore.go diff --git a/vendor/github.com/google/go-github/v75/github/interactions.go b/vendor/github.com/google/go-github/v84/github/interactions.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/interactions.go rename to vendor/github.com/google/go-github/v84/github/interactions.go diff --git a/vendor/github.com/google/go-github/v75/github/interactions_orgs.go b/vendor/github.com/google/go-github/v84/github/interactions_orgs.go similarity index 93% rename from vendor/github.com/google/go-github/v75/github/interactions_orgs.go rename to vendor/github.com/google/go-github/v84/github/interactions_orgs.go index 47998c4ee..55f254817 100644 --- a/vendor/github.com/google/go-github/v75/github/interactions_orgs.go +++ b/vendor/github.com/google/go-github/v84/github/interactions_orgs.go @@ -22,7 +22,6 @@ func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organiz return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) organizationInteractions := new(InteractionRestriction) @@ -54,7 +53,6 @@ func (s *InteractionsService) UpdateRestrictionsForOrg(ctx context.Context, orga return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) organizationInteractions := new(InteractionRestriction) @@ -79,7 +77,6 @@ func (s *InteractionsService) RemoveRestrictionsFromOrg(ctx context.Context, org return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) return s.client.Do(ctx, req, nil) diff --git a/vendor/github.com/google/go-github/v75/github/interactions_repos.go b/vendor/github.com/google/go-github/v84/github/interactions_repos.go similarity index 93% rename from vendor/github.com/google/go-github/v75/github/interactions_repos.go rename to vendor/github.com/google/go-github/v84/github/interactions_repos.go index 58fd4f04f..d99de494a 100644 --- a/vendor/github.com/google/go-github/v75/github/interactions_repos.go +++ b/vendor/github.com/google/go-github/v84/github/interactions_repos.go @@ -22,7 +22,6 @@ func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner, return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) repositoryInteractions := new(InteractionRestriction) @@ -54,7 +53,6 @@ func (s *InteractionsService) UpdateRestrictionsForRepo(ctx context.Context, own return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) repositoryInteractions := new(InteractionRestriction) @@ -79,7 +77,6 @@ func (s *InteractionsService) RemoveRestrictionsFromRepo(ctx context.Context, ow return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) return s.client.Do(ctx, req, nil) diff --git a/vendor/github.com/google/go-github/v75/github/issue_import.go b/vendor/github.com/google/go-github/v84/github/issue_import.go similarity index 95% rename from vendor/github.com/google/go-github/v75/github/issue_import.go rename to vendor/github.com/google/go-github/v84/github/issue_import.go index 4f0637108..ea42db1ba 100644 --- a/vendor/github.com/google/go-github/v75/github/issue_import.go +++ b/vendor/github.com/google/go-github/v84/github/issue_import.go @@ -9,6 +9,7 @@ import ( "bytes" "context" "encoding/json" + "errors" "fmt" ) @@ -80,14 +81,13 @@ func (s *IssueImportService) Create(ctx context.Context, owner, repo string, iss return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeIssueImportAPI) i := new(IssueImportResponse) resp, err := s.client.Do(ctx, req, i) if err != nil { - aerr, ok := err.(*AcceptedError) - if ok { + var aerr *AcceptedError + if errors.As(err, &aerr) { if err := json.Unmarshal(aerr.Raw, i); err != nil { return i, resp, err } @@ -111,7 +111,6 @@ func (s *IssueImportService) CheckStatus(ctx context.Context, owner, repo string return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeIssueImportAPI) i := new(IssueImportResponse) @@ -135,7 +134,6 @@ func (s *IssueImportService) CheckStatusSince(ctx context.Context, owner, repo s return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeIssueImportAPI) var b bytes.Buffer diff --git a/vendor/github.com/google/go-github/v75/github/issues.go b/vendor/github.com/google/go-github/v84/github/issues.go similarity index 75% rename from vendor/github.com/google/go-github/v75/github/issues.go rename to vendor/github.com/google/go-github/v84/github/issues.go index 18bd2eff4..c31bebe45 100644 --- a/vendor/github.com/google/go-github/v75/github/issues.go +++ b/vendor/github.com/google/go-github/v84/github/issues.go @@ -54,6 +54,7 @@ type Issue struct { EventsURL *string `json:"events_url,omitempty"` LabelsURL *string `json:"labels_url,omitempty"` RepositoryURL *string `json:"repository_url,omitempty"` + ParentIssueURL *string `json:"parent_issue_url,omitempty"` Milestone *Milestone `json:"milestone,omitempty"` PullRequestLinks *PullRequestLinks `json:"pull_request,omitempty"` Repository *Repository `json:"repository,omitempty"` @@ -99,11 +100,33 @@ type IssueRequest struct { Type *string `json:"type,omitempty"` } -// IssueListOptions specifies the optional parameters to the IssuesService.List -// and IssuesService.ListByOrg methods. -type IssueListOptions struct { +// PullRequestLinks object is added to the Issue object when it's an issue included +// in the IssueCommentEvent webhook payload, if the webhook is fired by a comment on a PR. +type PullRequestLinks struct { + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + DiffURL *string `json:"diff_url,omitempty"` + PatchURL *string `json:"patch_url,omitempty"` + MergedAt *Timestamp `json:"merged_at,omitempty"` +} + +// IssueType represents the type of issue. +// For now it shows up when receiving an Issue event. +type IssueType struct { + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + Color *string `json:"color,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +// ListAllIssuesOptions specifies the optional parameters to the +// IssuesService.ListAllIssues method. +type ListAllIssuesOptions struct { // Filter specifies which issues to list. Possible values are: assigned, - // created, mentioned, subscribed, all. Default is "assigned". + // created, mentioned, subscribed, repos, all. Default is "assigned". Filter string `url:"filter,omitempty"` // State filters issues based on their state. Possible values are: open, @@ -124,53 +147,129 @@ type IssueListOptions struct { // Since filters issues by time. Since time.Time `url:"since,omitempty"` - ListCursorOptions + Collab bool `url:"collab,omitempty"` + Orgs bool `url:"orgs,omitempty"` + Owned bool `url:"owned,omitempty"` + Pulls bool `url:"pulls,omitempty"` - // Add ListOptions so offset pagination with integer type "page" query parameter is accepted - // since ListCursorOptions accepts "page" as string only. ListOptions } -// PullRequestLinks object is added to the Issue object when it's an issue included -// in the IssueCommentEvent webhook payload, if the webhook is fired by a comment on a PR. -type PullRequestLinks struct { - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - DiffURL *string `json:"diff_url,omitempty"` - PatchURL *string `json:"patch_url,omitempty"` - MergedAt *Timestamp `json:"merged_at,omitempty"` +// ListAllIssues gets issues assigned to the authenticated user across all visible repositories including owned repositories, +// member repositories, and organization repositories. +// You can use the filter query parameter to fetch issues that are not necessarily assigned to you. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues#list-issues-assigned-to-the-authenticated-user +// +//meta:operation GET /issues +func (s *IssuesService) ListAllIssues(ctx context.Context, opts *ListAllIssuesOptions) ([]*Issue, *Response, error) { + u := "issues" + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + var issues []*Issue + resp, err := s.client.Do(ctx, req, &issues) + if err != nil { + return nil, resp, err + } + + return issues, resp, nil } -// IssueType represents the type of issue. -// For now it shows up when receiving an Issue event. -type IssueType struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Color *string `json:"color,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` +// ListUserIssuesOptions specifies the optional parameters to the +// IssuesService.ListUserIssues method. +type ListUserIssuesOptions struct { + // Filter specifies which issues to list. Possible values are: assigned, + // created, mentioned, subscribed, repos, all. Default is "assigned". + Filter string `url:"filter,omitempty"` + + // State filters issues based on their state. Possible values are: open, + // closed, all. Default is "open". + State string `url:"state,omitempty"` + + // Labels filters issues based on their label. + Labels []string `url:"labels,comma,omitempty"` + + // Sort specifies how to sort issues. Possible values are: created, updated, + // and comments. Default value is "created". + Sort string `url:"sort,omitempty"` + + // Direction in which to sort issues. Possible values are: asc, desc. + // Default is "desc". + Direction string `url:"direction,omitempty"` + + // Since filters issues by time. + Since time.Time `url:"since,omitempty"` + + ListOptions } -// List the issues for the authenticated user. If all is true, list issues -// across all the user's visible repositories including owned, member, and -// organization repositories; if false, list only owned and member -// repositories. +// ListUserIssues gets issues across owned and member repositories assigned to the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/issues/issues#list-issues-assigned-to-the-authenticated-user // GitHub API docs: https://docs.github.com/rest/issues/issues#list-user-account-issues-assigned-to-the-authenticated-user // -//meta:operation GET /issues //meta:operation GET /user/issues -func (s *IssuesService) List(ctx context.Context, all bool, opts *IssueListOptions) ([]*Issue, *Response, error) { - var u string - if all { - u = "issues" - } else { - u = "user/issues" +func (s *IssuesService) ListUserIssues(ctx context.Context, opts *ListUserIssuesOptions) ([]*Issue, *Response, error) { + u := "user/issues" + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + var issues []*Issue + resp, err := s.client.Do(ctx, req, &issues) + if err != nil { + return nil, resp, err } - return s.listIssues(ctx, u, opts) + + return issues, resp, nil +} + +// IssueListByOrgOptions specifies the optional parameters to the +// IssuesService.ListByOrg method. +type IssueListByOrgOptions struct { + // Filter specifies which issues to list. Possible values are: assigned, + // created, mentioned, subscribed, repos, all. Default is "assigned". + Filter string `url:"filter,omitempty"` + + // State filters issues based on their state. Possible values are: open, + // closed, all. Default is "open". + State string `url:"state,omitempty"` + + // Labels filters issues based on their label. + Labels []string `url:"labels,comma,omitempty"` + + // Type can be the name of an issue type. + Type string `url:"type,omitempty"` + + // Sort specifies how to sort issues. Possible values are: created, updated, + // and comments. Default value is "created". + Sort string `url:"sort,omitempty"` + + // Direction in which to sort issues. Possible values are: asc, desc. + // Default is "desc". + Direction string `url:"direction,omitempty"` + + // Since filters issues by time. + Since time.Time `url:"since,omitempty"` + + ListOptions } // ListByOrg fetches the issues in the specified organization for the @@ -179,12 +278,8 @@ func (s *IssuesService) List(ctx context.Context, all bool, opts *IssueListOptio // GitHub API docs: https://docs.github.com/rest/issues/issues#list-organization-issues-assigned-to-the-authenticated-user // //meta:operation GET /orgs/{org}/issues -func (s *IssuesService) ListByOrg(ctx context.Context, org string, opts *IssueListOptions) ([]*Issue, *Response, error) { +func (s *IssuesService) ListByOrg(ctx context.Context, org string, opts *IssueListByOrgOptions) ([]*Issue, *Response, error) { u := fmt.Sprintf("orgs/%v/issues", org) - return s.listIssues(ctx, u, opts) -} - -func (s *IssuesService) listIssues(ctx context.Context, u string, opts *IssueListOptions) ([]*Issue, *Response, error) { u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -195,7 +290,6 @@ func (s *IssuesService) listIssues(ctx context.Context, u string, opts *IssueLis return nil, nil, err } - // TODO: remove custom Accept header when this API fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var issues []*Issue @@ -224,6 +318,11 @@ type IssueListByRepoOptions struct { // any assigned user. Assignee string `url:"assignee,omitempty"` + // Type can be the name of an issue type. + // If the string * is passed, issues with any type are accepted. + // If the string none is passed, issues without type are returned. + Type string `url:"type,omitempty"` + // Creator filters issues based on their creator. Creator string `url:"creator,omitempty"` @@ -244,6 +343,7 @@ type IssueListByRepoOptions struct { // Since filters issues by time. Since time.Time `url:"since,omitempty"` + // ListCursorOptions specifies the optional parameters for cursor pagination. ListCursorOptions // Add ListOptions so offset pagination with integer type "page" query parameter is accepted @@ -268,7 +368,6 @@ func (s *IssuesService) ListByRepo(ctx context.Context, owner, repo string, opts return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeReactionsPreview) var issues []*Issue @@ -286,13 +385,12 @@ func (s *IssuesService) ListByRepo(ctx context.Context, owner, repo string, opts // //meta:operation GET /repos/{owner}/{repo}/issues/{issue_number} func (s *IssuesService) Get(ctx context.Context, owner, repo string, number int) (*Issue, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/issues/%v", owner, repo, number) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) issue := new(Issue) @@ -331,7 +429,7 @@ func (s *IssuesService) Create(ctx context.Context, owner, repo string, issue *I // //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) { - u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/issues/%v", owner, repo, number) req, err := s.client.NewRequest("PATCH", u, issue) if err != nil { return nil, nil, err @@ -386,7 +484,7 @@ type LockIssueOptions struct { // //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) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/issues/%v/lock", owner, repo, number) req, err := s.client.NewRequest("PUT", u, opts) if err != nil { return nil, err @@ -401,7 +499,7 @@ func (s *IssuesService) Lock(ctx context.Context, owner, repo string, number int // //meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock func (s *IssuesService) Unlock(ctx context.Context, owner, repo string, number int) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/issues/%v/lock", owner, repo, number) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err diff --git a/vendor/github.com/google/go-github/v75/github/issues_assignees.go b/vendor/github.com/google/go-github/v84/github/issues_assignees.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/issues_assignees.go rename to vendor/github.com/google/go-github/v84/github/issues_assignees.go diff --git a/vendor/github.com/google/go-github/v75/github/issues_comments.go b/vendor/github.com/google/go-github/v84/github/issues_comments.go similarity index 92% rename from vendor/github.com/google/go-github/v75/github/issues_comments.go rename to vendor/github.com/google/go-github/v84/github/issues_comments.go index 7e0629eb3..ef5314b18 100644 --- a/vendor/github.com/google/go-github/v75/github/issues_comments.go +++ b/vendor/github.com/google/go-github/v84/github/issues_comments.go @@ -55,6 +55,7 @@ type IssueListCommentsOptions struct { // number of 0 will return all comments on all issues for the repository. // // GitHub API docs: https://docs.github.com/rest/issues/comments#list-issue-comments +// // GitHub API docs: https://docs.github.com/rest/issues/comments#list-issue-comments-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/issues/comments @@ -64,7 +65,7 @@ func (s *IssuesService) ListComments(ctx context.Context, owner, repo string, nu if number == 0 { u = fmt.Sprintf("repos/%v/%v/issues/comments", owner, repo) } else { - u = fmt.Sprintf("repos/%v/%v/issues/%d/comments", owner, repo, number) + u = fmt.Sprintf("repos/%v/%v/issues/%v/comments", owner, repo, number) } u, err := addOptions(u, opts) if err != nil { @@ -76,7 +77,6 @@ func (s *IssuesService) ListComments(ctx context.Context, owner, repo string, nu return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeReactionsPreview) var comments []*IssueComment @@ -94,14 +94,13 @@ func (s *IssuesService) ListComments(ctx context.Context, owner, repo string, nu // //meta:operation GET /repos/{owner}/{repo}/issues/comments/{comment_id} func (s *IssuesService) GetComment(ctx context.Context, owner, repo string, commentID int64) (*IssueComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID) + u := fmt.Sprintf("repos/%v/%v/issues/comments/%v", owner, repo, commentID) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeReactionsPreview) comment := new(IssueComment) @@ -119,7 +118,7 @@ func (s *IssuesService) GetComment(ctx context.Context, owner, repo string, comm // //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) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/comments", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/issues/%v/comments", owner, repo, number) req, err := s.client.NewRequest("POST", u, comment) if err != nil { return nil, nil, err @@ -140,7 +139,7 @@ func (s *IssuesService) CreateComment(ctx context.Context, owner, repo string, n // //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) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID) + u := fmt.Sprintf("repos/%v/%v/issues/comments/%v", owner, repo, commentID) req, err := s.client.NewRequest("PATCH", u, comment) if err != nil { return nil, nil, err @@ -160,7 +159,7 @@ func (s *IssuesService) EditComment(ctx context.Context, owner, repo string, com // //meta:operation DELETE /repos/{owner}/{repo}/issues/comments/{comment_id} func (s *IssuesService) DeleteComment(ctx context.Context, owner, repo string, commentID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID) + u := fmt.Sprintf("repos/%v/%v/issues/comments/%v", owner, repo, commentID) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err diff --git a/vendor/github.com/google/go-github/v75/github/issues_events.go b/vendor/github.com/google/go-github/v84/github/issues_events.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/issues_events.go rename to vendor/github.com/google/go-github/v84/github/issues_events.go diff --git a/vendor/github.com/google/go-github/v75/github/issues_labels.go b/vendor/github.com/google/go-github/v84/github/issues_labels.go similarity index 94% rename from vendor/github.com/google/go-github/v75/github/issues_labels.go rename to vendor/github.com/google/go-github/v84/github/issues_labels.go index e2099034c..243670ec7 100644 --- a/vendor/github.com/google/go-github/v75/github/issues_labels.go +++ b/vendor/github.com/google/go-github/v84/github/issues_labels.go @@ -134,7 +134,7 @@ func (s *IssuesService) DeleteLabel(ctx context.Context, owner, repo, name strin // //meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/labels func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/issues/%v/labels", owner, repo, number) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -160,7 +160,7 @@ func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner, repo strin // //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) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/issues/%v/labels", owner, repo, number) req, err := s.client.NewRequest("POST", u, labels) if err != nil { return nil, nil, err @@ -181,7 +181,7 @@ func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner, repo string // //meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name} func (s *IssuesService) RemoveLabelForIssue(ctx context.Context, owner, repo string, number int, label string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels/%v", owner, repo, number, label) + u := fmt.Sprintf("repos/%v/%v/issues/%v/labels/%v", owner, repo, number, label) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err @@ -196,7 +196,7 @@ func (s *IssuesService) RemoveLabelForIssue(ctx context.Context, owner, repo str // //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) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/issues/%v/labels", owner, repo, number) req, err := s.client.NewRequest("PUT", u, labels) if err != nil { return nil, nil, err @@ -217,7 +217,7 @@ func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner, repo s // //meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels func (s *IssuesService) RemoveLabelsForIssue(ctx context.Context, owner, repo string, number int) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/issues/%v/labels", owner, repo, number) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err @@ -232,7 +232,7 @@ func (s *IssuesService) RemoveLabelsForIssue(ctx context.Context, owner, repo st // //meta:operation GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels func (s *IssuesService) ListLabelsForMilestone(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/milestones/%d/labels", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/milestones/%v/labels", owner, repo, number) u, err := addOptions(u, opts) if err != nil { return nil, nil, err diff --git a/vendor/github.com/google/go-github/v75/github/issues_milestones.go b/vendor/github.com/google/go-github/v84/github/issues_milestones.go similarity index 96% rename from vendor/github.com/google/go-github/v75/github/issues_milestones.go rename to vendor/github.com/google/go-github/v84/github/issues_milestones.go index 2aab88945..747829029 100644 --- a/vendor/github.com/google/go-github/v75/github/issues_milestones.go +++ b/vendor/github.com/google/go-github/v84/github/issues_milestones.go @@ -84,7 +84,7 @@ func (s *IssuesService) ListMilestones(ctx context.Context, owner, repo string, // //meta:operation GET /repos/{owner}/{repo}/milestones/{milestone_number} func (s *IssuesService) GetMilestone(ctx context.Context, owner, repo string, number int) (*Milestone, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/milestones/%v", owner, repo, number) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -126,7 +126,7 @@ func (s *IssuesService) CreateMilestone(ctx context.Context, owner, repo string, // //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) { - u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/milestones/%v", owner, repo, number) req, err := s.client.NewRequest("PATCH", u, milestone) if err != nil { return nil, nil, err @@ -147,7 +147,7 @@ func (s *IssuesService) EditMilestone(ctx context.Context, owner, repo string, n // //meta:operation DELETE /repos/{owner}/{repo}/milestones/{milestone_number} func (s *IssuesService) DeleteMilestone(ctx context.Context, owner, repo string, number int) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/milestones/%v", owner, repo, number) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err diff --git a/vendor/github.com/google/go-github/v75/github/issues_timeline.go b/vendor/github.com/google/go-github/v84/github/issues_timeline.go similarity index 99% rename from vendor/github.com/google/go-github/v75/github/issues_timeline.go rename to vendor/github.com/google/go-github/v84/github/issues_timeline.go index 903f5b89c..cea900ee6 100644 --- a/vendor/github.com/google/go-github/v75/github/issues_timeline.go +++ b/vendor/github.com/google/go-github/v84/github/issues_timeline.go @@ -188,7 +188,6 @@ func (s *IssuesService) ListIssueTimeline(ctx context.Context, owner, repo strin return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. acceptHeaders := []string{mediaTypeTimelinePreview, mediaTypeProjectCardDetailsPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) diff --git a/vendor/github.com/google/go-github/v75/github/licenses.go b/vendor/github.com/google/go-github/v84/github/licenses.go similarity index 84% rename from vendor/github.com/google/go-github/v75/github/licenses.go rename to vendor/github.com/google/go-github/v84/github/licenses.go index 34b8a3d8a..c589a8152 100644 --- a/vendor/github.com/google/go-github/v75/github/licenses.go +++ b/vendor/github.com/google/go-github/v84/github/licenses.go @@ -58,13 +58,26 @@ func (l License) String() string { return Stringify(l) } +// ListLicensesOptions specifies the optional parameters to the LicensesService.List method. +type ListLicensesOptions struct { + Featured *bool `url:"featured,omitempty"` + + ListOptions +} + // List popular open source licenses. // // GitHub API docs: https://docs.github.com/rest/licenses/licenses#get-all-commonly-used-licenses // //meta:operation GET /licenses -func (s *LicensesService) List(ctx context.Context) ([]*License, *Response, error) { - req, err := s.client.NewRequest("GET", "licenses", nil) +func (s *LicensesService) List(ctx context.Context, opts *ListLicensesOptions) ([]*License, *Response, error) { + u := "licenses" + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err } @@ -84,7 +97,7 @@ func (s *LicensesService) List(ctx context.Context) ([]*License, *Response, erro // //meta:operation GET /licenses/{license} func (s *LicensesService) Get(ctx context.Context, licenseName string) (*License, *Response, error) { - u := fmt.Sprintf("licenses/%s", licenseName) + u := fmt.Sprintf("licenses/%v", licenseName) req, err := s.client.NewRequest("GET", u, nil) if err != nil { diff --git a/vendor/github.com/google/go-github/v75/github/markdown.go b/vendor/github.com/google/go-github/v84/github/markdown.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/markdown.go rename to vendor/github.com/google/go-github/v84/github/markdown.go diff --git a/vendor/github.com/google/go-github/v75/github/messages.go b/vendor/github.com/google/go-github/v84/github/messages.go similarity index 98% rename from vendor/github.com/google/go-github/v75/github/messages.go rename to vendor/github.com/google/go-github/v84/github/messages.go index 21eb7c70c..c3d14acdc 100644 --- a/vendor/github.com/google/go-github/v75/github/messages.go +++ b/vendor/github.com/google/go-github/v84/github/messages.go @@ -19,11 +19,12 @@ import ( "fmt" "hash" "io" + "maps" "mime" "net/http" "net/url" "reflect" - "sort" + "slices" "strings" ) @@ -334,12 +335,7 @@ func ParseWebHook(messageType string, payload []byte) (any, error) { // MessageTypes returns a sorted list of all the known GitHub event type strings // supported by go-github. func MessageTypes() []string { - types := make([]string, 0, len(eventTypeMapping)) - for t := range eventTypeMapping { - types = append(types, t) - } - sort.Strings(types) - return types + return slices.Sorted(maps.Keys(eventTypeMapping)) } // EventForType returns an empty struct matching the specified GitHub event type. diff --git a/vendor/github.com/google/go-github/v75/github/meta.go b/vendor/github.com/google/go-github/v84/github/meta.go similarity index 89% rename from vendor/github.com/google/go-github/v75/github/meta.go rename to vendor/github.com/google/go-github/v84/github/meta.go index 0637dfe0d..6dd104c8c 100644 --- a/vendor/github.com/google/go-github/v75/github/meta.go +++ b/vendor/github.com/google/go-github/v84/github/meta.go @@ -56,6 +56,14 @@ type APIMeta struct { // GitHub Action macOS runner will originate from. ActionsMacos []string `json:"actions_macos,omitempty"` + // An array of IP addresses in CIDR format specifying the IP addresses + // GitHub Codespaces will originate from. + Codespaces []string `json:"codespaces,omitempty"` + + // An array of IP addresses in CIDR format specifying the IP addresses + // GitHub Copilot will originate from. + Copilot []string `json:"copilot,omitempty"` + // An array of IP addresses in CIDR format specifying the IP addresses // Dependabot will originate from. Dependabot []string `json:"dependabot,omitempty"` @@ -86,9 +94,16 @@ type APIMetaDomains struct { Copilot []string `json:"copilot,omitempty"` Packages []string `json:"packages,omitempty"` Actions []string `json:"actions,omitempty"` + ActionsInbound *ActionsInboundDomains `json:"actions_inbound,omitempty"` ArtifactAttestations *APIMetaArtifactAttestations `json:"artifact_attestations,omitempty"` } +// ActionsInboundDomains represents the domains associated with GitHub Actions inbound traffic. +type ActionsInboundDomains struct { + FullDomains []string `json:"full_domains,omitempty"` + WildcardDomains []string `json:"wildcard_domains,omitempty"` +} + // APIMetaArtifactAttestations represents the artifact attestation services domains. type APIMetaArtifactAttestations struct { TrustDomain string `json:"trust_domain,omitempty"` @@ -133,7 +148,7 @@ func (c *Client) APIMeta(ctx context.Context) (*APIMeta, *Response, error) { func (s *MetaService) Octocat(ctx context.Context, message string) (string, *Response, error) { u := "octocat" if message != "" { - u = fmt.Sprintf("%s?s=%s", u, url.QueryEscape(message)) + u = fmt.Sprintf("%v?s=%v", u, url.QueryEscape(message)) } req, err := s.client.NewRequest("GET", u, nil) diff --git a/vendor/github.com/google/go-github/v75/github/migrations.go b/vendor/github.com/google/go-github/v84/github/migrations.go similarity index 95% rename from vendor/github.com/google/go-github/v75/github/migrations.go rename to vendor/github.com/google/go-github/v84/github/migrations.go index b33be5edd..14d014b61 100644 --- a/vendor/github.com/google/go-github/v75/github/migrations.go +++ b/vendor/github.com/google/go-github/v84/github/migrations.go @@ -109,7 +109,6 @@ func (s *MigrationService) StartMigration(ctx context.Context, org string, repos return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) m := &Migration{} @@ -138,7 +137,6 @@ func (s *MigrationService) ListMigrations(ctx context.Context, org string, opts return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) var m []*Migration @@ -164,7 +162,6 @@ func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id i return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) m := &Migration{} @@ -190,7 +187,6 @@ func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string, return "", err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) s.client.clientMu.Lock() @@ -229,7 +225,6 @@ func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id i return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) return s.client.Do(ctx, req, nil) @@ -251,7 +246,6 @@ func (s *MigrationService) UnlockRepo(ctx context.Context, org string, id int64, return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) return s.client.Do(ctx, req, nil) diff --git a/vendor/github.com/google/go-github/v75/github/migrations_source_import.go b/vendor/github.com/google/go-github/v84/github/migrations_source_import.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/migrations_source_import.go rename to vendor/github.com/google/go-github/v84/github/migrations_source_import.go diff --git a/vendor/github.com/google/go-github/v75/github/migrations_user.go b/vendor/github.com/google/go-github/v84/github/migrations_user.go similarity index 94% rename from vendor/github.com/google/go-github/v75/github/migrations_user.go rename to vendor/github.com/google/go-github/v84/github/migrations_user.go index 58e780ea7..49678fcc0 100644 --- a/vendor/github.com/google/go-github/v75/github/migrations_user.go +++ b/vendor/github.com/google/go-github/v84/github/migrations_user.go @@ -84,7 +84,6 @@ func (s *MigrationService) StartUserMigration(ctx context.Context, repos []strin return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) m := &UserMigration{} @@ -113,7 +112,6 @@ func (s *MigrationService) ListUserMigrations(ctx context.Context, opts *ListOpt return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) var m []*UserMigration @@ -139,7 +137,6 @@ func (s *MigrationService) UserMigrationStatus(ctx context.Context, id int64) (* return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) m := &UserMigration{} @@ -165,7 +162,6 @@ func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64 return "", err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) m := &UserMigration{} @@ -201,7 +197,6 @@ func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (* return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) return s.client.Do(ctx, req, nil) @@ -223,7 +218,6 @@ func (s *MigrationService) UnlockUserRepo(ctx context.Context, id int64, repo st return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) return s.client.Do(ctx, req, nil) diff --git a/vendor/github.com/google/go-github/v75/github/orgs.go b/vendor/github.com/google/go-github/v84/github/orgs.go similarity index 97% rename from vendor/github.com/google/go-github/v75/github/orgs.go rename to vendor/github.com/google/go-github/v84/github/orgs.go index bec49bbff..2119f1d56 100644 --- a/vendor/github.com/google/go-github/v75/github/orgs.go +++ b/vendor/github.com/google/go-github/v84/github/orgs.go @@ -100,7 +100,7 @@ type Organization struct { // MembersCanDeleteRepositories toggles whether members with admin permissions can delete a repository. MembersCanDeleteRepositories *bool `json:"members_can_delete_repositories,omitempty"` // MembersCanChangeRepoVisibility toggles whether members with admin permissions can change the visibility for a repository. - MembersCanChangeRepoVisibility *bool `json:"members_can_change_repo_visiblilty,omitempty"` + MembersCanChangeRepoVisibility *bool `json:"members_can_change_repo_visibility,omitempty"` // MembersCanInviteOutsideCollaborators toggles whether members with admin permissions can invite outside collaborators. MembersCanInviteOutsideCollaborators *bool `json:"members_can_invite_outside_collaborators,omitempty"` // MembersCanDeleteIssues toggles whether members with admin permissions can delete issues. @@ -153,13 +153,11 @@ func (p Plan) String() string { // OrganizationsListOptions specifies the optional parameters to the // OrganizationsService.ListAll method. type OrganizationsListOptions struct { - // Since filters Organizations by ID. + // An organization ID. Only return organizations with an ID greater than this ID. Since int64 `url:"since,omitempty"` - // Note: Pagination is powered exclusively by the Since parameter, - // ListOptions.Page has no effect. - // ListOptions.PerPage controls an undocumented GitHub API parameter. - ListOptions + // The number of results per page (max 100). + PerPage int `url:"per_page,omitempty"` } // ListAll lists all organizations, in the order that they were created on GitHub. @@ -194,6 +192,7 @@ func (s *OrganizationsService) ListAll(ctx context.Context, opts *OrganizationsL // organizations for the authenticated user. // // GitHub API docs: https://docs.github.com/rest/orgs/orgs#list-organizations-for-a-user +// // GitHub API docs: https://docs.github.com/rest/orgs/orgs#list-organizations-for-the-authenticated-user // //meta:operation GET /user/orgs @@ -236,7 +235,6 @@ func (s *OrganizationsService) Get(ctx context.Context, org string) (*Organizati return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMemberAllowedRepoCreationTypePreview) organization := new(Organization) @@ -254,7 +252,7 @@ func (s *OrganizationsService) Get(ctx context.Context, org string) (*Organizati // //meta:operation GET /organizations/{organization_id} func (s *OrganizationsService) GetByID(ctx context.Context, id int64) (*Organization, *Response, error) { - u := fmt.Sprintf("organizations/%d", id) + u := fmt.Sprintf("organizations/%v", id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -281,7 +279,6 @@ func (s *OrganizationsService) Edit(ctx context.Context, name string, org *Organ return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMemberAllowedRepoCreationTypePreview) o := new(Organization) diff --git a/vendor/github.com/google/go-github/v75/github/orgs_actions_allowed.go b/vendor/github.com/google/go-github/v84/github/orgs_actions_allowed.go similarity index 73% rename from vendor/github.com/google/go-github/v75/github/orgs_actions_allowed.go rename to vendor/github.com/google/go-github/v84/github/orgs_actions_allowed.go index b115e094a..9c42df645 100644 --- a/vendor/github.com/google/go-github/v75/github/orgs_actions_allowed.go +++ b/vendor/github.com/google/go-github/v84/github/orgs_actions_allowed.go @@ -21,14 +21,14 @@ func (s *OrganizationsService) GetActionsAllowed(ctx context.Context, org string return s2.GetActionsAllowed(ctx, org) } -// EditActionsAllowed sets the actions that are allowed in an organization. +// UpdateActionsAllowed sets the actions that are allowed in an organization. // -// Deprecated: please use `client.Actions.EditActionsAllowed` instead. +// Deprecated: please use `client.Actions.UpdateActionsAllowed` instead. // // GitHub API docs: https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions/selected-actions -func (s *OrganizationsService) EditActionsAllowed(ctx context.Context, org string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { +func (s *OrganizationsService) UpdateActionsAllowed(ctx context.Context, org string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { s2 := (*ActionsService)(s) - return s2.EditActionsAllowed(ctx, org, actionsAllowed) + return s2.UpdateActionsAllowed(ctx, org, actionsAllowed) } diff --git a/vendor/github.com/google/go-github/v75/github/orgs_actions_permissions.go b/vendor/github.com/google/go-github/v84/github/orgs_actions_permissions.go similarity index 70% rename from vendor/github.com/google/go-github/v75/github/orgs_actions_permissions.go rename to vendor/github.com/google/go-github/v84/github/orgs_actions_permissions.go index 97df1c967..60abbeec3 100644 --- a/vendor/github.com/google/go-github/v75/github/orgs_actions_permissions.go +++ b/vendor/github.com/google/go-github/v84/github/orgs_actions_permissions.go @@ -21,14 +21,14 @@ func (s *OrganizationsService) GetActionsPermissions(ctx context.Context, org st return s2.GetActionsPermissions(ctx, org) } -// EditActionsPermissions sets the permissions policy for repositories and allowed actions in an organization. +// UpdateActionsPermissions sets the permissions policy for repositories and allowed actions in an organization. // -// Deprecated: please use `client.Actions.EditActionsPermissions` instead. +// Deprecated: please use `client.Actions.UpdateActionsPermissions` instead. // // GitHub API docs: https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions -func (s *OrganizationsService) EditActionsPermissions(ctx context.Context, org string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error) { +func (s *OrganizationsService) UpdateActionsPermissions(ctx context.Context, org string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error) { s2 := (*ActionsService)(s) - return s2.EditActionsPermissions(ctx, org, actionsPermissions) + return s2.UpdateActionsPermissions(ctx, org, actionsPermissions) } diff --git a/vendor/github.com/google/go-github/v84/github/orgs_artifacts.go b/vendor/github.com/google/go-github/v84/github/orgs_artifacts.go new file mode 100644 index 000000000..f17c078b1 --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/orgs_artifacts.go @@ -0,0 +1,211 @@ +// 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" + "fmt" +) + +// DeploymentRuntimeRisk represents the runtime risk of a deployment. +type DeploymentRuntimeRisk string + +const ( + DeploymentRuntimeRiskCriticalResource DeploymentRuntimeRisk = "critical-resource" + DeploymentRuntimeRiskInternetExposed DeploymentRuntimeRisk = "internet-exposed" + DeploymentRuntimeRiskLateralMovement DeploymentRuntimeRisk = "lateral-movement" + DeploymentRuntimeRiskSensitiveData DeploymentRuntimeRisk = "sensitive-data" +) + +// ArtifactDeploymentRecord represents a GitHub artifact deployment record. +type ArtifactDeploymentRecord struct { + ID *int64 `json:"id,omitempty"` + Digest *string `json:"digest,omitempty"` + LogicalEnvironment *string `json:"logical_environment,omitempty"` + PhysicalEnvironment *string `json:"physical_environment,omitempty"` + Cluster *string `json:"cluster,omitempty"` + DeploymentName *string `json:"deployment_name,omitempty"` + Tags map[string]string `json:"tags,omitempty"` + RuntimeRisks []DeploymentRuntimeRisk `json:"runtime_risks,omitempty"` + AttestationID *int64 `json:"attestation_id,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +// CreateArtifactDeploymentRequest represents the request body for creating a deployment record. +type CreateArtifactDeploymentRequest struct { + Name string `json:"name"` + Digest string `json:"digest"` + Version *string `json:"version,omitempty"` + Status string `json:"status"` + LogicalEnvironment string `json:"logical_environment"` + PhysicalEnvironment *string `json:"physical_environment,omitempty"` + Cluster *string `json:"cluster,omitempty"` + DeploymentName string `json:"deployment_name"` + Tags map[string]string `json:"tags,omitempty"` + RuntimeRisks []DeploymentRuntimeRisk `json:"runtime_risks,omitempty"` + GithubRepository *string `json:"github_repository,omitempty"` +} + +// ArtifactDeploymentResponse represents the response for deployment records. +type ArtifactDeploymentResponse struct { + TotalCount *int `json:"total_count,omitempty"` + DeploymentRecords []*ArtifactDeploymentRecord `json:"deployment_records,omitempty"` +} + +// ClusterArtifactDeployment represents a deployment within a cluster record request. +type ClusterArtifactDeployment struct { + Name string `json:"name"` + Digest string `json:"digest"` + Version *string `json:"version,omitempty"` + Status string `json:"status"` + DeploymentName string `json:"deployment_name"` + Tags map[string]string `json:"tags,omitempty"` + RuntimeRisks []DeploymentRuntimeRisk `json:"runtime_risks,omitempty"` + GithubRepository *string `json:"github_repository,omitempty"` +} + +// ClusterDeploymentRecordsRequest represents the request body for setting cluster deployment records. +type ClusterDeploymentRecordsRequest struct { + LogicalEnvironment string `json:"logical_environment"` + PhysicalEnvironment *string `json:"physical_environment,omitempty"` + Deployments []*ClusterArtifactDeployment `json:"deployments"` +} + +// ArtifactStorageRecord represents a GitHub artifact storage record. +type ArtifactStorageRecord struct { + ID *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Digest *string `json:"digest,omitempty"` + ArtifactURL *string `json:"artifact_url,omitempty"` + RegistryURL *string `json:"registry_url,omitempty"` + Repository *string `json:"repository,omitempty"` + Status *string `json:"status,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +// CreateArtifactStorageRequest represents the request body for creating a storage record. +type CreateArtifactStorageRequest struct { + Name string `json:"name"` + Digest string `json:"digest"` + Version *string `json:"version,omitempty"` + ArtifactURL *string `json:"artifact_url,omitempty"` + Path *string `json:"path,omitempty"` + RegistryURL string `json:"registry_url"` + Repository *string `json:"repository,omitempty"` + Status *string `json:"status,omitempty"` + GithubRepository *string `json:"github_repository,omitempty"` +} + +// ArtifactStorageResponse represents the response for storage records. +type ArtifactStorageResponse struct { + TotalCount *int `json:"total_count,omitempty"` + StorageRecords []*ArtifactStorageRecord `json:"storage_records,omitempty"` +} + +// CreateArtifactDeploymentRecord creates or updates deployment records for an artifact associated with an organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/artifact-metadata#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) { + u := fmt.Sprintf("orgs/%v/artifacts/metadata/deployment-record", org) + req, err := s.client.NewRequest("POST", u, record) + if err != nil { + return nil, nil, err + } + v := new(ArtifactDeploymentResponse) + resp, err := s.client.Do(ctx, req, v) + if err != nil { + return nil, resp, err + } + return v, resp, nil +} + +// SetClusterDeploymentRecords sets deployment records for a given cluster. +// +// GitHub API docs: https://docs.github.com/rest/orgs/artifact-metadata#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) { + u := fmt.Sprintf("orgs/%v/artifacts/metadata/deployment-record/cluster/%v", org, cluster) + req, err := s.client.NewRequest("POST", u, request) + if err != nil { + return nil, nil, err + } + v := new(ArtifactDeploymentResponse) + resp, err := s.client.Do(ctx, req, v) + if err != nil { + return nil, resp, err + } + return v, resp, nil +} + +// CreateArtifactStorageRecord creates metadata storage records for artifacts. +// +// GitHub API docs: https://docs.github.com/rest/orgs/artifact-metadata#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) { + u := fmt.Sprintf("orgs/%v/artifacts/metadata/storage-record", org) + req, err := s.client.NewRequest("POST", u, record) + if err != nil { + return nil, nil, err + } + v := new(ArtifactStorageResponse) + resp, err := s.client.Do(ctx, req, v) + if err != nil { + return nil, resp, err + } + return v, resp, nil +} + +// ListArtifactDeploymentRecords lists deployment records for an artifact metadata. +// +// subjectDigest is SHA256 digest of the artifact, in the form sha256:HEX_DIGEST. +// +// GitHub API docs: https://docs.github.com/rest/orgs/artifact-metadata#list-artifact-deployment-records +// +//meta:operation GET /orgs/{org}/artifacts/{subject_digest}/metadata/deployment-records +func (s *OrganizationsService) ListArtifactDeploymentRecords(ctx context.Context, org, subjectDigest string) (*ArtifactDeploymentResponse, *Response, error) { + u := fmt.Sprintf("orgs/%v/artifacts/%v/metadata/deployment-records", org, subjectDigest) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + v := new(ArtifactDeploymentResponse) + resp, err := s.client.Do(ctx, req, v) + if err != nil { + return nil, resp, err + } + return v, resp, nil +} + +// ListArtifactStorageRecords lists artifact storage records with a given subject digest. +// +// subjectDigest is SHA256 digest of the artifact, in the form sha256:HEX_DIGEST. +// +// GitHub API docs: https://docs.github.com/rest/orgs/artifact-metadata#list-artifact-storage-records +// +//meta:operation GET /orgs/{org}/artifacts/{subject_digest}/metadata/storage-records +func (s *OrganizationsService) ListArtifactStorageRecords(ctx context.Context, org, subjectDigest string) (*ArtifactStorageResponse, *Response, error) { + u := fmt.Sprintf("orgs/%v/artifacts/%v/metadata/storage-records", org, subjectDigest) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + v := new(ArtifactStorageResponse) + resp, err := s.client.Do(ctx, req, v) + if err != nil { + return nil, resp, err + } + return v, resp, nil +} diff --git a/vendor/github.com/google/go-github/v75/github/orgs_attestations.go b/vendor/github.com/google/go-github/v84/github/orgs_attestations.go similarity index 92% rename from vendor/github.com/google/go-github/v75/github/orgs_attestations.go rename to vendor/github.com/google/go-github/v84/github/orgs_attestations.go index d0ac123e2..1a7a1d5c9 100644 --- a/vendor/github.com/google/go-github/v75/github/orgs_attestations.go +++ b/vendor/github.com/google/go-github/v84/github/orgs_attestations.go @@ -14,7 +14,7 @@ import ( // with a given subject digest that are associated with repositories // owned by an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/orgs#list-attestations +// GitHub API docs: https://docs.github.com/rest/orgs/attestations#list-attestations // //meta:operation GET /orgs/{org}/attestations/{subject_digest} func (s *OrganizationsService) ListAttestations(ctx context.Context, org, subjectDigest string, opts *ListOptions) (*AttestationsResponse, *Response, error) { diff --git a/vendor/github.com/google/go-github/v75/github/orgs_audit_log.go b/vendor/github.com/google/go-github/v84/github/orgs_audit_log.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/orgs_audit_log.go rename to vendor/github.com/google/go-github/v84/github/orgs_audit_log.go diff --git a/vendor/github.com/google/go-github/v75/github/orgs_codesecurity_configurations.go b/vendor/github.com/google/go-github/v84/github/orgs_codesecurity_configurations.go similarity index 57% rename from vendor/github.com/google/go-github/v75/github/orgs_codesecurity_configurations.go rename to vendor/github.com/google/go-github/v84/github/orgs_codesecurity_configurations.go index b25845a4e..6bacf0ba0 100644 --- a/vendor/github.com/google/go-github/v75/github/orgs_codesecurity_configurations.go +++ b/vendor/github.com/google/go-github/v84/github/orgs_codesecurity_configurations.go @@ -16,12 +16,42 @@ type DependencyGraphAutosubmitActionOptions struct { LabeledRunners *bool `json:"labeled_runners,omitempty"` } +// CodeScanningOptions represents the options for the Security Configuration code scanning feature. +type CodeScanningOptions struct { + AllowAdvanced *bool `json:"allow_advanced,omitempty"` +} + +// CodeScanningDefaultSetupOptions represents the feature options for the code scanning default options. +type CodeScanningDefaultSetupOptions struct { + RunnerType string `json:"runner_type"` + RunnerLabel *string `json:"runner_label,omitempty"` +} + +// RepositoryAttachment represents a repository attachment to a code security configuration. +type RepositoryAttachment struct { + Status *string `json:"status"` + Repository *Repository `json:"repository"` +} + +// SecretScanningDelegatedBypassOptions represents the feature options for the secret scanning delegated bypass. +type SecretScanningDelegatedBypassOptions struct { + Reviewers []*BypassReviewer `json:"reviewers,omitzero"` +} + +// BypassReviewer represents the bypass reviewers for the delegated bypass of a code security configuration. +// SecurityConfigurationID is added by GitHub in responses. +type BypassReviewer struct { + ReviewerID int64 `json:"reviewer_id"` + ReviewerType string `json:"reviewer_type"` + SecurityConfigurationID *int64 `json:"security_configuration_id,omitempty"` +} + // CodeSecurityConfiguration represents a code security configuration. type CodeSecurityConfiguration struct { ID *int64 `json:"id,omitempty"` TargetType *string `json:"target_type,omitempty"` - Name *string `json:"name"` - Description *string `json:"description,omitempty"` + Name string `json:"name"` + Description string `json:"description"` AdvancedSecurity *string `json:"advanced_security,omitempty"` DependencyGraph *string `json:"dependency_graph,omitempty"` DependencyGraphAutosubmitAction *string `json:"dependency_graph_autosubmit_action,omitempty"` @@ -29,10 +59,19 @@ type CodeSecurityConfiguration struct { DependabotAlerts *string `json:"dependabot_alerts,omitempty"` DependabotSecurityUpdates *string `json:"dependabot_security_updates,omitempty"` CodeScanningDefaultSetup *string `json:"code_scanning_default_setup,omitempty"` + CodeScanningDefaultSetupOptions *CodeScanningDefaultSetupOptions `json:"code_scanning_default_setup_options,omitempty"` + CodeScanningDelegatedAlertDismissal *string `json:"code_scanning_delegated_alert_dismissal,omitempty"` + CodeScanningOptions *CodeScanningOptions `json:"code_scanning_options,omitempty"` + CodeSecurity *string `json:"code_security,omitempty"` SecretScanning *string `json:"secret_scanning,omitempty"` SecretScanningPushProtection *string `json:"secret_scanning_push_protection,omitempty"` + SecretScanningDelegatedBypass *string `json:"secret_scanning_delegated_bypass,omitempty"` + SecretScanningDelegatedBypassOptions *SecretScanningDelegatedBypassOptions `json:"secret_scanning_delegated_bypass_options,omitempty"` SecretScanningValidityChecks *string `json:"secret_scanning_validity_checks,omitempty"` SecretScanningNonProviderPatterns *string `json:"secret_scanning_non_provider_patterns,omitempty"` + SecretScanningGenericSecrets *string `json:"secret_scanning_generic_secrets,omitempty"` + SecretScanningDelegatedAlertDismissal *string `json:"secret_scanning_delegated_alert_dismissal,omitempty"` + SecretProtection *string `json:"secret_protection,omitempty"` PrivateVulnerabilityReporting *string `json:"private_vulnerability_reporting,omitempty"` Enforcement *string `json:"enforcement,omitempty"` URL *string `json:"url,omitempty"` @@ -44,7 +83,7 @@ type CodeSecurityConfiguration struct { // CodeSecurityConfigurationWithDefaultForNewRepos represents a code security configuration with default for new repos param. type CodeSecurityConfigurationWithDefaultForNewRepos struct { Configuration *CodeSecurityConfiguration `json:"configuration"` - DefaultForNewRepos *string `json:"default_for_new_repos"` + DefaultForNewRepos *string `json:"default_for_new_repos,omitempty"` } // RepositoryCodeSecurityConfiguration represents a code security configuration for a repository. @@ -53,13 +92,65 @@ type RepositoryCodeSecurityConfiguration struct { Configuration *CodeSecurityConfiguration `json:"configuration,omitempty"` } -// GetCodeSecurityConfigurations gets code security configurations for an organization. +// ListOrgCodeSecurityConfigurationOptions specifies optional parameters to get security configurations for orgs. +// +// Note: Pagination is powered by before/after cursor-style pagination. After the initial call, +// inspect the returned *Response. Use resp.After as the opts.After value to request +// the next page, and resp.Before as the opts.Before value to request the previous +// page. Set either Before or After for a request; if both are +// supplied GitHub API will return an error. PerPage controls the number of items +// per page (max 100 per GitHub API docs). +type ListOrgCodeSecurityConfigurationOptions struct { + // A cursor, as given in the Link header. If specified, the query only searches for security configurations before this cursor. + Before string `url:"before,omitempty"` + + // A cursor, as given in the Link header. If specified, the query only searches for security configurations after this cursor. + After string `url:"after,omitempty"` + + // For paginated result sets, the number of results to include per page. + PerPage int `url:"per_page,omitempty"` + + // The target type of the code security configurations to get. + // + // `target_type` defaults to all, can be one of `global`, `all` + TargetType string `url:"target_type,omitempty"` +} + +// ListCodeSecurityConfigurationRepositoriesOptions specifies optional parameters to list repositories for security configurations for orgs and enterprises. +// +// Note: Pagination is powered by before/after cursor-style pagination. After the initial call, +// inspect the returned *Response. Use resp.After as the opts.After value to request +// the next page, and resp.Before as the opts.Before value to request the previous +// page. Set either Before or After for a request; if both are +// supplied GitHub API will return an error. PerPage controls the number of items +// per page (max 100 per GitHub API docs). +type ListCodeSecurityConfigurationRepositoriesOptions struct { + // A cursor, as given in the Link header. If specified, the query only searches for repositories before this cursor. + Before string `url:"before,omitempty"` + + // A cursor, as given in the Link header. If specified, the query only searches for repositories after this cursor. + After string `url:"after,omitempty"` + + // For paginated result sets, the number of results to include per page. + PerPage int `url:"per_page,omitempty"` + + // A comma-separated list of statuses. If specified, only repositories with these attachment statuses will be returned. + // + // `status` defaults to all, can be one of `all`, `attached`, `attaching`, `removed`, `enforced`, `failed`, `updating`, `removed_by_enterprise` and also `detached` but only for the org endpoint. + Status string `url:"status,omitempty"` +} + +// ListCodeSecurityConfigurations gets code security configurations for an organization. // // GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-code-security-configurations-for-an-organization // //meta:operation GET /orgs/{org}/code-security/configurations -func (s *OrganizationsService) GetCodeSecurityConfigurations(ctx context.Context, org string) ([]*CodeSecurityConfiguration, *Response, error) { +func (s *OrganizationsService) ListCodeSecurityConfigurations(ctx context.Context, org string, opts *ListOrgCodeSecurityConfigurationOptions) ([]*CodeSecurityConfiguration, *Response, error) { u := fmt.Sprintf("orgs/%v/code-security/configurations", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -79,10 +170,10 @@ func (s *OrganizationsService) GetCodeSecurityConfigurations(ctx context.Context // GitHub API docs: https://docs.github.com/rest/code-security/configurations#create-a-code-security-configuration // //meta:operation POST /orgs/{org}/code-security/configurations -func (s *OrganizationsService) CreateCodeSecurityConfiguration(ctx context.Context, org string, c *CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { +func (s *OrganizationsService) CreateCodeSecurityConfiguration(ctx context.Context, org string, config CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { u := fmt.Sprintf("orgs/%v/code-security/configurations", org) - req, err := s.client.NewRequest("POST", u, c) + req, err := s.client.NewRequest("POST", u, config) if err != nil { return nil, nil, err } @@ -95,12 +186,12 @@ func (s *OrganizationsService) CreateCodeSecurityConfiguration(ctx context.Conte return configuration, resp, nil } -// GetDefaultCodeSecurityConfigurations gets default code security configurations for an organization. +// ListDefaultCodeSecurityConfigurations gets default code security configurations for an organization. // // GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-default-code-security-configurations // //meta:operation GET /orgs/{org}/code-security/configurations/defaults -func (s *OrganizationsService) GetDefaultCodeSecurityConfigurations(ctx context.Context, org string) ([]*CodeSecurityConfiguration, *Response, error) { +func (s *OrganizationsService) ListDefaultCodeSecurityConfigurations(ctx context.Context, org string) ([]*CodeSecurityConfigurationWithDefaultForNewRepos, *Response, error) { u := fmt.Sprintf("orgs/%v/code-security/configurations/defaults", org) req, err := s.client.NewRequest("GET", u, nil) @@ -108,7 +199,7 @@ func (s *OrganizationsService) GetDefaultCodeSecurityConfigurations(ctx context. return nil, nil, err } - var configurations []*CodeSecurityConfiguration + var configurations []*CodeSecurityConfigurationWithDefaultForNewRepos resp, err := s.client.Do(ctx, req, &configurations) if err != nil { return nil, resp, err @@ -142,8 +233,8 @@ func (s *OrganizationsService) DetachCodeSecurityConfigurationsFromRepositories( // GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-a-code-security-configuration // //meta:operation GET /orgs/{org}/code-security/configurations/{configuration_id} -func (s *OrganizationsService) GetCodeSecurityConfiguration(ctx context.Context, org string, id int64) (*CodeSecurityConfiguration, *Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, id) +func (s *OrganizationsService) GetCodeSecurityConfiguration(ctx context.Context, org string, configurationID int64) (*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, configurationID) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -163,10 +254,10 @@ func (s *OrganizationsService) GetCodeSecurityConfiguration(ctx context.Context, // GitHub API docs: https://docs.github.com/rest/code-security/configurations#update-a-code-security-configuration // //meta:operation PATCH /orgs/{org}/code-security/configurations/{configuration_id} -func (s *OrganizationsService) UpdateCodeSecurityConfiguration(ctx context.Context, org string, id int64, c *CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, id) +func (s *OrganizationsService) UpdateCodeSecurityConfiguration(ctx context.Context, org string, configurationID int64, config CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, configurationID) - req, err := s.client.NewRequest("PATCH", u, c) + req, err := s.client.NewRequest("PATCH", u, config) if err != nil { return nil, nil, err } @@ -184,8 +275,8 @@ func (s *OrganizationsService) UpdateCodeSecurityConfiguration(ctx context.Conte // GitHub API docs: https://docs.github.com/rest/code-security/configurations#delete-a-code-security-configuration // //meta:operation DELETE /orgs/{org}/code-security/configurations/{configuration_id} -func (s *OrganizationsService) DeleteCodeSecurityConfiguration(ctx context.Context, org string, id int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, id) +func (s *OrganizationsService) DeleteCodeSecurityConfiguration(ctx context.Context, org string, configurationID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, configurationID) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -198,13 +289,13 @@ func (s *OrganizationsService) DeleteCodeSecurityConfiguration(ctx context.Conte return resp, nil } -// AttachCodeSecurityConfigurationsToRepositories attaches code security configurations to repositories for an organization. +// AttachCodeSecurityConfigurationToRepositories attaches code security configurations to repositories for an organization. // // GitHub API docs: https://docs.github.com/rest/code-security/configurations#attach-a-configuration-to-repositories // //meta:operation POST /orgs/{org}/code-security/configurations/{configuration_id}/attach -func (s *OrganizationsService) AttachCodeSecurityConfigurationsToRepositories(ctx context.Context, org string, id int64, scope string, repoIDs []int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/%v/attach", org, id) +func (s *OrganizationsService) AttachCodeSecurityConfigurationToRepositories(ctx context.Context, org string, configurationID int64, scope string, repoIDs []int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/%v/attach", org, configurationID) type selectedRepoIDs struct { Scope string `json:"scope"` SelectedIDs []int64 `json:"selected_repository_ids,omitempty"` @@ -225,8 +316,8 @@ func (s *OrganizationsService) AttachCodeSecurityConfigurationsToRepositories(ct // GitHub API docs: https://docs.github.com/rest/code-security/configurations#set-a-code-security-configuration-as-a-default-for-an-organization // //meta:operation PUT /orgs/{org}/code-security/configurations/{configuration_id}/defaults -func (s *OrganizationsService) SetDefaultCodeSecurityConfiguration(ctx context.Context, org string, id int64, newReposParam string) (*CodeSecurityConfigurationWithDefaultForNewRepos, *Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/%v/defaults", org, id) +func (s *OrganizationsService) SetDefaultCodeSecurityConfiguration(ctx context.Context, org string, configurationID int64, newReposParam string) (*CodeSecurityConfigurationWithDefaultForNewRepos, *Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/%v/defaults", org, configurationID) type configParam struct { DefaultForNewRepos string `json:"default_for_new_repos"` } @@ -234,33 +325,38 @@ func (s *OrganizationsService) SetDefaultCodeSecurityConfiguration(ctx context.C if err != nil { return nil, nil, err } - var c *CodeSecurityConfigurationWithDefaultForNewRepos - resp, err := s.client.Do(ctx, req, &c) + var config *CodeSecurityConfigurationWithDefaultForNewRepos + resp, err := s.client.Do(ctx, req, &config) if err != nil { return nil, resp, err } - return c, resp, nil + return config, resp, nil } -// GetRepositoriesForCodeSecurityConfiguration gets repositories associated with a code security configuration. +// ListCodeSecurityConfigurationRepositories gets repositories associated with a code security configuration. // // GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-repositories-associated-with-a-code-security-configuration // //meta:operation GET /orgs/{org}/code-security/configurations/{configuration_id}/repositories -func (s *OrganizationsService) GetRepositoriesForCodeSecurityConfiguration(ctx context.Context, org string, id int64) ([]*Repository, *Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/%v/repositories", org, id) +func (s *OrganizationsService) ListCodeSecurityConfigurationRepositories(ctx context.Context, org string, configurationID int64, opts *ListCodeSecurityConfigurationRepositoriesOptions) ([]*RepositoryAttachment, *Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/%v/repositories", org, configurationID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err } - var repositories []*Repository - resp, err := s.client.Do(ctx, req, &repositories) + var attachments []*RepositoryAttachment + resp, err := s.client.Do(ctx, req, &attachments) if err != nil { return nil, resp, err } - return repositories, resp, nil + + return attachments, resp, nil } // GetCodeSecurityConfigurationForRepository gets code security configuration that manages a repository's code security settings. diff --git a/vendor/github.com/google/go-github/v75/github/orgs_credential_authorizations.go b/vendor/github.com/google/go-github/v84/github/orgs_credential_authorizations.go similarity index 96% rename from vendor/github.com/google/go-github/v75/github/orgs_credential_authorizations.go rename to vendor/github.com/google/go-github/v84/github/orgs_credential_authorizations.go index dca42433c..326922c3b 100644 --- a/vendor/github.com/google/go-github/v75/github/orgs_credential_authorizations.go +++ b/vendor/github.com/google/go-github/v84/github/orgs_credential_authorizations.go @@ -8,7 +8,6 @@ package github import ( "context" "fmt" - "net/http" ) // CredentialAuthorization represents a credential authorized through SAML SSO. @@ -78,7 +77,7 @@ func (s *OrganizationsService) ListCredentialAuthorizations(ctx context.Context, return nil, nil, err } - req, err := s.client.NewRequest(http.MethodGet, u, nil) + req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err } @@ -100,7 +99,7 @@ func (s *OrganizationsService) ListCredentialAuthorizations(ctx context.Context, //meta:operation DELETE /orgs/{org}/credential-authorizations/{credential_id} func (s *OrganizationsService) RemoveCredentialAuthorization(ctx context.Context, org string, credentialID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/credential-authorizations/%v", org, credentialID) - req, err := s.client.NewRequest(http.MethodDelete, u, nil) + req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err } diff --git a/vendor/github.com/google/go-github/v75/github/orgs_custom_repository_roles.go b/vendor/github.com/google/go-github/v84/github/orgs_custom_repository_roles.go similarity index 83% rename from vendor/github.com/google/go-github/v75/github/orgs_custom_repository_roles.go rename to vendor/github.com/google/go-github/v84/github/orgs_custom_repository_roles.go index 44408db14..192ab63a6 100644 --- a/vendor/github.com/google/go-github/v75/github/orgs_custom_repository_roles.go +++ b/vendor/github.com/google/go-github/v84/github/orgs_custom_repository_roles.go @@ -38,6 +38,12 @@ type CreateOrUpdateCustomRepoRoleOptions struct { Permissions []string `json:"permissions"` } +// RepoFineGrainedPermission represents a fine-grained permission that can be used in a custom repository role. +type RepoFineGrainedPermission struct { + Name string `json:"name"` + Description string `json:"description"` +} + // ListCustomRepoRoles lists the custom repository roles available in this organization. // In order to see custom repository roles in an organization, the authenticated user must be an organization owner. // @@ -152,3 +158,26 @@ func (s *OrganizationsService) DeleteCustomRepoRole(ctx context.Context, org str return resp, nil } + +// ListRepositoryFineGrainedPermissions lists the fine-grained permissions that can be used in custom repository roles for an organization. +// The authenticated user must be an administrator of the organization or of a repository of the organization to use this endpoint. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles#list-repository-fine-grained-permissions-for-an-organization +// +//meta:operation GET /orgs/{org}/repository-fine-grained-permissions +func (s *OrganizationsService) ListRepositoryFineGrainedPermissions(ctx context.Context, org string) ([]*RepoFineGrainedPermission, *Response, error) { + u := fmt.Sprintf("orgs/%v/repository-fine-grained-permissions", org) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var perms []*RepoFineGrainedPermission + resp, err := s.client.Do(ctx, req, &perms) + if err != nil { + return nil, resp, err + } + + return perms, resp, nil +} diff --git a/vendor/github.com/google/go-github/v75/github/orgs_hooks.go b/vendor/github.com/google/go-github/v84/github/orgs_hooks.go similarity index 95% rename from vendor/github.com/google/go-github/v75/github/orgs_hooks.go rename to vendor/github.com/google/go-github/v84/github/orgs_hooks.go index 9ad380cb9..e3bb25e78 100644 --- a/vendor/github.com/google/go-github/v75/github/orgs_hooks.go +++ b/vendor/github.com/google/go-github/v84/github/orgs_hooks.go @@ -43,7 +43,7 @@ func (s *OrganizationsService) ListHooks(ctx context.Context, org string, opts * // //meta:operation GET /orgs/{org}/hooks/{hook_id} func (s *OrganizationsService) GetHook(ctx context.Context, org string, id int64) (*Hook, *Response, error) { - u := fmt.Sprintf("orgs/%v/hooks/%d", org, id) + u := fmt.Sprintf("orgs/%v/hooks/%v", org, id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -101,7 +101,7 @@ func (s *OrganizationsService) CreateHook(ctx context.Context, org string, hook // //meta:operation PATCH /orgs/{org}/hooks/{hook_id} func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int64, hook *Hook) (*Hook, *Response, error) { - u := fmt.Sprintf("orgs/%v/hooks/%d", org, id) + u := fmt.Sprintf("orgs/%v/hooks/%v", org, id) req, err := s.client.NewRequest("PATCH", u, hook) if err != nil { return nil, nil, err @@ -122,7 +122,7 @@ func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int6 // //meta:operation POST /orgs/{org}/hooks/{hook_id}/pings func (s *OrganizationsService) PingHook(ctx context.Context, org string, id int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/hooks/%d/pings", org, id) + u := fmt.Sprintf("orgs/%v/hooks/%v/pings", org, id) req, err := s.client.NewRequest("POST", u, nil) if err != nil { return nil, err @@ -137,7 +137,7 @@ func (s *OrganizationsService) PingHook(ctx context.Context, org string, id int6 // //meta:operation DELETE /orgs/{org}/hooks/{hook_id} func (s *OrganizationsService) DeleteHook(ctx context.Context, org string, id int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/hooks/%d", org, id) + u := fmt.Sprintf("orgs/%v/hooks/%v", org, id) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err diff --git a/vendor/github.com/google/go-github/v75/github/orgs_hooks_configuration.go b/vendor/github.com/google/go-github/v84/github/orgs_hooks_configuration.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/orgs_hooks_configuration.go rename to vendor/github.com/google/go-github/v84/github/orgs_hooks_configuration.go diff --git a/vendor/github.com/google/go-github/v75/github/orgs_hooks_deliveries.go b/vendor/github.com/google/go-github/v84/github/orgs_hooks_deliveries.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/orgs_hooks_deliveries.go rename to vendor/github.com/google/go-github/v84/github/orgs_hooks_deliveries.go diff --git a/vendor/github.com/google/go-github/v84/github/orgs_immutable_releases.go b/vendor/github.com/google/go-github/v84/github/orgs_immutable_releases.go new file mode 100644 index 000000000..4e305947d --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/orgs_immutable_releases.go @@ -0,0 +1,174 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// ImmutableReleaseSettings represents the response from the immutable releases settings endpoint. +type ImmutableReleaseSettings struct { + // EnforcedRepositories specifies how immutable releases are enforced in the organization. Possible values include "all", "none", or "selected". + EnforcedRepositories *string `json:"enforced_repositories,omitempty"` + // SelectedRepositoriesURL provides the API URL for managing the repositories + // selected for immutable releases enforcement when EnforcedRepositories is set to "selected". + SelectedRepositoriesURL *string `json:"selected_repositories_url,omitempty"` +} + +// ImmutableReleasePolicy is for setting the immutable releases policy for repositories in an organization. +type ImmutableReleasePolicy struct { + // EnforcedRepositories specifies how immutable releases are enforced in the organization. Possible values include "all", "none", or "selected". + EnforcedRepositories *string `json:"enforced_repositories,omitempty"` + // An array of repository ids for which immutable releases enforcement should be applied. + // You can only provide a list of repository ids when the enforced_repositories is set to "selected" + SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"` +} + +// setImmutableReleasesRepositoriesOptions represents the request body for setting repositories. +type setImmutableReleasesRepositoriesOptions struct { + SelectedRepositoryIDs []int64 `json:"selected_repository_ids"` +} + +// GetImmutableReleasesSettings returns the immutable releases configuration that applies to repositories within the given organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs#get-immutable-releases-settings-for-an-organization +// +//meta:operation GET /orgs/{org}/settings/immutable-releases +func (s *OrganizationsService) GetImmutableReleasesSettings(ctx context.Context, org string) (*ImmutableReleaseSettings, *Response, error) { + u := fmt.Sprintf("orgs/%v/settings/immutable-releases", org) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var settings *ImmutableReleaseSettings + resp, err := s.client.Do(ctx, req, &settings) + if err != nil { + return nil, resp, err + } + + return settings, resp, nil +} + +// UpdateImmutableReleasesSettings sets immutable releases settings for an organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs#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) { + u := fmt.Sprintf("orgs/%v/settings/immutable-releases", org) + + req, err := s.client.NewRequest("PUT", u, opts) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// ListImmutableReleaseRepositories lists selected repositories for immutable releases enforcement in an organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs#list-selected-repositories-for-immutable-releases-enforcement +// +//meta:operation GET /orgs/{org}/settings/immutable-releases/repositories +func (s *OrganizationsService) ListImmutableReleaseRepositories(ctx context.Context, org string, opts *ListOptions) (*ListRepositories, *Response, error) { + u := fmt.Sprintf("orgs/%v/settings/immutable-releases/repositories", org) + + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var repositories *ListRepositories + resp, err := s.client.Do(ctx, req, &repositories) + if err != nil { + return nil, resp, err + } + + return repositories, resp, nil +} + +// SetImmutableReleaseRepositories sets selected repositories for immutable releases enforcement. +// It requires the organization's immutable releases policy for enforced_repositories to be set to "selected". +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs#set-selected-repositories-for-immutable-releases-enforcement +// +//meta:operation PUT /orgs/{org}/settings/immutable-releases/repositories +func (s *OrganizationsService) SetImmutableReleaseRepositories(ctx context.Context, org string, repositoryIDs []int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/settings/immutable-releases/repositories", org) + + body := &setImmutableReleasesRepositoriesOptions{ + SelectedRepositoryIDs: repositoryIDs, + } + + req, err := s.client.NewRequest("PUT", u, body) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// EnableRepositoryForImmutableRelease enables a selected repository for immutable releases in an organization. +// It requires enforced_repositories to be set to "selected". +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs#enable-a-selected-repository-for-immutable-releases-in-an-organization +// +//meta:operation PUT /orgs/{org}/settings/immutable-releases/repositories/{repository_id} +func (s *OrganizationsService) EnableRepositoryForImmutableRelease(ctx context.Context, org string, repoID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/settings/immutable-releases/repositories/%v", org, repoID) + + req, err := s.client.NewRequest("PUT", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// DisableRepositoryForImmutableRelease removes a repository from the organization's selected list for immutable releases enforcement. +// It requires enforced_repositories to be set to "selected". +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs#disable-a-selected-repository-for-immutable-releases-in-an-organization +// +//meta:operation DELETE /orgs/{org}/settings/immutable-releases/repositories/{repository_id} +func (s *OrganizationsService) DisableRepositoryForImmutableRelease(ctx context.Context, org string, repoID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/settings/immutable-releases/repositories/%v", org, repoID) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v75/github/orgs_issue_types.go b/vendor/github.com/google/go-github/v84/github/orgs_issue_types.go similarity index 89% rename from vendor/github.com/google/go-github/v75/github/orgs_issue_types.go rename to vendor/github.com/google/go-github/v84/github/orgs_issue_types.go index 73e6f8d63..0819c2183 100644 --- a/vendor/github.com/google/go-github/v75/github/orgs_issue_types.go +++ b/vendor/github.com/google/go-github/v84/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#create-issue-type-for-an-organization // //meta:operation POST /orgs/{org}/issue-types -func (s *OrganizationsService) CreateIssueType(ctx context.Context, org string, opt *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) { +func (s *OrganizationsService) CreateIssueType(ctx context.Context, org string, opts *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) { u := fmt.Sprintf("orgs/%v/issue-types", org) - req, err := s.client.NewRequest("POST", u, opt) + req, err := s.client.NewRequest("POST", u, opts) 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#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, opt *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) { +func (s *OrganizationsService) UpdateIssueType(ctx context.Context, org string, issueTypeID int64, opts *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) { u := fmt.Sprintf("orgs/%v/issue-types/%v", org, issueTypeID) - req, err := s.client.NewRequest("PUT", u, opt) + req, err := s.client.NewRequest("PUT", u, opts) if err != nil { return nil, nil, err } @@ -89,7 +89,7 @@ func (s *OrganizationsService) UpdateIssueType(ctx context.Context, org string, // //meta:operation DELETE /orgs/{org}/issue-types/{issue_type_id} func (s *OrganizationsService) DeleteIssueType(ctx context.Context, org string, issueTypeID int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/issue-types/%d", org, issueTypeID) + u := fmt.Sprintf("orgs/%v/issue-types/%v", org, issueTypeID) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err diff --git a/vendor/github.com/google/go-github/v75/github/orgs_members.go b/vendor/github.com/google/go-github/v84/github/orgs_members.go similarity index 99% rename from vendor/github.com/google/go-github/v75/github/orgs_members.go rename to vendor/github.com/google/go-github/v84/github/orgs_members.go index d818d7f9f..837a8f446 100644 --- a/vendor/github.com/google/go-github/v75/github/orgs_members.go +++ b/vendor/github.com/google/go-github/v84/github/orgs_members.go @@ -69,9 +69,10 @@ type ListMembersOptions struct { // ListMembers lists the members for an organization. If the authenticated // user is an owner of the organization, this will return both concealed and -// public members, otherwise it will only return public members. +// public members; otherwise, it will only return public members. // // GitHub API docs: https://docs.github.com/rest/orgs/members#list-organization-members +// // GitHub API docs: https://docs.github.com/rest/orgs/members#list-public-organization-members // //meta:operation GET /orgs/{org}/members @@ -237,6 +238,7 @@ func (s *OrganizationsService) ListOrgMemberships(ctx context.Context, opts *Lis // authenticated user. // // GitHub API docs: https://docs.github.com/rest/orgs/members#get-an-organization-membership-for-the-authenticated-user +// // GitHub API docs: https://docs.github.com/rest/orgs/members#get-organization-membership-for-a-user // //meta:operation GET /orgs/{org}/memberships/{username} @@ -268,6 +270,7 @@ func (s *OrganizationsService) GetOrgMembership(ctx context.Context, user, org s // authenticated user. // // GitHub API docs: https://docs.github.com/rest/orgs/members#set-organization-membership-for-a-user +// // GitHub API docs: https://docs.github.com/rest/orgs/members#update-an-organization-membership-for-the-authenticated-user // //meta:operation PUT /orgs/{org}/memberships/{username} diff --git a/vendor/github.com/google/go-github/v75/github/orgs_network_configurations.go b/vendor/github.com/google/go-github/v84/github/orgs_network_configurations.go similarity index 98% rename from vendor/github.com/google/go-github/v75/github/orgs_network_configurations.go rename to vendor/github.com/google/go-github/v84/github/orgs_network_configurations.go index 82a819c20..89437f76c 100644 --- a/vendor/github.com/google/go-github/v75/github/orgs_network_configurations.go +++ b/vendor/github.com/google/go-github/v84/github/orgs_network_configurations.go @@ -89,10 +89,7 @@ func validateNetworkConfigurationRequest(req NetworkConfigurationRequest) error } networkIDs := req.NetworkSettingsIDs - if err := validateNetworkSettingsID(networkIDs); err != nil { - return err - } - return nil + return validateNetworkSettingsID(networkIDs) } // NetworkConfigurationRequest represents a request to create or update a network configuration for an organization. diff --git a/vendor/github.com/google/go-github/v84/github/orgs_organization_properties.go b/vendor/github.com/google/go-github/v84/github/orgs_organization_properties.go new file mode 100644 index 000000000..4e4c33c77 --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/orgs_organization_properties.go @@ -0,0 +1,60 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// OrganizationCustomPropertyValues represents the custom property values for an organization. +type OrganizationCustomPropertyValues struct { + // List of custom property names and associated values to apply to the organization. + Properties []*CustomPropertyValue `json:"properties,omitempty"` +} + +// GetOrganizationCustomPropertyValues returns all custom property names and their values for an organization. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-properties-for-orgs#get-all-custom-property-values-for-an-organization +// +//meta:operation GET /organizations/{org}/org-properties/values +func (s *OrganizationsService) GetOrganizationCustomPropertyValues(ctx context.Context, org string) ([]*CustomPropertyValue, *Response, error) { + u := fmt.Sprintf("organizations/%v/org-properties/values", org) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var values []*CustomPropertyValue + resp, err := s.client.Do(ctx, req, &values) + if err != nil { + return nil, resp, err + } + + return values, resp, nil +} + +// CreateOrUpdateOrganizationCustomPropertyValues creates or updates custom property values for an organization. +// To remove a custom property value from an organization, set the property value to null. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-properties-for-orgs#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) { + u := fmt.Sprintf("organizations/%v/org-properties/values", org) + req, err := s.client.NewRequest("PATCH", u, values) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v75/github/orgs_organization_roles.go b/vendor/github.com/google/go-github/v84/github/orgs_organization_roles.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/orgs_organization_roles.go rename to vendor/github.com/google/go-github/v84/github/orgs_organization_roles.go diff --git a/vendor/github.com/google/go-github/v75/github/orgs_outside_collaborators.go b/vendor/github.com/google/go-github/v84/github/orgs_outside_collaborators.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/orgs_outside_collaborators.go rename to vendor/github.com/google/go-github/v84/github/orgs_outside_collaborators.go diff --git a/vendor/github.com/google/go-github/v75/github/orgs_packages.go b/vendor/github.com/google/go-github/v84/github/orgs_packages.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/orgs_packages.go rename to vendor/github.com/google/go-github/v84/github/orgs_packages.go diff --git a/vendor/github.com/google/go-github/v75/github/orgs_personal_access_tokens.go b/vendor/github.com/google/go-github/v84/github/orgs_personal_access_tokens.go similarity index 60% rename from vendor/github.com/google/go-github/v75/github/orgs_personal_access_tokens.go rename to vendor/github.com/google/go-github/v84/github/orgs_personal_access_tokens.go index 4abd6665a..f09b436c1 100644 --- a/vendor/github.com/google/go-github/v75/github/orgs_personal_access_tokens.go +++ b/vendor/github.com/google/go-github/v84/github/orgs_personal_access_tokens.go @@ -9,8 +9,8 @@ import ( "context" "errors" "fmt" - "net/http" "net/url" + "strconv" "strings" ) @@ -84,6 +84,9 @@ type ListFineGrainedPATOptions struct { // This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. LastUsedAfter string `url:"last_used_after,omitempty"` + // TokenID filters results by the given fine-grained personal access token IDs. + TokenID []int64 `url:"-"` + ListOptions } @@ -101,7 +104,7 @@ func (s *OrganizationsService) ListFineGrainedPersonalAccessTokens(ctx context.C return nil, nil, err } - req, err := s.client.NewRequest(http.MethodGet, u, opts) + req, err := s.client.NewRequest("GET", u, opts) if err != nil { return nil, nil, err } @@ -116,6 +119,75 @@ func (s *OrganizationsService) ListFineGrainedPersonalAccessTokens(ctx context.C return pats, resp, nil } +// FineGrainedPersonalAccessTokenRequest represents the details of a request to access organization resources via a fine-grained personal access token. +type FineGrainedPersonalAccessTokenRequest struct { + // Unique identifier of the request for access via fine-grained personal access token. + ID int64 `json:"id"` + + // Reason is the reason for the request. + Reason string `json:"reason"` + + // Owner is the GitHub user associated with the token. + Owner User `json:"owner"` + + // RepositorySelection is the type of repository selection requested. + // Possible values are: "none", "all", "subset". + RepositorySelection string `json:"repository_selection"` + + // URL to the list of repositories the fine-grained personal access token can access. + // Only follow when `repository_selection` is `subset`. + RepositoriesURL string `json:"repositories_url"` + + // Permissions are the permissions requested, categorized by type. + Permissions PersonalAccessTokenPermissions `json:"permissions"` + + // Date and time when the request was created. + CreatedAt *Timestamp `json:"created_at"` + + // Whether the associated fine-grained personal access token has expired. + TokenExpired bool `json:"token_expired"` + + // Date and time when the associated fine-grained personal access token expires. + TokenExpiresAt *Timestamp `json:"token_expires_at"` + + // TokenID + TokenID int64 `json:"token_id"` + + // TokenName + TokenName string `json:"token_name"` + + // Date and time when the associated fine-grained personal access token was last used for authentication. + TokenLastUsedAt *Timestamp `json:"token_last_used_at"` +} + +// ListFineGrainedPersonalAccessTokenRequests lists requests to access organization resources via fine-grained personal access tokens. +// Only GitHub Apps can call this API, using the `Personal access tokens` organization permissions (read). +// +// GitHub API docs: https://docs.github.com/rest/orgs/personal-access-tokens#list-requests-to-access-organization-resources-with-fine-grained-personal-access-tokens +// +//meta:operation GET /orgs/{org}/personal-access-token-requests +func (s *OrganizationsService) ListFineGrainedPersonalAccessTokenRequests(ctx context.Context, org string, opts *ListFineGrainedPATOptions) ([]*FineGrainedPersonalAccessTokenRequest, *Response, error) { + u := fmt.Sprintf("orgs/%v/personal-access-token-requests", org) + // The `owner` parameter is a special case that uses the `owner[]=...` format and needs a custom function to format it correctly. + u, err := addListFineGrainedPATOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, opts) + if err != nil { + return nil, nil, err + } + + var pats []*FineGrainedPersonalAccessTokenRequest + resp, err := s.client.Do(ctx, req, &pats) + if err != nil { + return nil, resp, err + } + + return pats, resp, nil +} + // ReviewPersonalAccessTokenRequestOptions specifies the parameters to the ReviewPersonalAccessTokenRequest method. type ReviewPersonalAccessTokenRequestOptions struct { Action string `json:"action"` @@ -132,7 +204,7 @@ type ReviewPersonalAccessTokenRequestOptions struct { func (s *OrganizationsService) ReviewPersonalAccessTokenRequest(ctx context.Context, org string, requestID int64, opts ReviewPersonalAccessTokenRequestOptions) (*Response, error) { u := fmt.Sprintf("orgs/%v/personal-access-token-requests/%v", org, requestID) - req, err := s.client.NewRequest(http.MethodPost, u, &opts) + req, err := s.client.NewRequest("POST", u, &opts) if err != nil { return nil, err } @@ -140,16 +212,16 @@ func (s *OrganizationsService) ReviewPersonalAccessTokenRequest(ctx context.Cont return s.client.Do(ctx, req, nil) } -// addListFineGrainedPATOptions adds the owner parameter to the URL query string with the correct format if it is set. +// addListFineGrainedPATOptions adds the owner and token_id parameters to the URL query string with the correct format if they are set. // // GitHub API expects the owner parameter to be a list of strings in the `owner[]=...` format. -// For multiple owner values, the owner parameter is repeated in the query string. +// For multiple owner and token_id values, the owner and token_id parameters are repeated in the query string. // // Example: -// owner[]=user1&owner[]=user2 -// This will filter the results to only include fine-grained personal access tokens owned by `user1` and `user2`. +// owner[]=user1&owner[]=user2&token_id[]=123&token_id[]=456 +// This will filter the results to only include fine-grained personal access tokens owned by `user1` and `user2` and with token IDs `123` and `456`. // -// This function ensures the owner parameter is formatted correctly in the URL query string. +// This function ensures the owner and token_id parameters are formatted correctly in the URL query string. func addListFineGrainedPATOptions(s string, opts *ListFineGrainedPATOptions) (string, error) { u, err := addOptions(s, opts) if err != nil { @@ -163,7 +235,7 @@ func addListFineGrainedPATOptions(s string, opts *ListFineGrainedPATOptions) (st if len(opts.Owner) > 0 { ownerVals := make([]string, len(opts.Owner)) for i, owner := range opts.Owner { - ownerVals[i] = fmt.Sprintf("owner[]=%s", url.QueryEscape(owner)) + ownerVals[i] = fmt.Sprintf("owner[]=%v", url.QueryEscape(owner)) } ownerQuery := strings.Join(ownerVals, "&") @@ -173,6 +245,20 @@ func addListFineGrainedPATOptions(s string, opts *ListFineGrainedPATOptions) (st u += "?" + ownerQuery } } + if len(opts.TokenID) > 0 { + tokenIDVals := make([]string, len(opts.TokenID)) + for i, tokenID := range opts.TokenID { + tokenIDVals[i] = fmt.Sprintf("token_id[]=%v", url.QueryEscape(strconv.FormatInt(tokenID, 10))) + } + tokenIDQuery := strings.Join(tokenIDVals, "&") + + if strings.Contains(u, "?") { + u += "&" + tokenIDQuery + } else { + u += "?" + tokenIDQuery + } + return u, nil + } return u, nil } diff --git a/vendor/github.com/google/go-github/v75/github/orgs_properties.go b/vendor/github.com/google/go-github/v84/github/orgs_properties.go similarity index 80% rename from vendor/github.com/google/go-github/v75/github/orgs_properties.go rename to vendor/github.com/google/go-github/v84/github/orgs_properties.go index 257e76599..8b9541bde 100644 --- a/vendor/github.com/google/go-github/v75/github/orgs_properties.go +++ b/vendor/github.com/google/go-github/v84/github/orgs_properties.go @@ -10,6 +10,19 @@ import ( "encoding/json" "errors" "fmt" + "strconv" +) + +// PropertyValueType represents the type of a custom property value. +type PropertyValueType string + +// Valid values for CustomProperty.ValueType. +const ( + PropertyValueTypeString PropertyValueType = "string" + PropertyValueTypeSingleSelect PropertyValueType = "single_select" + PropertyValueTypeMultiSelect PropertyValueType = "multi_select" + PropertyValueTypeTrueFalse PropertyValueType = "true_false" + PropertyValueTypeURL PropertyValueType = "url" ) // CustomProperty represents an organization custom property object. @@ -17,14 +30,16 @@ type CustomProperty struct { // PropertyName is required for most endpoints except when calling CreateOrUpdateCustomProperty; // where this is sent in the path and thus can be omitted. PropertyName *string `json:"property_name,omitempty"` + // The URL that can be used to fetch, update, or delete info about this property via the API. + URL *string `json:"url,omitempty"` // SourceType is the source type of the property where it has been created. Can be one of: organization, enterprise. SourceType *string `json:"source_type,omitempty"` - // The type of the value for the property. Can be one of: string, single_select, multi_select, true_false. - ValueType string `json:"value_type"` + // The type of the value for the property. Can be one of: string, single_select, multi_select, true_false, url. + ValueType PropertyValueType `json:"value_type"` // Whether the property is required. Required *bool `json:"required,omitempty"` // Default value of the property. - DefaultValue *string `json:"default_value,omitempty"` + DefaultValue any `json:"default_value,omitempty"` // Short description of the property. Description *string `json:"description,omitempty"` // An ordered list of the allowed values of the property. The property can have up to 200 @@ -34,6 +49,56 @@ type CustomProperty struct { ValuesEditableBy *string `json:"values_editable_by,omitempty"` } +// DefaultValueString returns the DefaultValue as a string if the ValueType is string or single_select or url. +func (cp CustomProperty) DefaultValueString() (string, bool) { + switch cp.ValueType { + case PropertyValueTypeString, PropertyValueTypeSingleSelect, PropertyValueTypeURL: + s, ok := cp.DefaultValue.(string) + return s, ok + default: + return "", false + } +} + +// DefaultValueStrings returns the DefaultValue as a slice of string if the ValueType is multi_select. +func (cp CustomProperty) DefaultValueStrings() ([]string, bool) { + switch cp.ValueType { + case PropertyValueTypeMultiSelect: + switch v := cp.DefaultValue.(type) { + case []string: + return v, true + case []any: + vals := make([]string, len(v)) + for i, item := range v { + s, ok := item.(string) + if !ok { + return nil, false + } + vals[i] = s + } + return vals, true + default: + return nil, false + } + default: + return nil, false + } +} + +// DefaultValueBool returns the DefaultValue as a string if the ValueType is true_false. +func (cp CustomProperty) DefaultValueBool() (bool, bool) { + switch cp.ValueType { + case PropertyValueTypeTrueFalse: + if s, ok := cp.DefaultValue.(string); ok { + b, err := strconv.ParseBool(s) + return b, err == nil + } + return false, false + default: + return false, false + } +} + // RepoCustomPropertyValue represents a repository custom property value. type RepoCustomPropertyValue struct { RepositoryID int64 `json:"repository_id"` diff --git a/vendor/github.com/google/go-github/v75/github/orgs_rules.go b/vendor/github.com/google/go-github/v84/github/orgs_rules.go similarity index 80% rename from vendor/github.com/google/go-github/v75/github/orgs_rules.go rename to vendor/github.com/google/go-github/v84/github/orgs_rules.go index 357eb8ce7..26012091a 100644 --- a/vendor/github.com/google/go-github/v75/github/orgs_rules.go +++ b/vendor/github.com/google/go-github/v84/github/orgs_rules.go @@ -103,31 +103,6 @@ func (s *OrganizationsService) UpdateRepositoryRuleset(ctx context.Context, org return rs, resp, nil } -// UpdateRepositoryRulesetClearBypassActor clears the bypass actors for a repository ruleset for the specified organization. -// -// This function is necessary as the UpdateRepositoryRuleset function does not marshal ByPassActor if passed as an empty array. -// -// GitHub API docs: https://docs.github.com/rest/orgs/rules#update-an-organization-repository-ruleset -// -//meta:operation PUT /orgs/{org}/rulesets/{ruleset_id} -func (s *OrganizationsService) UpdateRepositoryRulesetClearBypassActor(ctx context.Context, org string, rulesetID int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/rulesets/%v", org, rulesetID) - - rsClearBypassActor := rulesetClearBypassActors{} - - req, err := s.client.NewRequest("PUT", u, rsClearBypassActor) - if err != nil { - return nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - - return resp, nil -} - // DeleteRepositoryRuleset deletes a repository ruleset from the specified organization. // // GitHub API docs: https://docs.github.com/rest/orgs/rules#delete-an-organization-repository-ruleset diff --git a/vendor/github.com/google/go-github/v75/github/orgs_security_managers.go b/vendor/github.com/google/go-github/v84/github/orgs_security_managers.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/orgs_security_managers.go rename to vendor/github.com/google/go-github/v84/github/orgs_security_managers.go diff --git a/vendor/github.com/google/go-github/v75/github/orgs_users_blocking.go b/vendor/github.com/google/go-github/v84/github/orgs_users_blocking.go similarity index 90% rename from vendor/github.com/google/go-github/v75/github/orgs_users_blocking.go rename to vendor/github.com/google/go-github/v84/github/orgs_users_blocking.go index f69933ba4..60ee0f18b 100644 --- a/vendor/github.com/google/go-github/v75/github/orgs_users_blocking.go +++ b/vendor/github.com/google/go-github/v84/github/orgs_users_blocking.go @@ -27,7 +27,6 @@ func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string, return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) var blockedUsers []*User @@ -52,7 +51,6 @@ func (s *OrganizationsService) IsBlocked(ctx context.Context, org, user string) return false, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) resp, err := s.client.Do(ctx, req, nil) @@ -73,7 +71,6 @@ func (s *OrganizationsService) BlockUser(ctx context.Context, org, user string) return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) return s.client.Do(ctx, req, nil) @@ -92,7 +89,6 @@ func (s *OrganizationsService) UnblockUser(ctx context.Context, org, user string return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) return s.client.Do(ctx, req, nil) diff --git a/vendor/github.com/google/go-github/v75/github/packages.go b/vendor/github.com/google/go-github/v84/github/packages.go similarity index 99% rename from vendor/github.com/google/go-github/v75/github/packages.go rename to vendor/github.com/google/go-github/v84/github/packages.go index cc04a044d..0ad0ed69e 100644 --- a/vendor/github.com/google/go-github/v75/github/packages.go +++ b/vendor/github.com/google/go-github/v84/github/packages.go @@ -264,7 +264,7 @@ func (mt PackageEventContainerMetadataTag) String() string { // PackageNugetMetadata represents nuget metadata for a GitHub package. type PackageNugetMetadata struct { - ID json.RawMessage `json:"id,omitempty"` // Can either be a int64 or string + ID json.RawMessage `json:"id,omitempty"` // Can either be an int64 or string Name *string `json:"name,omitempty"` Value json.RawMessage `json:"value,omitempty"` // Can either be a bool, string, integer or object } diff --git a/vendor/github.com/google/go-github/v84/github/private_registries.go b/vendor/github.com/google/go-github/v84/github/private_registries.go new file mode 100644 index 000000000..ff8582c45 --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/private_registries.go @@ -0,0 +1,263 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// PrivateRegistriesService handles communication with the private registries +// methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/private-registries +type PrivateRegistriesService service + +// PrivateRegistryType represents the type of private registry. +type PrivateRegistryType string + +const ( + PrivateRegistryTypeMavenRepository PrivateRegistryType = "maven_repository" + PrivateRegistryTypeNugetFeed PrivateRegistryType = "nuget_feed" + PrivateRegistryTypeGoProxyServer PrivateRegistryType = "goproxy_server" + PrivateRegistryTypeNpmRegistry PrivateRegistryType = "npm_registry" + PrivateRegistryTypeRubygemsServer PrivateRegistryType = "rubygems_server" + PrivateRegistryTypeCargoRegistry PrivateRegistryType = "cargo_registry" + PrivateRegistryTypeComposerRepository PrivateRegistryType = "composer_repository" + PrivateRegistryTypeDockerRegistry PrivateRegistryType = "docker_registry" + PrivateRegistryTypeGitSource PrivateRegistryType = "git_source" + PrivateRegistryTypeHelmRegistry PrivateRegistryType = "helm_registry" + PrivateRegistryTypeHexOrganization PrivateRegistryType = "hex_organization" + PrivateRegistryTypeHexRepository PrivateRegistryType = "hex_repository" + PrivateRegistryTypePubRepository PrivateRegistryType = "pub_repository" + PrivateRegistryTypePythonIndex PrivateRegistryType = "python_index" + PrivateRegistryTypeTerraformRegistry PrivateRegistryType = "terraform_registry" +) + +// PrivateRegistryVisibility represents the visibility of a private registry. +type PrivateRegistryVisibility string + +const ( + PrivateRegistryVisibilityPrivate PrivateRegistryVisibility = "private" + PrivateRegistryVisibilityAll PrivateRegistryVisibility = "all" + PrivateRegistryVisibilitySelected PrivateRegistryVisibility = "selected" +) + +// PrivateRegistry represents a private registry configuration. +type PrivateRegistry struct { + // Name of the private registry. + Name *string `json:"name,omitempty"` + // RegistryType is the type of private registry. You can find the list of supported types in PrivateRegistryType. + RegistryType *string `json:"registry_type,omitempty"` + // Username to use when authenticating with the private registry. + // This field is omitted if the private registry does not require a username for authentication. + Username *string `json:"username,omitempty"` + // CreatedAt is the timestamp when the private registry was created. + CreatedAt *Timestamp `json:"created_at,omitempty"` + // UpdatedAt is the timestamp when the private registry was last updated. + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + // Visibility is the visibility of the private registry. Possible values are: "private", "all", and "selected". + Visibility *PrivateRegistryVisibility `json:"visibility,omitempty"` +} + +// PrivateRegistries represents a list of private registries. +type PrivateRegistries struct { + // TotalCount is the total number of private registries. + TotalCount *int `json:"total_count,omitempty"` + // Configurations is the list of private registry configurations. + Configurations []*PrivateRegistry `json:"configurations,omitempty"` +} + +// CreateOrganizationPrivateRegistry represents the payload to create a private registry. +type CreateOrganizationPrivateRegistry struct { + // RegistryType is the type of private registry. + // You can find the list of supported types in PrivateRegistryType. + RegistryType string `json:"registry_type"` + + // URL is the URL of the private registry. + URL string `json:"url"` + + // The username to use when authenticating with the private registry. + // This field should be omitted if the private registry does not require a username for authentication. + Username *string `json:"username,omitempty"` + + // The value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) + // using the public key retrieved from the PrivateRegistriesService.GetOrganizationPrivateRegistriesPublicKey. + EncryptedValue string `json:"encrypted_value"` + // KeyID is the ID of the public key used to encrypt the secret. + KeyID string `json:"key_id"` + // Visibility is the visibility of the private registry. + // Possible values are: "private", "all", and "selected". + Visibility PrivateRegistryVisibility `json:"visibility"` + + // An array of repository IDs that can access the organization private registry. + // You can only provide a list of repository IDs when CreateOrganizationPrivateRegistry.Visibility is set to PrivateRegistryVisibilitySelected. + // This field should be omitted if visibility is set to PrivateRegistryVisibilityAll or PrivateRegistryVisibilityPrivate. + SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"` +} + +// UpdateOrganizationPrivateRegistry represents the payload to update a private registry. +type UpdateOrganizationPrivateRegistry struct { + // RegistryType is the type of private registry. + // You can find the list of supported types in PrivateRegistryType. + RegistryType *string `json:"registry_type,omitempty"` + + // URL is the URL of the private registry. + URL *string `json:"url,omitempty"` + + // The username to use when authenticating with the private registry. + // This field should be omitted if the private registry does not require a username for authentication. + Username *string `json:"username,omitempty"` + + // The value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) + // using the public key retrieved from the PrivateRegistriesService.GetOrganizationPrivateRegistriesPublicKey. + EncryptedValue *string `json:"encrypted_value,omitempty"` + // KeyID is the ID of the public key used to encrypt the secret. + KeyID *string `json:"key_id,omitempty"` + // Visibility is the visibility of the private registry. + // Possible values are: "private", "all", and "selected". + Visibility *PrivateRegistryVisibility `json:"visibility,omitempty"` + + // An array of repository IDs that can access the organization private registry. + // You can only provide a list of repository IDs when CreateOrganizationPrivateRegistry.Visibility is set to PrivateRegistryVisibilitySelected. + // This field should be omitted if visibility is set to PrivateRegistryVisibilityAll or PrivateRegistryVisibilityPrivate. + SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"` +} + +// ListOrganizationPrivateRegistries lists private registries for an organization. +// +// GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations#list-private-registries-for-an-organization +// +//meta:operation GET /orgs/{org}/private-registries +func (s *PrivateRegistriesService) ListOrganizationPrivateRegistries(ctx context.Context, org string, opts *ListOptions) (*PrivateRegistries, *Response, error) { + u := fmt.Sprintf("orgs/%v/private-registries", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var privateRegistries PrivateRegistries + resp, err := s.client.Do(ctx, req, &privateRegistries) + if err != nil { + return nil, resp, err + } + return &privateRegistries, resp, nil +} + +// CreateOrganizationPrivateRegistry creates a private registry configuration with an encrypted value for an organization. +// +// GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations#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) { + u := fmt.Sprintf("orgs/%v/private-registries", org) + + req, err := s.client.NewRequest("POST", u, privateRegistry) + if err != nil { + return nil, nil, err + } + + var result PrivateRegistry + resp, err := s.client.Do(ctx, req, &result) + if err != nil { + return nil, resp, err + } + return &result, resp, nil +} + +// GetOrganizationPrivateRegistriesPublicKey retrieves the public key for encrypting secrets for an organization's private registries. +// +// GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations#get-private-registries-public-key-for-an-organization +// +//meta:operation GET /orgs/{org}/private-registries/public-key +func (s *PrivateRegistriesService) GetOrganizationPrivateRegistriesPublicKey(ctx context.Context, org string) (*PublicKey, *Response, error) { + u := fmt.Sprintf("orgs/%v/private-registries/public-key", org) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var publicKey PublicKey + resp, err := s.client.Do(ctx, req, &publicKey) + if err != nil { + return nil, resp, err + } + return &publicKey, resp, nil +} + +// GetOrganizationPrivateRegistry gets a specific private registry for an organization. +// The `name` parameter is the name of the private registry to retrieve. It is the same as PrivateRegistry.Name. +// +// GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations#get-a-private-registry-for-an-organization +// +//meta:operation GET /orgs/{org}/private-registries/{secret_name} +func (s *PrivateRegistriesService) GetOrganizationPrivateRegistry(ctx context.Context, org, secretName string) (*PrivateRegistry, *Response, error) { + u := fmt.Sprintf("orgs/%v/private-registries/%v", org, secretName) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var privateRegistry PrivateRegistry + resp, err := s.client.Do(ctx, req, &privateRegistry) + if err != nil { + return nil, resp, err + } + + return &privateRegistry, resp, nil +} + +// UpdateOrganizationPrivateRegistry updates a specific private registry for an organization. +// The `name` parameter is the name of the private registry to update. It is the same as PrivateRegistry.Name. +// +// GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations#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) (*PrivateRegistry, *Response, error) { + u := fmt.Sprintf("orgs/%v/private-registries/%v", org, secretName) + + req, err := s.client.NewRequest("PATCH", u, privateRegistry) + if err != nil { + return nil, nil, err + } + + var updatedRegistry PrivateRegistry + resp, err := s.client.Do(ctx, req, &updatedRegistry) + if err != nil { + return nil, resp, err + } + + return &updatedRegistry, resp, nil +} + +// DeleteOrganizationPrivateRegistry deletes a specific private registry for an organization. +// The `name` parameter is the name of the private registry to delete. It is the same as PrivateRegistry.Name. +// +// GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations#delete-a-private-registry-for-an-organization +// +//meta:operation DELETE /orgs/{org}/private-registries/{secret_name} +func (s *PrivateRegistriesService) DeleteOrganizationPrivateRegistry(ctx context.Context, org, secretName string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/private-registries/%v", org, secretName) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v84/github/projects.go b/vendor/github.com/google/go-github/v84/github/projects.go new file mode 100644 index 000000000..8d6cbf8da --- /dev/null +++ b/vendor/github.com/google/go-github/v84/github/projects.go @@ -0,0 +1,703 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "encoding/json" + "fmt" +) + +// ProjectsService handles communication with the project V2 +// methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/projects/projects +type ProjectsService service + +// ProjectV2ItemContentType represents the type of content in a ProjectV2Item. +type ProjectV2ItemContentType string + +// This is the set of possible content types for a ProjectV2Item. +const ( + ProjectV2ItemContentTypeDraftIssue ProjectV2ItemContentType = "DraftIssue" + ProjectV2ItemContentTypeIssue ProjectV2ItemContentType = "Issue" + ProjectV2ItemContentTypePullRequest ProjectV2ItemContentType = "PullRequest" +) + +// ProjectV2StatusUpdate represents a status update for a project. +type ProjectV2StatusUpdate struct { + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + ProjectNodeID *string `json:"project_node_id,omitempty"` + Creator *User `json:"creator,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + // Status can be one of: "INACTIVE", "ON_TRACK", "AT_RISK", "OFF_TRACK", "COMPLETE". + Status *string `json:"status,omitempty"` + StartDate *string `json:"start_date,omitempty"` + TargetDate *string `json:"target_date,omitempty"` + Body *string `json:"body,omitempty"` +} + +// ProjectV2DraftIssue represents a draft issue in a project. +type ProjectV2DraftIssue struct { + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Title *string `json:"title,omitempty"` + Body *string `json:"body,omitempty"` + User *User `json:"user,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +// ProjectV2 represents a v2 project. +type ProjectV2 struct { + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Owner *User `json:"owner,omitempty"` + Creator *User `json:"creator,omitempty"` + Title *string `json:"title,omitempty"` + Description *string `json:"description,omitempty"` + Public *bool `json:"public,omitempty"` + ClosedAt *Timestamp `json:"closed_at,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + DeletedAt *Timestamp `json:"deleted_at,omitempty"` + Number *int `json:"number,omitempty"` + ShortDescription *string `json:"short_description,omitempty"` + DeletedBy *User `json:"deleted_by,omitempty"` + State *string `json:"state,omitempty"` + LatestStatusUpdate *ProjectV2StatusUpdate `json:"latest_status_update,omitempty"` + IsTemplate *bool `json:"is_template,omitempty"` + + // Fields migrated from the Project (classic) struct: + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + ColumnsURL *string `json:"columns_url,omitempty"` + OwnerURL *string `json:"owner_url,omitempty"` + Name *string `json:"name,omitempty"` + Body *string `json:"body,omitempty"` + OrganizationPermission *string `json:"organization_permission,omitempty"` + Private *bool `json:"private,omitempty"` +} + +func (p ProjectV2) String() string { return Stringify(p) } + +// ListProjectsPaginationOptions specifies optional parameters to list projects for user / organization. +// +// Note: Pagination is powered by before/after cursor-style pagination. After the initial call, +// inspect the returned *Response. Use resp.After as the opts.After value to request +// the next page, and resp.Before as the opts.Before value to request the previous +// page. Set either Before or After for a request; if both are +// supplied GitHub API will return an error. PerPage controls the number of items +// per page (max 100 per GitHub API docs). +type ListProjectsPaginationOptions struct { + // A cursor, as given in the Link header. If specified, the query only searches for events before this cursor. + Before string `url:"before,omitempty"` + + // A cursor, as given in the Link header. If specified, the query only searches for events after this cursor. + After string `url:"after,omitempty"` + + // For paginated result sets, the number of results to include per page. + PerPage int `url:"per_page,omitempty"` +} + +// ListProjectsOptions specifies optional parameters to list projects for user / organization. +type ListProjectsOptions struct { + ListProjectsPaginationOptions + + // Q is an optional query string to limit results to projects of the specified type. + Query string `url:"q,omitempty"` +} + +// ProjectV2TextContent represents text content in a project field option or iteration. +// It includes both HTML and raw text representations. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields +type ProjectV2TextContent struct { + HTML *string `json:"html,omitempty"` + Raw *string `json:"raw,omitempty"` +} + +// ProjectV2FieldOption represents an option for a project field of type single_select or multi_select. +// It defines the available choices that can be selected for dropdown-style fields. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields +type ProjectV2FieldOption struct { + ID *string `json:"id,omitempty"` // The unique identifier for this option. + Color *string `json:"color,omitempty"` // The color associated with this option (e.g., "blue", "red"). + Description *ProjectV2TextContent `json:"description,omitempty"` // An optional description for this option. + Name *ProjectV2TextContent `json:"name,omitempty"` // The display name of the option. +} + +// ProjectV2FieldIteration represents an iteration within a project field of type iteration. +// It defines a specific time-bound period that can be associated with project items. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields +type ProjectV2FieldIteration struct { + ID *string `json:"id,omitempty"` // The unique identifier for the iteration. + Title *ProjectV2TextContent `json:"title,omitempty"` // The title of the iteration. + StartDate *string `json:"start_date,omitempty"` // The start date of the iteration in ISO 8601 format. + Duration *int `json:"duration,omitempty"` // The duration of the iteration in seconds. +} + +// ProjectV2FieldConfiguration represents the configuration for a project field of type iteration. +// It defines settings such as duration and start day for iterations within the project. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields +type ProjectV2FieldConfiguration struct { + Duration *int `json:"duration,omitempty"` // The duration of the iteration field in seconds. + StartDay *int `json:"start_day,omitempty"` // The start day for the iteration. + Iterations []*ProjectV2FieldIteration `json:"iterations,omitempty"` // The list of iterations associated with the configuration. +} + +// ProjectV2ItemContent is a union type that holds the content of a ProjectV2Item. +// The actual type depends on the ContentType field of the parent ProjectV2Item. +// Only one of the fields will be populated after unmarshaling. +type ProjectV2ItemContent struct { + Issue *Issue `json:"-"` + PullRequest *PullRequest `json:"-"` + DraftIssue *ProjectV2DraftIssue `json:"-"` +} + +// MarshalJSON implements custom marshaling for ProjectV2ItemContent. +func (c *ProjectV2ItemContent) MarshalJSON() ([]byte, error) { + if c.Issue != nil { + return json.Marshal(c.Issue) + } + if c.PullRequest != nil { + return json.Marshal(c.PullRequest) + } + if c.DraftIssue != nil { + return json.Marshal(c.DraftIssue) + } + return []byte("null"), nil +} + +// ProjectV2Item represents a full project item with field values. +// This type is used by Get, List, and Update operations which return field values. +// The Content field is automatically unmarshaled into the appropriate type based on ContentType. +type ProjectV2Item struct { + ArchivedAt *Timestamp `json:"archived_at,omitempty"` + Content *ProjectV2ItemContent `json:"content,omitempty"` + ContentType *ProjectV2ItemContentType `json:"content_type,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + Creator *User `json:"creator,omitempty"` + Fields []*ProjectV2ItemFieldValue `json:"fields,omitempty"` + ID *int64 `json:"id,omitempty"` + ItemURL *string `json:"item_url,omitempty"` + NodeID *string `json:"node_id,omitempty"` + ProjectURL *string `json:"project_url,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + + // ProjectNodeID and ContentNodeID are used in ProjectsV2Item Webhook payloads. + // They may not be populated in all API responses, but are included here for completeness. + // See: https://docs.github.com/en/webhooks/webhook-events-and-payloads#projects_v2_item + ProjectNodeID *string `json:"project_node_id,omitempty"` + ContentNodeID *string `json:"content_node_id,omitempty"` +} + +// UnmarshalJSON implements custom unmarshaling for ProjectV2Item. +// It uses the ContentType field to determine how to unmarshal the Content field. +func (p *ProjectV2Item) UnmarshalJSON(data []byte) error { + type contentAlias ProjectV2Item + + aux := &struct { + Content json.RawMessage `json:"content,omitempty"` + *contentAlias + }{ + contentAlias: (*contentAlias)(p), + } + + if err := json.Unmarshal(data, aux); err != nil { + return err + } + + // Now unmarshal the content based on ContentType + if len(aux.Content) > 0 && string(aux.Content) != "null" && p.ContentType != nil { + p.Content = &ProjectV2ItemContent{} + switch *p.ContentType { + case ProjectV2ItemContentTypeIssue: + p.Content.Issue = &Issue{} + return json.Unmarshal(aux.Content, p.Content.Issue) + case ProjectV2ItemContentTypePullRequest: + p.Content.PullRequest = &PullRequest{} + return json.Unmarshal(aux.Content, p.Content.PullRequest) + case ProjectV2ItemContentTypeDraftIssue: + p.Content.DraftIssue = &ProjectV2DraftIssue{} + return json.Unmarshal(aux.Content, p.Content.DraftIssue) + } + } + + return nil +} + +// ProjectV2Field represents a field in a GitHub Projects V2 project. +// Fields define the structure and data types for project items. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields +type ProjectV2Field struct { + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Name *string `json:"name,omitempty"` + DataType *string `json:"data_type,omitempty"` + ProjectURL *string `json:"project_url,omitempty"` + Options []*ProjectV2FieldOption `json:"options,omitempty"` + Configuration *ProjectV2FieldConfiguration `json:"configuration,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +// ProjectV2ItemFieldValue represents a field value of a project item. +type ProjectV2ItemFieldValue struct { + ID *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + DataType *string `json:"data_type,omitempty"` + // Value set for the field. The type depends on the field type: + // - text: string + // - number: float64 + // - date: string (ISO 8601 date format, e.g. "2023-06-23") or null + // - single_select: object with "id", "name", "color", "description" fields or null + // - iteration: object with "id", "title", "start_date", "duration" fields or null + // - title: object with "text" field (read-only, reflects the item's title) or null + // - assignees: array of user objects with "login", "id", etc. or null + // - labels: array of label objects with "id", "name", "color", etc. or null + // - linked_pull_requests: array of pull request objects or null + // - milestone: milestone object with "id", "title", "description", etc. or null + // - repository: repository object with "id", "name", "full_name", etc. or null + // - reviewers: array of user objects or null + // - status: object with "id", "name", "color", "description" fields (same structure as single_select) or null + Value any `json:"value,omitempty"` +} + +// ListOrganizationProjects lists Projects V2 for an organization. +// +// GitHub API docs: https://docs.github.com/rest/projects/projects#list-projects-for-organization +// +//meta:operation GET /orgs/{org}/projectsV2 +func (s *ProjectsService) ListOrganizationProjects(ctx context.Context, org string, opts *ListProjectsOptions) ([]*ProjectV2, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var projects []*ProjectV2 + resp, err := s.client.Do(ctx, req, &projects) + if err != nil { + return nil, resp, err + } + return projects, resp, nil +} + +// GetOrganizationProject gets a Projects V2 project for an organization by ID. +// +// GitHub API docs: https://docs.github.com/rest/projects/projects#get-project-for-organization +// +//meta:operation GET /orgs/{org}/projectsV2/{project_number} +func (s *ProjectsService) GetOrganizationProject(ctx context.Context, org string, projectNumber int) (*ProjectV2, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v", org, projectNumber) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + project := new(ProjectV2) + resp, err := s.client.Do(ctx, req, project) + if err != nil { + return nil, resp, err + } + return project, resp, nil +} + +// ListUserProjects lists Projects V2 for a user. +// +// GitHub API docs: https://docs.github.com/rest/projects/projects#list-projects-for-user +// +//meta:operation GET /users/{username}/projectsV2 +func (s *ProjectsService) ListUserProjects(ctx context.Context, username string, opts *ListProjectsOptions) ([]*ProjectV2, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2", username) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var projects []*ProjectV2 + resp, err := s.client.Do(ctx, req, &projects) + if err != nil { + return nil, resp, err + } + return projects, resp, nil +} + +// GetUserProject gets a Projects V2 project for a user by ID. +// +// GitHub API docs: https://docs.github.com/rest/projects/projects#get-project-for-user +// +//meta:operation GET /users/{username}/projectsV2/{project_number} +func (s *ProjectsService) GetUserProject(ctx context.Context, username string, projectNumber int) (*ProjectV2, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v", username, projectNumber) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + project := new(ProjectV2) + resp, err := s.client.Do(ctx, req, project) + if err != nil { + return nil, resp, err + } + return project, resp, nil +} + +// ListOrganizationProjectFields lists Projects V2 for an organization. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields#list-project-fields-for-organization +// +//meta:operation GET /orgs/{org}/projectsV2/{project_number}/fields +func (s *ProjectsService) ListOrganizationProjectFields(ctx context.Context, org string, projectNumber int, opts *ListProjectsOptions) ([]*ProjectV2Field, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/fields", org, projectNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var fields []*ProjectV2Field + resp, err := s.client.Do(ctx, req, &fields) + if err != nil { + return nil, resp, err + } + return fields, resp, nil +} + +// ListUserProjectFields lists Projects V2 for a user. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields#list-project-fields-for-user +// +//meta:operation GET /users/{username}/projectsV2/{project_number}/fields +func (s *ProjectsService) ListUserProjectFields(ctx context.Context, user string, projectNumber int, opts *ListProjectsOptions) ([]*ProjectV2Field, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/fields", user, projectNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var fields []*ProjectV2Field + resp, err := s.client.Do(ctx, req, &fields) + if err != nil { + return nil, resp, err + } + return fields, resp, nil +} + +// GetOrganizationProjectField gets a single project field from an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields#get-project-field-for-organization +// +//meta:operation GET /orgs/{org}/projectsV2/{project_number}/fields/{field_id} +func (s *ProjectsService) GetOrganizationProjectField(ctx context.Context, org string, projectNumber int, fieldID int64) (*ProjectV2Field, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/fields/%v", org, projectNumber, fieldID) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + field := new(ProjectV2Field) + resp, err := s.client.Do(ctx, req, field) + if err != nil { + return nil, resp, err + } + return field, resp, nil +} + +// GetUserProjectField gets a single project field from a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields#get-project-field-for-user +// +//meta:operation GET /users/{username}/projectsV2/{project_number}/fields/{field_id} +func (s *ProjectsService) GetUserProjectField(ctx context.Context, user string, projectNumber int, fieldID int64) (*ProjectV2Field, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/fields/%v", user, projectNumber, fieldID) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + field := new(ProjectV2Field) + resp, err := s.client.Do(ctx, req, field) + if err != nil { + return nil, resp, err + } + return field, resp, nil +} + +// ListProjectItemsOptions specifies optional parameters when listing project items. +// Note: Pagination uses before/after cursor-style pagination similar to ListProjectsOptions. +// "Fields" can be used to restrict which field values are returned (by their numeric IDs). +type ListProjectItemsOptions struct { + // Embed ListProjectsOptions to reuse pagination and query parameters. + ListProjectsOptions + // Fields restricts which field values are returned by numeric field IDs. + Fields []int64 `url:"fields,omitempty,comma"` +} + +// GetProjectItemOptions specifies optional parameters when getting a project item. +type GetProjectItemOptions struct { + // Fields restricts which field values are returned by numeric field IDs. + Fields []int64 `url:"fields,omitempty,comma"` +} + +// AddProjectItemOptions represents the payload to add an item (issue or pull request) +// to a project. The Type must be either "Issue" or "PullRequest" (as per API docs) and +// ID is the numerical ID of that issue or pull request. +type AddProjectItemOptions struct { + Type *ProjectV2ItemContentType `json:"type,omitempty"` + ID *int64 `json:"id,omitempty"` +} + +// UpdateProjectV2Field represents a field update for a project item. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#update-project-item-for-organization +type UpdateProjectV2Field struct { + // ID is the field ID to update. + ID int64 `json:"id"` + // Value is the new value to set for the field. The type depends on the field type. + // For text fields: string + // For number fields: float64 or int + // For single_select fields: string (option ID) + // For date fields: string (ISO 8601 date) + // For iteration fields: string (iteration ID) + // Note: Some field types (title, assignees, labels, etc.) are read-only or managed through other API endpoints. + Value any `json:"value"` +} + +// UpdateProjectItemOptions represents fields that can be modified for a project item. +// The GitHub API expects either archived status updates or field value updates. +type UpdateProjectItemOptions struct { + // Archived indicates whether the item should be archived (true) or unarchived (false). + // This is used for archive/unarchive operations. + Archived *bool `json:"archived,omitempty"` + // Fields contains field updates to apply to the project item. + // Each entry specifies a field ID and its new value. + Fields []*UpdateProjectV2Field `json:"fields,omitempty"` +} + +// ListOrganizationProjectItems lists items for an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#list-items-for-an-organization-owned-project +// +//meta:operation GET /orgs/{org}/projectsV2/{project_number}/items +func (s *ProjectsService) ListOrganizationProjectItems(ctx context.Context, org string, projectNumber int, opts *ListProjectItemsOptions) ([]*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/items", org, projectNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var items []*ProjectV2Item + resp, err := s.client.Do(ctx, req, &items) + if err != nil { + return nil, resp, err + } + return items, resp, nil +} + +// AddOrganizationProjectItem adds an issue or pull request item to an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#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) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/items", org, projectNumber) + req, err := s.client.NewRequest("POST", u, opts) + if err != nil { + return nil, nil, err + } + + item := new(ProjectV2Item) + resp, err := s.client.Do(ctx, req, item) + if err != nil { + return nil, resp, err + } + return item, resp, nil +} + +// GetOrganizationProjectItem gets a single item from an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#get-an-item-for-an-organization-owned-project +// +//meta:operation GET /orgs/{org}/projectsV2/{project_number}/items/{item_id} +func (s *ProjectsService) GetOrganizationProjectItem(ctx context.Context, org string, projectNumber int, itemID int64, opts *GetProjectItemOptions) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/items/%v", org, projectNumber, itemID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + item := new(ProjectV2Item) + resp, err := s.client.Do(ctx, req, item) + if err != nil { + return nil, resp, err + } + return item, resp, nil +} + +// UpdateOrganizationProjectItem updates an item in an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#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) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/items/%v", org, projectNumber, itemID) + req, err := s.client.NewRequest("PATCH", u, opts) + if err != nil { + return nil, nil, err + } + item := new(ProjectV2Item) + resp, err := s.client.Do(ctx, req, item) + if err != nil { + return nil, resp, err + } + return item, resp, nil +} + +// DeleteOrganizationProjectItem deletes an item from an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#delete-project-item-for-organization +// +//meta:operation DELETE /orgs/{org}/projectsV2/{project_number}/items/{item_id} +func (s *ProjectsService) DeleteOrganizationProjectItem(ctx context.Context, org string, projectNumber int, itemID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/items/%v", org, projectNumber, itemID) + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + return s.client.Do(ctx, req, nil) +} + +// ListUserProjectItems lists items for a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#list-items-for-a-user-owned-project +// +//meta:operation GET /users/{username}/projectsV2/{project_number}/items +func (s *ProjectsService) ListUserProjectItems(ctx context.Context, username string, projectNumber int, opts *ListProjectItemsOptions) ([]*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/items", username, projectNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + var items []*ProjectV2Item + resp, err := s.client.Do(ctx, req, &items) + if err != nil { + return nil, resp, err + } + return items, resp, nil +} + +// AddUserProjectItem adds an issue or pull request item to a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#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) { + u := fmt.Sprintf("users/%v/projectsV2/%v/items", username, projectNumber) + req, err := s.client.NewRequest("POST", u, opts) + if err != nil { + return nil, nil, err + } + item := new(ProjectV2Item) + resp, err := s.client.Do(ctx, req, item) + if err != nil { + return nil, resp, err + } + return item, resp, nil +} + +// GetUserProjectItem gets a single item from a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#get-an-item-for-a-user-owned-project +// +//meta:operation GET /users/{username}/projectsV2/{project_number}/items/{item_id} +func (s *ProjectsService) GetUserProjectItem(ctx context.Context, username string, projectNumber int, itemID int64, opts *GetProjectItemOptions) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/items/%v", username, projectNumber, itemID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + item := new(ProjectV2Item) + resp, err := s.client.Do(ctx, req, item) + if err != nil { + return nil, resp, err + } + return item, resp, nil +} + +// UpdateUserProjectItem updates an item in a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#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) { + u := fmt.Sprintf("users/%v/projectsV2/%v/items/%v", username, projectNumber, itemID) + req, err := s.client.NewRequest("PATCH", u, opts) + if err != nil { + return nil, nil, err + } + item := new(ProjectV2Item) + resp, err := s.client.Do(ctx, req, item) + if err != nil { + return nil, resp, err + } + return item, resp, nil +} + +// DeleteUserProjectItem deletes an item from a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#delete-project-item-for-user +// +//meta:operation DELETE /users/{username}/projectsV2/{project_number}/items/{item_id} +func (s *ProjectsService) DeleteUserProjectItem(ctx context.Context, username string, projectNumber int, itemID int64) (*Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/items/%v", username, projectNumber, itemID) + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + return s.client.Do(ctx, req, nil) +} diff --git a/vendor/github.com/google/go-github/v75/github/pulls.go b/vendor/github.com/google/go-github/v84/github/pulls.go similarity index 95% rename from vendor/github.com/google/go-github/v75/github/pulls.go rename to vendor/github.com/google/go-github/v84/github/pulls.go index 48717941f..aefd08a6d 100644 --- a/vendor/github.com/google/go-github/v75/github/pulls.go +++ b/vendor/github.com/google/go-github/v84/github/pulls.go @@ -142,7 +142,7 @@ type PullRequestListOptions struct { Sort string `url:"sort,omitempty"` // Direction in which to sort pull requests. Possible values are: asc, desc. - // If Sort is "created" or not specified, Default is "desc", otherwise Default + // If Sort is "created" or not specified, Default is "desc"; otherwise, Default // is "asc" Direction string `url:"direction,omitempty"` @@ -197,7 +197,6 @@ func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, ow return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeListPullsOrBranchesForCommitPreview) var pulls []*PullRequest resp, err := s.client.Do(ctx, req, &pulls) @@ -214,7 +213,7 @@ func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, ow // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number} func (s *PullRequestsService) Get(ctx context.Context, owner, repo string, number int) (*PullRequest, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v", owner, repo, number) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -235,7 +234,7 @@ func (s *PullRequestsService) Get(ctx context.Context, owner, repo string, numbe // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number} func (s *PullRequestsService) GetRaw(ctx context.Context, owner, repo string, number int, opts RawOptions) (string, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v", owner, repo, number) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return "", nil, err @@ -247,7 +246,7 @@ func (s *PullRequestsService) GetRaw(ctx context.Context, owner, repo string, nu case Patch: req.Header.Set("Accept", mediaTypeV3Patch) default: - return "", nil, fmt.Errorf("unsupported raw type %d", opts.Type) + return "", nil, fmt.Errorf("unsupported raw type %v", opts.Type) } var buf bytes.Buffer @@ -325,14 +324,13 @@ type PullRequestBranchUpdateResponse struct { // //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) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/update-branch", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/update-branch", owner, repo, number) req, err := s.client.NewRequest("PUT", u, opts) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeUpdatePullRequestBranchPreview) p := new(PullRequestBranchUpdateResponse) @@ -366,7 +364,7 @@ func (s *PullRequestsService) Edit(ctx context.Context, owner, repo string, numb return nil, nil, errors.New("pull must be provided") } - u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v", owner, repo, number) update := &pullRequestUpdate{ Title: pull.Title, @@ -401,7 +399,7 @@ func (s *PullRequestsService) Edit(ctx context.Context, owner, repo string, numb // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/commits func (s *PullRequestsService) ListCommits(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*RepositoryCommit, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/commits", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/commits", owner, repo, number) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -427,7 +425,7 @@ func (s *PullRequestsService) ListCommits(ctx context.Context, owner, repo strin // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/files func (s *PullRequestsService) ListFiles(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*CommitFile, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/files", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/files", owner, repo, number) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -453,7 +451,7 @@ func (s *PullRequestsService) ListFiles(ctx context.Context, owner, repo string, // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/merge func (s *PullRequestsService) IsMerged(ctx context.Context, owner, repo string, number int) (bool, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/merge", owner, repo, number) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return false, nil, err @@ -497,7 +495,7 @@ type pullRequestMergeRequest struct { // //meta:operation PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge func (s *PullRequestsService) Merge(ctx context.Context, owner, repo string, number int, commitMessage string, options *PullRequestOptions) (*PullRequestMergeResult, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/merge", owner, repo, number) pullRequestBody := &pullRequestMergeRequest{} if commitMessage != "" { diff --git a/vendor/github.com/google/go-github/v75/github/pulls_comments.go b/vendor/github.com/google/go-github/v84/github/pulls_comments.go similarity index 93% rename from vendor/github.com/google/go-github/v75/github/pulls_comments.go rename to vendor/github.com/google/go-github/v84/github/pulls_comments.go index 431b45088..4d601730b 100644 --- a/vendor/github.com/google/go-github/v75/github/pulls_comments.go +++ b/vendor/github.com/google/go-github/v84/github/pulls_comments.go @@ -73,6 +73,7 @@ type PullRequestListCommentsOptions struct { // the repository. // // GitHub API docs: https://docs.github.com/rest/pulls/comments#list-review-comments-in-a-repository +// // GitHub API docs: https://docs.github.com/rest/pulls/comments#list-review-comments-on-a-pull-request // //meta:operation GET /repos/{owner}/{repo}/pulls/comments @@ -82,7 +83,7 @@ func (s *PullRequestsService) ListComments(ctx context.Context, owner, repo stri if number == 0 { u = fmt.Sprintf("repos/%v/%v/pulls/comments", owner, repo) } else { - u = fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number) + u = fmt.Sprintf("repos/%v/%v/pulls/%v/comments", owner, repo, number) } u, err := addOptions(u, opts) if err != nil { @@ -94,7 +95,6 @@ func (s *PullRequestsService) ListComments(ctx context.Context, owner, repo stri return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) @@ -113,13 +113,12 @@ func (s *PullRequestsService) ListComments(ctx context.Context, owner, repo stri // //meta:operation GET /repos/{owner}/{repo}/pulls/comments/{comment_id} func (s *PullRequestsService) GetComment(ctx context.Context, owner, repo string, commentID int64) (*PullRequestComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID) + u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v", owner, repo, commentID) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) @@ -138,12 +137,11 @@ func (s *PullRequestsService) GetComment(ctx context.Context, owner, repo string // //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) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/comments", owner, repo, number) req, err := s.client.NewRequest("POST", u, comment) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when their respective API fully launches. acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) @@ -169,7 +167,7 @@ func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner, Body: body, InReplyTo: commentID, } - u := fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/comments", owner, repo, number) req, err := s.client.NewRequest("POST", u, comment) if err != nil { return nil, nil, err @@ -191,7 +189,7 @@ func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner, // //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) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID) + u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v", owner, repo, commentID) req, err := s.client.NewRequest("PATCH", u, comment) if err != nil { return nil, nil, err @@ -212,7 +210,7 @@ func (s *PullRequestsService) EditComment(ctx context.Context, owner, repo strin // //meta:operation DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id} func (s *PullRequestsService) DeleteComment(ctx context.Context, owner, repo string, commentID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID) + u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v", owner, repo, commentID) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err diff --git a/vendor/github.com/google/go-github/v75/github/pulls_reviewers.go b/vendor/github.com/google/go-github/v84/github/pulls_reviewers.go similarity index 90% rename from vendor/github.com/google/go-github/v75/github/pulls_reviewers.go rename to vendor/github.com/google/go-github/v84/github/pulls_reviewers.go index 526047937..daa171fae 100644 --- a/vendor/github.com/google/go-github/v75/github/pulls_reviewers.go +++ b/vendor/github.com/google/go-github/v84/github/pulls_reviewers.go @@ -36,7 +36,7 @@ type removeReviewersRequest struct { // //meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers func (s *PullRequestsService) RequestReviewers(ctx context.Context, owner, repo string, number int, reviewers ReviewersRequest) (*PullRequest, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/pulls/%d/requested_reviewers", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/requested_reviewers", owner, repo, number) req, err := s.client.NewRequest("POST", u, &reviewers) if err != nil { return nil, nil, err @@ -56,12 +56,8 @@ func (s *PullRequestsService) RequestReviewers(ctx context.Context, owner, repo // GitHub API docs: https://docs.github.com/rest/pulls/review-requests#get-all-requested-reviewers-for-a-pull-request // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers -func (s *PullRequestsService) ListReviewers(ctx context.Context, owner, repo string, number int, opts *ListOptions) (*Reviewers, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/requested_reviewers", owner, repo, number) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } +func (s *PullRequestsService) ListReviewers(ctx context.Context, owner, repo string, number int) (*Reviewers, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v/requested_reviewers", owner, repo, number) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -93,7 +89,7 @@ func (s *PullRequestsService) RemoveReviewers(ctx context.Context, owner, repo s removeRequest.Reviewers = []string{} } - u := fmt.Sprintf("repos/%s/%s/pulls/%d/requested_reviewers", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/requested_reviewers", owner, repo, number) req, err := s.client.NewRequest("DELETE", u, &removeRequest) if err != nil { return nil, err diff --git a/vendor/github.com/google/go-github/v75/github/pulls_reviews.go b/vendor/github.com/google/go-github/v84/github/pulls_reviews.go similarity index 95% rename from vendor/github.com/google/go-github/v75/github/pulls_reviews.go rename to vendor/github.com/google/go-github/v84/github/pulls_reviews.go index 84e06a0ea..e8cf7a75b 100644 --- a/vendor/github.com/google/go-github/v75/github/pulls_reviews.go +++ b/vendor/github.com/google/go-github/v84/github/pulls_reviews.go @@ -108,7 +108,7 @@ func (r PullRequestReviewDismissalRequest) String() string { // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews", owner, repo, number) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -134,7 +134,7 @@ func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo strin // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v", owner, repo, number, reviewID) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -156,7 +156,7 @@ func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, // //meta:operation DELETE /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v", owner, repo, number, reviewID) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -178,7 +178,7 @@ func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, re // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, repo string, number int, reviewID int64, opts *ListOptions) ([]*PullRequestComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/comments", owner, repo, number, reviewID) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v/comments", owner, repo, number, reviewID) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -238,7 +238,7 @@ func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, rep // //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) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews", owner, repo, number) req, err := s.client.NewRequest("POST", u, review) if err != nil { @@ -272,7 +272,7 @@ func (s *PullRequestsService) UpdateReview(ctx context.Context, owner, repo stri opts := &struct { Body string `json:"body"` }{Body: body} - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v", owner, repo, number, reviewID) req, err := s.client.NewRequest("PUT", u, opts) if err != nil { @@ -294,7 +294,7 @@ func (s *PullRequestsService) UpdateReview(ctx context.Context, owner, repo stri // //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) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/events", owner, repo, number, reviewID) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v/events", owner, repo, number, reviewID) req, err := s.client.NewRequest("POST", u, review) if err != nil { @@ -316,7 +316,7 @@ func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo stri // //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) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/dismissals", owner, repo, number, reviewID) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v/dismissals", owner, repo, number, reviewID) req, err := s.client.NewRequest("PUT", u, review) if err != nil { diff --git a/vendor/github.com/google/go-github/v75/github/pulls_threads.go b/vendor/github.com/google/go-github/v84/github/pulls_threads.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/pulls_threads.go rename to vendor/github.com/google/go-github/v84/github/pulls_threads.go diff --git a/vendor/github.com/google/go-github/v75/github/rate_limit.go b/vendor/github.com/google/go-github/v84/github/rate_limit.go similarity index 96% rename from vendor/github.com/google/go-github/v75/github/rate_limit.go rename to vendor/github.com/google/go-github/v84/github/rate_limit.go index 6236eba8f..a26a23c93 100644 --- a/vendor/github.com/google/go-github/v75/github/rate_limit.go +++ b/vendor/github.com/google/go-github/v84/github/rate_limit.go @@ -63,6 +63,7 @@ type RateLimits struct { DependencySnapshots *Rate `json:"dependency_snapshots"` CodeSearch *Rate `json:"code_search"` AuditLog *Rate `json:"audit_log"` + DependencySBOM *Rate `json:"dependency_sbom"` } func (r RateLimits) String() string { @@ -126,6 +127,9 @@ func (s *RateLimitService) Get(ctx context.Context) (*RateLimits, *Response, err if response.Resources.AuditLog != nil { s.client.rateLimits[AuditLogCategory] = *response.Resources.AuditLog } + if response.Resources.DependencySBOM != nil { + s.client.rateLimits[DependencySBOMCategory] = *response.Resources.DependencySBOM + } s.client.rateMu.Unlock() } diff --git a/vendor/github.com/google/go-github/v75/github/reactions.go b/vendor/github.com/google/go-github/v84/github/reactions.go similarity index 93% rename from vendor/github.com/google/go-github/v75/github/reactions.go rename to vendor/github.com/google/go-github/v84/github/reactions.go index 5233f78d3..f8b4023c2 100644 --- a/vendor/github.com/google/go-github/v75/github/reactions.go +++ b/vendor/github.com/google/go-github/v84/github/reactions.go @@ -8,7 +8,6 @@ package github import ( "context" "fmt" - "net/http" ) // ReactionsService provides access to the reactions-related functions in the @@ -75,7 +74,6 @@ func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction @@ -104,7 +102,6 @@ func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, rep return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) m := &Reaction{} @@ -155,7 +152,6 @@ func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo s return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction @@ -184,7 +180,6 @@ func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) m := &Reaction{} @@ -235,7 +230,6 @@ func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction @@ -264,7 +258,6 @@ func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) m := &Reaction{} @@ -315,7 +308,6 @@ func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction @@ -344,7 +336,6 @@ func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) m := &Reaction{} @@ -380,7 +371,7 @@ func (s *ReactionsService) DeletePullRequestCommentReactionByID(ctx context.Cont // ListTeamDiscussionReactions lists the reactions for a team discussion. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion-legacy +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/reactions/reactions#list-reactions-for-a-team-discussion-legacy // //meta:operation GET /teams/{team_id}/discussions/{discussion_number}/reactions func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, teamID int64, discussionNumber int, opts *ListReactionOptions) ([]*Reaction, *Response, error) { @@ -409,7 +400,7 @@ func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, team // CreateTeamDiscussionReaction creates a reaction for a team discussion. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion-legacy +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/reactions/reactions#create-reaction-for-a-team-discussion-legacy // //meta:operation POST /teams/{team_id}/discussions/{discussion_number}/reactions func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, teamID int64, discussionNumber int, content string) (*Reaction, *Response, error) { @@ -434,7 +425,7 @@ func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, tea // DeleteTeamDiscussionReaction deletes the reaction to a team discussion. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-team-discussion-reaction +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/reactions/reactions#delete-team-discussion-reaction // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id} func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org, teamSlug string, discussionNumber int, reactionID int64) (*Response, error) { @@ -445,7 +436,7 @@ func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org // DeleteTeamDiscussionReactionByOrgIDAndTeamID deletes the reaction to a team discussion by organization ID and team ID. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/reactions/reactions#create-reaction-for-a-team-discussion // //meta:operation POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber int, reactionID int64) (*Response, error) { @@ -456,7 +447,7 @@ func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx cont // ListTeamDiscussionCommentReactions lists the reactions for a team discussion comment. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion-comment-legacy +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/reactions/reactions#list-reactions-for-a-team-discussion-comment-legacy // //meta:operation GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Context, teamID int64, discussionNumber, commentNumber int, opts *ListReactionOptions) ([]*Reaction, *Response, error) { @@ -484,7 +475,7 @@ func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Contex // CreateTeamDiscussionCommentReaction creates a reaction for a team discussion comment. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion-comment-legacy +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/reactions/reactions#create-reaction-for-a-team-discussion-comment-legacy // //meta:operation POST /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Context, teamID int64, discussionNumber, commentNumber int, content string) (*Reaction, *Response, error) { @@ -509,7 +500,7 @@ func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Conte // DeleteTeamDiscussionCommentReaction deletes the reaction to a team discussion comment. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-team-discussion-comment-reaction +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/reactions/reactions#delete-team-discussion-comment-reaction // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id} func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Context, org, teamSlug string, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { @@ -520,7 +511,7 @@ func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Conte // DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID deletes the reaction to a team discussion comment by organization ID and team ID. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion-comment +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/reactions/reactions#create-reaction-for-a-team-discussion-comment // //meta:operation POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { @@ -530,12 +521,11 @@ func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID(c } func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest(http.MethodDelete, url, nil) + req, err := s.client.NewRequest("DELETE", url, nil) if err != nil { return nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) return s.client.Do(ctx, req, nil) @@ -586,7 +576,6 @@ func (s *ReactionsService) ListReleaseReactions(ctx context.Context, owner, repo return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction diff --git a/vendor/github.com/google/go-github/v75/github/repos.go b/vendor/github.com/google/go-github/v84/github/repos.go similarity index 93% rename from vendor/github.com/google/go-github/v75/github/repos.go rename to vendor/github.com/google/go-github/v84/github/repos.go index 26dc657f0..ac76f1f3f 100644 --- a/vendor/github.com/google/go-github/v75/github/repos.go +++ b/vendor/github.com/google/go-github/v84/github/repos.go @@ -27,59 +27,59 @@ type RepositoriesService service // Repository represents a GitHub repository. type Repository struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Owner *User `json:"owner,omitempty"` - Name *string `json:"name,omitempty"` - FullName *string `json:"full_name,omitempty"` - Description *string `json:"description,omitempty"` - Homepage *string `json:"homepage,omitempty"` - CodeOfConduct *CodeOfConduct `json:"code_of_conduct,omitempty"` - DefaultBranch *string `json:"default_branch,omitempty"` - MasterBranch *string `json:"master_branch,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - PushedAt *Timestamp `json:"pushed_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - CloneURL *string `json:"clone_url,omitempty"` - GitURL *string `json:"git_url,omitempty"` - MirrorURL *string `json:"mirror_url,omitempty"` - SSHURL *string `json:"ssh_url,omitempty"` - SVNURL *string `json:"svn_url,omitempty"` - Language *string `json:"language,omitempty"` - Fork *bool `json:"fork,omitempty"` - ForksCount *int `json:"forks_count,omitempty"` - NetworkCount *int `json:"network_count,omitempty"` - OpenIssuesCount *int `json:"open_issues_count,omitempty"` - OpenIssues *int `json:"open_issues,omitempty"` // Deprecated: Replaced by OpenIssuesCount. For backward compatibility OpenIssues is still populated. - StargazersCount *int `json:"stargazers_count,omitempty"` - SubscribersCount *int `json:"subscribers_count,omitempty"` - WatchersCount *int `json:"watchers_count,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility WatchersCount is still populated. - Watchers *int `json:"watchers,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility Watchers is still populated. - Size *int `json:"size,omitempty"` - AutoInit *bool `json:"auto_init,omitempty"` - Parent *Repository `json:"parent,omitempty"` - Source *Repository `json:"source,omitempty"` - TemplateRepository *Repository `json:"template_repository,omitempty"` - Organization *Organization `json:"organization,omitempty"` - Permissions map[string]bool `json:"permissions,omitempty"` - AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` - AllowUpdateBranch *bool `json:"allow_update_branch,omitempty"` - AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` - AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` - AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` - AllowForking *bool `json:"allow_forking,omitempty"` - WebCommitSignoffRequired *bool `json:"web_commit_signoff_required,omitempty"` - DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` - UseSquashPRTitleAsDefault *bool `json:"use_squash_pr_title_as_default,omitempty"` - SquashMergeCommitTitle *string `json:"squash_merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "COMMIT_OR_PR_TITLE" - SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "COMMIT_MESSAGES", "BLANK" - MergeCommitTitle *string `json:"merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "MERGE_MESSAGE" - MergeCommitMessage *string `json:"merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "PR_TITLE", "BLANK" - Topics []string `json:"topics,omitempty"` - CustomProperties map[string]any `json:"custom_properties,omitempty"` - Archived *bool `json:"archived,omitempty"` - Disabled *bool `json:"disabled,omitempty"` + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Owner *User `json:"owner,omitempty"` + Name *string `json:"name,omitempty"` + FullName *string `json:"full_name,omitempty"` + Description *string `json:"description,omitempty"` + Homepage *string `json:"homepage,omitempty"` + CodeOfConduct *CodeOfConduct `json:"code_of_conduct,omitempty"` + DefaultBranch *string `json:"default_branch,omitempty"` + MasterBranch *string `json:"master_branch,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + PushedAt *Timestamp `json:"pushed_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + CloneURL *string `json:"clone_url,omitempty"` + GitURL *string `json:"git_url,omitempty"` + MirrorURL *string `json:"mirror_url,omitempty"` + SSHURL *string `json:"ssh_url,omitempty"` + SVNURL *string `json:"svn_url,omitempty"` + Language *string `json:"language,omitempty"` + Fork *bool `json:"fork,omitempty"` + ForksCount *int `json:"forks_count,omitempty"` + NetworkCount *int `json:"network_count,omitempty"` + OpenIssuesCount *int `json:"open_issues_count,omitempty"` + OpenIssues *int `json:"open_issues,omitempty"` // Deprecated: Replaced by OpenIssuesCount. For backward compatibility OpenIssues is still populated. + StargazersCount *int `json:"stargazers_count,omitempty"` + SubscribersCount *int `json:"subscribers_count,omitempty"` + WatchersCount *int `json:"watchers_count,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility WatchersCount is still populated. + Watchers *int `json:"watchers,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility Watchers is still populated. + Size *int `json:"size,omitempty"` + AutoInit *bool `json:"auto_init,omitempty"` + Parent *Repository `json:"parent,omitempty"` + Source *Repository `json:"source,omitempty"` + TemplateRepository *Repository `json:"template_repository,omitempty"` + Organization *Organization `json:"organization,omitempty"` + Permissions *RepositoryPermissions `json:"permissions,omitempty"` + AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` + AllowUpdateBranch *bool `json:"allow_update_branch,omitempty"` + AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` + AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` + AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` + AllowForking *bool `json:"allow_forking,omitempty"` + WebCommitSignoffRequired *bool `json:"web_commit_signoff_required,omitempty"` + DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` + UseSquashPRTitleAsDefault *bool `json:"use_squash_pr_title_as_default,omitempty"` + SquashMergeCommitTitle *string `json:"squash_merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "COMMIT_OR_PR_TITLE" + SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "COMMIT_MESSAGES", "BLANK" + MergeCommitTitle *string `json:"merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "MERGE_MESSAGE" + MergeCommitMessage *string `json:"merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "PR_TITLE", "BLANK" + Topics []string `json:"topics,omitempty"` + CustomProperties map[string]any `json:"custom_properties,omitempty"` + Archived *bool `json:"archived,omitempty"` + Disabled *bool `json:"disabled,omitempty"` // Only provided when using RepositoriesService.Get while in preview License *License `json:"license,omitempty"` @@ -202,6 +202,15 @@ type SecurityAndAnalysis struct { SecretScanningValidityChecks *SecretScanningValidityChecks `json:"secret_scanning_validity_checks,omitempty"` } +// RepositoryPermissions represents the permissions a user has for a repository. +type RepositoryPermissions struct { + Admin *bool `json:"admin,omitempty"` + Maintain *bool `json:"maintain,omitempty"` + Push *bool `json:"push,omitempty"` + Triage *bool `json:"triage,omitempty"` + Pull *bool `json:"pull,omitempty"` +} + func (s SecurityAndAnalysis) String() string { return Stringify(s) } @@ -263,6 +272,7 @@ type SecretScanningValidityChecks struct { // Deprecated: Use RepositoriesService.ListByUser or RepositoriesService.ListByAuthenticatedUser instead. // // GitHub API docs: https://docs.github.com/rest/repos/repos#list-repositories-for-a-user +// // GitHub API docs: https://docs.github.com/rest/repos/repos#list-repositories-for-the-authenticated-user // //meta:operation GET /user/repos @@ -303,7 +313,7 @@ type RepositoryListByUserOptions struct { Sort string `url:"sort,omitempty"` // The order to sort by. - // Default: asc when using full_name, otherwise desc. + // Default: asc when using full_name; otherwise, desc. // Can be one of: asc, desc Direction string `url:"direction,omitempty"` @@ -434,7 +444,6 @@ func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opts *R return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) @@ -501,21 +510,22 @@ type createRepoRequest struct { // Creating an organization repository. Required for non-owners. TeamID *int64 `json:"team_id,omitempty"` - AutoInit *bool `json:"auto_init,omitempty"` - GitignoreTemplate *string `json:"gitignore_template,omitempty"` - LicenseTemplate *string `json:"license_template,omitempty"` - AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` - AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` - AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` - AllowUpdateBranch *bool `json:"allow_update_branch,omitempty"` - AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` - AllowForking *bool `json:"allow_forking,omitempty"` - DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` - UseSquashPRTitleAsDefault *bool `json:"use_squash_pr_title_as_default,omitempty"` - SquashMergeCommitTitle *string `json:"squash_merge_commit_title,omitempty"` - SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"` - MergeCommitTitle *string `json:"merge_commit_title,omitempty"` - MergeCommitMessage *string `json:"merge_commit_message,omitempty"` + AutoInit *bool `json:"auto_init,omitempty"` + GitignoreTemplate *string `json:"gitignore_template,omitempty"` + LicenseTemplate *string `json:"license_template,omitempty"` + AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` + AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` + AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` + AllowUpdateBranch *bool `json:"allow_update_branch,omitempty"` + AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` + AllowForking *bool `json:"allow_forking,omitempty"` + DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` + UseSquashPRTitleAsDefault *bool `json:"use_squash_pr_title_as_default,omitempty"` + SquashMergeCommitTitle *string `json:"squash_merge_commit_title,omitempty"` + SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"` + MergeCommitTitle *string `json:"merge_commit_title,omitempty"` + MergeCommitMessage *string `json:"merge_commit_message,omitempty"` + CustomProperties map[string]any `json:"custom_properties,omitempty"` } // Create a new repository. If an organization is specified, the new @@ -531,6 +541,7 @@ type createRepoRequest struct { // exponential back-off to verify repository's creation. // // GitHub API docs: https://docs.github.com/rest/repos/repos#create-a-repository-for-the-authenticated-user +// // GitHub API docs: https://docs.github.com/rest/repos/repos#create-an-organization-repository // //meta:operation POST /orgs/{org}/repos @@ -574,6 +585,7 @@ func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repo SquashMergeCommitMessage: repo.SquashMergeCommitMessage, MergeCommitTitle: repo.MergeCommitTitle, MergeCommitMessage: repo.MergeCommitMessage, + CustomProperties: repo.CustomProperties, } req, err := s.client.NewRequest("POST", u, repoReq) @@ -638,7 +650,6 @@ func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Rep return nil, nil, err } - // TODO: remove custom Accept header when the license support fully launches // https://docs.github.com/rest/licenses/#get-a-repositorys-license acceptHeaders := []string{ mediaTypeCodesOfConductPreview, @@ -671,7 +682,6 @@ func (s *RepositoriesService) GetCodeOfConduct(ctx context.Context, owner, repo return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeCodesOfConductPreview) r := new(Repository) @@ -689,7 +699,7 @@ func (s *RepositoriesService) GetCodeOfConduct(ctx context.Context, owner, repo // //meta:operation GET /repositories/{repository_id} func (s *RepositoriesService) GetByID(ctx context.Context, id int64) (*Repository, *Response, error) { - u := fmt.Sprintf("repositories/%d", id) + u := fmt.Sprintf("repositories/%v", id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -789,7 +799,6 @@ func (s *RepositoriesService) GetVulnerabilityAlerts(ctx context.Context, owner, return false, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredVulnerabilityAlertsPreview) resp, err := s.client.Do(ctx, req, nil) @@ -810,7 +819,6 @@ func (s *RepositoriesService) EnableVulnerabilityAlerts(ctx context.Context, own return nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredVulnerabilityAlertsPreview) return s.client.Do(ctx, req, nil) @@ -829,7 +837,6 @@ func (s *RepositoriesService) DisableVulnerabilityAlerts(ctx context.Context, ow return nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredVulnerabilityAlertsPreview) return s.client.Do(ctx, req, nil) @@ -1206,7 +1213,7 @@ type ProtectionRequest struct { AllowForkSyncing *bool `json:"allow_fork_syncing,omitempty"` } -// RequiredStatusChecks represents the protection status of a individual branch. +// RequiredStatusChecks represents the protection status of an individual branch. type RequiredStatusChecks struct { // Require branches to be up to date before merging. (Required.) Strict bool `json:"strict"` @@ -1453,7 +1460,7 @@ func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch defer resp.Body.Close() if resp.StatusCode != http.StatusOK { - return nil, newResponse(resp), fmt.Errorf("unexpected status code: %s", resp.Status) + return nil, newResponse(resp), fmt.Errorf("unexpected status code: %v", resp.Status) } b := new(Branch) @@ -1507,7 +1514,6 @@ func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, re return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) p := new(Protection) @@ -1587,7 +1593,6 @@ func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) p := new(Protection) @@ -1630,12 +1635,14 @@ func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context, return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeSignaturePreview) p := new(SignaturesProtectedBranch) resp, err := s.client.Do(ctx, req, p) if err != nil { + if isBranchNotProtected(err) { + err = ErrBranchNotProtected + } return nil, resp, err } @@ -1657,7 +1664,6 @@ func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Con return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeSignaturePreview) r := new(SignaturesProtectedBranch) @@ -1683,7 +1689,6 @@ func (s *RepositoriesService) OptionalSignaturesOnProtectedBranch(ctx context.Co return nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeSignaturePreview) return s.client.Do(ctx, req, nil) @@ -1764,7 +1769,6 @@ func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Contex return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) r := new(PullRequestReviewsEnforcement) @@ -1791,7 +1795,6 @@ func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Con return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) r := new(PullRequestReviewsEnforcement) @@ -1823,7 +1826,6 @@ func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) r := new(PullRequestReviewsEnforcement) @@ -1926,14 +1928,18 @@ type repositoryTopics struct { // GitHub API docs: https://docs.github.com/rest/repos/repos#get-all-repository-topics // //meta:operation GET /repos/{owner}/{repo}/topics -func (s *RepositoriesService) ListAllTopics(ctx context.Context, owner, repo string) ([]string, *Response, error) { +func (s *RepositoriesService) ListAllTopics(ctx context.Context, owner, repo string, opts *ListOptions) ([]string, *Response, error) { u := fmt.Sprintf("repos/%v/%v/topics", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeTopicsPreview) topics := new(repositoryTopics) @@ -1963,7 +1969,6 @@ func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeTopicsPreview) t = new(repositoryTopics) @@ -2367,8 +2372,8 @@ func (s *RepositoriesService) Dispatch(ctx context.Context, owner, repo string, // isBranchNotProtected determines whether a branch is not protected // based on the error message returned by GitHub API. func isBranchNotProtected(err error) bool { - errorResponse, ok := err.(*ErrorResponse) - return ok && errorResponse.Message == githubBranchNotProtected + var errorResponse *ErrorResponse + return errors.As(err, &errorResponse) && errorResponse.Message == githubBranchNotProtected } // EnablePrivateReporting enables private reporting of vulnerabilities for a diff --git a/vendor/github.com/google/go-github/v75/github/repos_actions_access.go b/vendor/github.com/google/go-github/v84/github/repos_actions_access.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/repos_actions_access.go rename to vendor/github.com/google/go-github/v84/github/repos_actions_access.go diff --git a/vendor/github.com/google/go-github/v75/github/repos_actions_allowed.go b/vendor/github.com/google/go-github/v84/github/repos_actions_allowed.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/repos_actions_allowed.go rename to vendor/github.com/google/go-github/v84/github/repos_actions_allowed.go diff --git a/vendor/github.com/google/go-github/v75/github/repos_actions_permissions.go b/vendor/github.com/google/go-github/v84/github/repos_actions_permissions.go similarity index 72% rename from vendor/github.com/google/go-github/v75/github/repos_actions_permissions.go rename to vendor/github.com/google/go-github/v84/github/repos_actions_permissions.go index 902c818a4..7e56c3f39 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_actions_permissions.go +++ b/vendor/github.com/google/go-github/v84/github/repos_actions_permissions.go @@ -17,6 +17,7 @@ type ActionsPermissionsRepository struct { Enabled *bool `json:"enabled,omitempty"` AllowedActions *string `json:"allowed_actions,omitempty"` SelectedActionsURL *string `json:"selected_actions_url,omitempty"` + SHAPinningRequired *bool `json:"sha_pinning_required,omitempty"` } func (a ActionsPermissionsRepository) String() string { @@ -53,12 +54,12 @@ func (s *RepositoriesService) GetActionsPermissions(ctx context.Context, owner, return permissions, resp, nil } -// EditActionsPermissions sets the permissions policy for repositories and allowed actions in a repository. +// UpdateActionsPermissions sets the permissions policy for repositories and allowed actions in a repository. // // GitHub API docs: https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/actions/permissions -func (s *RepositoriesService) EditActionsPermissions(ctx context.Context, owner, repo string, actionsPermissionsRepository ActionsPermissionsRepository) (*ActionsPermissionsRepository, *Response, error) { +func (s *RepositoriesService) UpdateActionsPermissions(ctx context.Context, owner, repo string, actionsPermissionsRepository ActionsPermissionsRepository) (*ActionsPermissionsRepository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions", owner, repo) req, err := s.client.NewRequest("PUT", u, actionsPermissionsRepository) if err != nil { @@ -96,12 +97,12 @@ func (s *RepositoriesService) GetDefaultWorkflowPermissions(ctx context.Context, return permissions, resp, nil } -// EditDefaultWorkflowPermissions sets the GitHub Actions default workflow permissions in a repository. +// UpdateDefaultWorkflowPermissions sets the GitHub Actions default workflow permissions in a repository. // // GitHub API docs: https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/actions/permissions/workflow -func (s *RepositoriesService) EditDefaultWorkflowPermissions(ctx context.Context, owner, repo string, permissions DefaultWorkflowPermissionRepository) (*DefaultWorkflowPermissionRepository, *Response, error) { +func (s *RepositoriesService) UpdateDefaultWorkflowPermissions(ctx context.Context, owner, repo string, permissions DefaultWorkflowPermissionRepository) (*DefaultWorkflowPermissionRepository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/workflow", owner, repo) req, err := s.client.NewRequest("PUT", u, permissions) if err != nil { @@ -139,12 +140,12 @@ func (s *RepositoriesService) GetArtifactAndLogRetentionPeriod(ctx context.Conte return arp, resp, nil } -// EditArtifactAndLogRetentionPeriod sets the artifact and log retention period for a repository. +// UpdateArtifactAndLogRetentionPeriod sets the artifact and log retention period for a repository. // // GitHub API docs: https://docs.github.com/rest/actions/permissions#set-artifact-and-log-retention-settings-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/actions/permissions/artifact-and-log-retention -func (s *RepositoriesService) EditArtifactAndLogRetentionPeriod(ctx context.Context, owner, repo string, period ArtifactPeriodOpt) (*Response, error) { +func (s *RepositoriesService) UpdateArtifactAndLogRetentionPeriod(ctx context.Context, owner, repo string, period ArtifactPeriodOpt) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/artifact-and-log-retention", owner, repo) req, err := s.client.NewRequest("PUT", u, period) if err != nil { @@ -190,3 +191,40 @@ func (s *RepositoriesService) UpdatePrivateRepoForkPRWorkflowSettings(ctx contex return s.client.Do(ctx, req, nil) } + +// GetForkPRContributorApprovalPermissions gets the fork PR contributor approval policy for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-fork-pr-contributor-approval-permissions-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/permissions/fork-pr-contributor-approval +func (s *ActionsService) GetForkPRContributorApprovalPermissions(ctx context.Context, owner, repo string) (*ContributorApprovalPermissions, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/fork-pr-contributor-approval", owner, repo) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + policy := new(ContributorApprovalPermissions) + resp, err := s.client.Do(ctx, req, policy) + if err != nil { + return nil, resp, err + } + + return policy, resp, nil +} + +// UpdateForkPRContributorApprovalPermissions sets the fork PR contributor approval policy for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#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) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/fork-pr-contributor-approval", owner, repo) + req, err := s.client.NewRequest("PUT", u, policy) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} diff --git a/vendor/github.com/google/go-github/v75/github/repos_attestations.go b/vendor/github.com/google/go-github/v84/github/repos_attestations.go similarity index 92% rename from vendor/github.com/google/go-github/v75/github/repos_attestations.go rename to vendor/github.com/google/go-github/v84/github/repos_attestations.go index c5f34cd4d..31690a2d8 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_attestations.go +++ b/vendor/github.com/google/go-github/v84/github/repos_attestations.go @@ -13,7 +13,7 @@ import ( // ListAttestations returns a collection of artifact attestations // with a given subject digest that are associated with a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-attestations +// GitHub API docs: https://docs.github.com/rest/repos/attestations#list-attestations // //meta:operation GET /repos/{owner}/{repo}/attestations/{subject_digest} func (s *RepositoriesService) ListAttestations(ctx context.Context, owner, repo, subjectDigest string, opts *ListOptions) (*AttestationsResponse, *Response, error) { diff --git a/vendor/github.com/google/go-github/v75/github/repos_autolinks.go b/vendor/github.com/google/go-github/v84/github/repos_autolinks.go similarity index 94% rename from vendor/github.com/google/go-github/v75/github/repos_autolinks.go rename to vendor/github.com/google/go-github/v84/github/repos_autolinks.go index 6c209b2d5..2deb9f5a6 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_autolinks.go +++ b/vendor/github.com/google/go-github/v84/github/repos_autolinks.go @@ -17,7 +17,7 @@ type AutolinkOptions struct { IsAlphanumeric *bool `json:"is_alphanumeric,omitempty"` } -// Autolink represents autolinks to external resources like JIRA issues and Zendesk tickets. +// Autolink represents autolinks to external resources like Jira issues and Zendesk tickets. type Autolink struct { ID *int64 `json:"id,omitempty"` KeyPrefix *string `json:"key_prefix,omitempty"` @@ -31,12 +31,8 @@ type Autolink struct { // GitHub API docs: https://docs.github.com/rest/repos/autolinks#get-all-autolinks-of-a-repository // //meta:operation GET /repos/{owner}/{repo}/autolinks -func (s *RepositoriesService) ListAutolinks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Autolink, *Response, error) { +func (s *RepositoriesService) ListAutolinks(ctx context.Context, owner, repo string) ([]*Autolink, *Response, error) { u := fmt.Sprintf("repos/%v/%v/autolinks", owner, repo) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } req, err := s.client.NewRequest("GET", u, nil) if err != nil { diff --git a/vendor/github.com/google/go-github/v75/github/repos_codeowners.go b/vendor/github.com/google/go-github/v84/github/repos_codeowners.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/repos_codeowners.go rename to vendor/github.com/google/go-github/v84/github/repos_codeowners.go diff --git a/vendor/github.com/google/go-github/v75/github/repos_collaborators.go b/vendor/github.com/google/go-github/v84/github/repos_collaborators.go similarity index 99% rename from vendor/github.com/google/go-github/v75/github/repos_collaborators.go rename to vendor/github.com/google/go-github/v84/github/repos_collaborators.go index d6c985359..a46f45294 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_collaborators.go +++ b/vendor/github.com/google/go-github/v84/github/repos_collaborators.go @@ -130,7 +130,7 @@ type RepositoryAddCollaboratorOptions struct { // Permission specifies the permission to grant the user on this repository. // Possible values are: // pull - team members can pull, but not push to or administer this repository - // push - team members can pull and push, but not administer this repository + // push - team members can push and pull, but not administer this repository // admin - team members can pull, push and administer this repository // maintain - team members can manage the repository without access to sensitive or destructive actions. // triage - team members can proactively manage issues and pull requests without write access. diff --git a/vendor/github.com/google/go-github/v75/github/repos_comments.go b/vendor/github.com/google/go-github/v84/github/repos_comments.go similarity index 96% rename from vendor/github.com/google/go-github/v75/github/repos_comments.go rename to vendor/github.com/google/go-github/v84/github/repos_comments.go index 766a614cc..3d02a1999 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_comments.go +++ b/vendor/github.com/google/go-github/v84/github/repos_comments.go @@ -50,7 +50,6 @@ func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo stri return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeReactionsPreview) var comments []*RepositoryComment @@ -79,7 +78,6 @@ func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, rep return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeReactionsPreview) var comments []*RepositoryComment @@ -125,7 +123,6 @@ func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeReactionsPreview) c := new(RepositoryComment) diff --git a/vendor/github.com/google/go-github/v75/github/repos_commits.go b/vendor/github.com/google/go-github/v84/github/repos_commits.go similarity index 98% rename from vendor/github.com/google/go-github/v75/github/repos_commits.go rename to vendor/github.com/google/go-github/v84/github/repos_commits.go index 48c87007e..36192cd3e 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_commits.go +++ b/vendor/github.com/google/go-github/v84/github/repos_commits.go @@ -192,7 +192,7 @@ func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner, repo, sha case Patch: req.Header.Set("Accept", mediaTypeV3Patch) default: - return "", nil, fmt.Errorf("unsupported raw type %d", opts.Type) + return "", nil, fmt.Errorf("unsupported raw type %v", opts.Type) } var buf bytes.Buffer @@ -287,7 +287,7 @@ func (s *RepositoriesService) CompareCommitsRaw(ctx context.Context, owner, repo case Patch: req.Header.Set("Accept", mediaTypeV3Patch) default: - return "", nil, fmt.Errorf("unsupported raw type %d", opts.Type) + return "", nil, fmt.Errorf("unsupported raw type %v", opts.Type) } var buf bytes.Buffer @@ -313,7 +313,6 @@ func (s *RepositoriesService) ListBranchesHeadCommit(ctx context.Context, owner, return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeListPullsOrBranchesForCommitPreview) var branchCommits []*BranchCommit resp, err := s.client.Do(ctx, req, &branchCommits) diff --git a/vendor/github.com/google/go-github/v75/github/repos_community_health.go b/vendor/github.com/google/go-github/v84/github/repos_community_health.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/repos_community_health.go rename to vendor/github.com/google/go-github/v84/github/repos_community_health.go diff --git a/vendor/github.com/google/go-github/v75/github/repos_contents.go b/vendor/github.com/google/go-github/v84/github/repos_contents.go similarity index 94% rename from vendor/github.com/google/go-github/v75/github/repos_contents.go rename to vendor/github.com/google/go-github/v84/github/repos_contents.go index 3b24b6d4e..73321e260 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_contents.go +++ b/vendor/github.com/google/go-github/v84/github/repos_contents.go @@ -48,7 +48,7 @@ type RepositoryContent struct { // RepositoryContentResponse holds the parsed response from CreateFile, UpdateFile, and DeleteFile. type RepositoryContentResponse struct { Content *RepositoryContent `json:"content,omitempty"` - Commit `json:"commit,omitempty"` + Commit `json:"commit"` } // RepositoryContentFileOptions specifies optional parameters for CreateFile, UpdateFile, and DeleteFile. @@ -155,9 +155,9 @@ func (s *RepositoriesService) DownloadContents(ctx context.Context, owner, repo, for _, contents := range dirContents { if contents.GetName() == filename { if contents.GetDownloadURL() == "" { - return nil, resp, fmt.Errorf("no download link found for %s", filepath) + return nil, resp, fmt.Errorf("no download link found for %v", filepath) } - dlReq, err := http.NewRequestWithContext(ctx, http.MethodGet, *contents.DownloadURL, nil) + dlReq, err := http.NewRequestWithContext(ctx, "GET", *contents.DownloadURL, nil) if err != nil { return nil, resp, err } @@ -170,7 +170,7 @@ func (s *RepositoriesService) DownloadContents(ctx context.Context, owner, repo, } } - return nil, resp, fmt.Errorf("no file named %s found in %s", filename, dir) + return nil, resp, fmt.Errorf("no file named %v found in %v", filename, dir) } // DownloadContentsWithMeta is identical to DownloadContents but additionally @@ -204,9 +204,9 @@ func (s *RepositoriesService) DownloadContentsWithMeta(ctx context.Context, owne for _, contents := range dirContents { if contents.GetName() == filename { if contents.GetDownloadURL() == "" { - return nil, contents, resp, fmt.Errorf("no download link found for %s", filepath) + return nil, contents, resp, fmt.Errorf("no download link found for %v", filepath) } - dlReq, err := http.NewRequestWithContext(ctx, http.MethodGet, *contents.DownloadURL, nil) + dlReq, err := http.NewRequestWithContext(ctx, "GET", *contents.DownloadURL, nil) if err != nil { return nil, contents, resp, err } @@ -219,7 +219,7 @@ func (s *RepositoriesService) DownloadContentsWithMeta(ctx context.Context, owne } } - return nil, nil, resp, fmt.Errorf("no file named %s found in %s", filename, dir) + return nil, nil, resp, fmt.Errorf("no file named %v found in %v", filename, dir) } // GetContents can return either the metadata and content of a single file @@ -241,7 +241,7 @@ func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path } escapedPath := (&url.URL{Path: strings.TrimSuffix(path, "/")}).String() - u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, escapedPath) + u := fmt.Sprintf("repos/%v/%v/contents/%v", owner, repo, escapedPath) u, err = addOptions(u, opts) if err != nil { return nil, nil, nil, err @@ -268,7 +268,7 @@ func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path return nil, directoryContent, resp, nil } - return nil, nil, resp, fmt.Errorf("unmarshaling failed for both file and directory content: %s and %s", fileUnmarshalError, directoryUnmarshalError) + return nil, nil, resp, fmt.Errorf("unmarshaling failed for both file and directory content: %v and %v", fileUnmarshalError, directoryUnmarshalError) } // CreateFile creates a new file in a repository at the given path and returns @@ -278,7 +278,7 @@ func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path // //meta:operation PUT /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) + u := fmt.Sprintf("repos/%v/%v/contents/%v", owner, repo, path) req, err := s.client.NewRequest("PUT", u, opts) if err != nil { return nil, nil, err @@ -300,7 +300,7 @@ func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path // //meta:operation PUT /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) + u := fmt.Sprintf("repos/%v/%v/contents/%v", owner, repo, path) req, err := s.client.NewRequest("PUT", u, opts) if err != nil { return nil, nil, err @@ -322,7 +322,7 @@ func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path // //meta:operation DELETE /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) DeleteFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) + u := fmt.Sprintf("repos/%v/%v/contents/%v", owner, repo, path) req, err := s.client.NewRequest("DELETE", u, opts) if err != nil { return nil, nil, err @@ -353,14 +353,15 @@ const ( // or github.Zipball constant. // // GitHub API docs: https://docs.github.com/rest/repos/contents#download-a-repository-archive-tar +// // GitHub API docs: https://docs.github.com/rest/repos/contents#download-a-repository-archive-zip // //meta:operation GET /repos/{owner}/{repo}/tarball/{ref} //meta:operation GET /repos/{owner}/{repo}/zipball/{ref} func (s *RepositoriesService) GetArchiveLink(ctx context.Context, owner, repo string, archiveformat ArchiveFormat, opts *RepositoryContentGetOptions, maxRedirects int) (*url.URL, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/%s", owner, repo, archiveformat) + u := fmt.Sprintf("repos/%v/%v/%v", owner, repo, archiveformat) if opts != nil && opts.Ref != "" { - u += fmt.Sprintf("/%s", opts.Ref) + u += fmt.Sprintf("/%v", opts.Ref) } if s.client.RateLimitRedirectionalEndpoints { diff --git a/vendor/github.com/google/go-github/v75/github/repos_deployment_branch_policies.go b/vendor/github.com/google/go-github/v84/github/repos_deployment_branch_policies.go similarity index 96% rename from vendor/github.com/google/go-github/v75/github/repos_deployment_branch_policies.go rename to vendor/github.com/google/go-github/v84/github/repos_deployment_branch_policies.go index 77ac73e44..41088f117 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_deployment_branch_policies.go +++ b/vendor/github.com/google/go-github/v84/github/repos_deployment_branch_policies.go @@ -35,8 +35,12 @@ type DeploymentBranchPolicyRequest struct { // GitHub API docs: https://docs.github.com/rest/deployments/branch-policies#list-deployment-branch-policies // //meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies -func (s *RepositoriesService) ListDeploymentBranchPolicies(ctx context.Context, owner, repo, environment string) (*DeploymentBranchPolicyResponse, *Response, error) { +func (s *RepositoriesService) ListDeploymentBranchPolicies(ctx context.Context, owner, repo, environment string, opts *ListOptions) (*DeploymentBranchPolicyResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies", owner, repo, environment) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } req, err := s.client.NewRequest("GET", u, nil) if err != nil { diff --git a/vendor/github.com/google/go-github/v75/github/repos_deployment_protection_rules.go b/vendor/github.com/google/go-github/v84/github/repos_deployment_protection_rules.go similarity index 96% rename from vendor/github.com/google/go-github/v75/github/repos_deployment_protection_rules.go rename to vendor/github.com/google/go-github/v84/github/repos_deployment_protection_rules.go index 29d490328..3454f1f28 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_deployment_protection_rules.go +++ b/vendor/github.com/google/go-github/v84/github/repos_deployment_protection_rules.go @@ -92,8 +92,12 @@ func (s *RepositoriesService) CreateCustomDeploymentProtectionRule(ctx context.C // GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#list-custom-deployment-rule-integrations-available-for-an-environment // //meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/apps -func (s *RepositoriesService) ListCustomDeploymentRuleIntegrations(ctx context.Context, owner, repo, environment string) (*ListCustomDeploymentRuleIntegrationsResponse, *Response, error) { +func (s *RepositoriesService) ListCustomDeploymentRuleIntegrations(ctx context.Context, owner, repo, environment string, opts *ListOptions) (*ListCustomDeploymentRuleIntegrationsResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules/apps", owner, repo, environment) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } req, err := s.client.NewRequest("GET", u, nil) if err != nil { diff --git a/vendor/github.com/google/go-github/v75/github/repos_deployments.go b/vendor/github.com/google/go-github/v84/github/repos_deployments.go similarity index 97% rename from vendor/github.com/google/go-github/v75/github/repos_deployments.go rename to vendor/github.com/google/go-github/v84/github/repos_deployments.go index ae9978307..637067491 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_deployments.go +++ b/vendor/github.com/google/go-github/v84/github/repos_deployments.go @@ -122,7 +122,6 @@ func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) @@ -198,7 +197,6 @@ func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) @@ -224,7 +222,6 @@ func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, re return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) @@ -250,7 +247,6 @@ func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) diff --git a/vendor/github.com/google/go-github/v75/github/repos_environments.go b/vendor/github.com/google/go-github/v84/github/repos_environments.go similarity index 97% rename from vendor/github.com/google/go-github/v75/github/repos_environments.go rename to vendor/github.com/google/go-github/v84/github/repos_environments.go index eab51a11b..7bc8394ac 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_environments.go +++ b/vendor/github.com/google/go-github/v84/github/repos_environments.go @@ -111,7 +111,7 @@ func (r *RequiredReviewer) UnmarshalJSON(data []byte) error { // //meta:operation GET /repos/{owner}/{repo}/environments func (s *RepositoriesService) ListEnvironments(ctx context.Context, owner, repo string, opts *EnvironmentListOptions) (*EnvResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/environments", owner, repo) + u := fmt.Sprintf("repos/%v/%v/environments", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -136,7 +136,7 @@ func (s *RepositoriesService) ListEnvironments(ctx context.Context, owner, repo // //meta:operation GET /repos/{owner}/{repo}/environments/{environment_name} func (s *RepositoriesService) GetEnvironment(ctx context.Context, owner, repo, name string) (*Environment, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/environments/%s", owner, repo, name) + u := fmt.Sprintf("repos/%v/%v/environments/%v", owner, repo, name) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -194,7 +194,7 @@ type createUpdateEnvironmentNoEnterprise struct { // //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) { - u := fmt.Sprintf("repos/%s/%s/environments/%s", owner, repo, name) + u := fmt.Sprintf("repos/%v/%v/environments/%v", owner, repo, name) req, err := s.client.NewRequest("PUT", u, environment) if err != nil { @@ -242,7 +242,7 @@ func (s *RepositoriesService) createNewEnvNoEnterprise(ctx context.Context, u st // //meta:operation DELETE /repos/{owner}/{repo}/environments/{environment_name} func (s *RepositoriesService) DeleteEnvironment(ctx context.Context, owner, repo, name string) (*Response, error) { - u := fmt.Sprintf("repos/%s/%s/environments/%s", owner, repo, name) + u := fmt.Sprintf("repos/%v/%v/environments/%v", owner, repo, name) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { diff --git a/vendor/github.com/google/go-github/v75/github/repos_forks.go b/vendor/github.com/google/go-github/v84/github/repos_forks.go similarity index 96% rename from vendor/github.com/google/go-github/v75/github/repos_forks.go rename to vendor/github.com/google/go-github/v84/github/repos_forks.go index 60fb49da5..cffc87e9b 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_forks.go +++ b/vendor/github.com/google/go-github/v84/github/repos_forks.go @@ -8,6 +8,7 @@ package github import ( "context" "encoding/json" + "errors" "fmt" ) @@ -38,7 +39,6 @@ func (s *RepositoriesService) ListForks(ctx context.Context, owner, repo string, return nil, nil, err } - // TODO: remove custom Accept header when topics API fully launches. req.Header.Set("Accept", mediaTypeTopicsPreview) var repos []*Repository @@ -83,7 +83,8 @@ func (s *RepositoriesService) CreateFork(ctx context.Context, owner, repo string resp, err := s.client.Do(ctx, req, fork) if err != nil { // Persist AcceptedError's metadata to the Repository object. - if aerr, ok := err.(*AcceptedError); ok { + var aerr *AcceptedError + if errors.As(err, &aerr) { if err := json.Unmarshal(aerr.Raw, fork); err != nil { return fork, resp, err } diff --git a/vendor/github.com/google/go-github/v75/github/repos_hooks.go b/vendor/github.com/google/go-github/v84/github/repos_hooks.go similarity index 96% rename from vendor/github.com/google/go-github/v75/github/repos_hooks.go rename to vendor/github.com/google/go-github/v84/github/repos_hooks.go index 862dd8b0e..bbadab800 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_hooks.go +++ b/vendor/github.com/google/go-github/v84/github/repos_hooks.go @@ -143,7 +143,7 @@ func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, // //meta:operation GET /repos/{owner}/{repo}/hooks/{hook_id} func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, id int64) (*Hook, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/hooks/%v", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -163,7 +163,7 @@ func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, i // //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) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/hooks/%v", owner, repo, id) req, err := s.client.NewRequest("PATCH", u, hook) if err != nil { return nil, nil, err @@ -183,7 +183,7 @@ func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, // //meta:operation DELETE /repos/{owner}/{repo}/hooks/{hook_id} func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/hooks/%v", owner, repo, id) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err @@ -197,7 +197,7 @@ func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string // //meta:operation POST /repos/{owner}/{repo}/hooks/{hook_id}/pings func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d/pings", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/hooks/%v/pings", owner, repo, id) req, err := s.client.NewRequest("POST", u, nil) if err != nil { return nil, err @@ -211,7 +211,7 @@ func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, // //meta:operation POST /repos/{owner}/{repo}/hooks/{hook_id}/tests func (s *RepositoriesService) TestHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d/tests", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/hooks/%v/tests", owner, repo, id) req, err := s.client.NewRequest("POST", u, nil) if err != nil { return nil, err @@ -253,7 +253,7 @@ func (s *RepositoriesService) Unsubscribe(ctx context.Context, owner, repo, even // See: https://www.w3.org/TR/websub/#subscriber-sends-subscription-request func (s *RepositoriesService) createWebSubRequest(hubMode, owner, repo, event, callback string, secret []byte) (*http.Request, error) { topic := fmt.Sprintf( - "https://github.com/%s/%s/events/%s", + "https://github.com/%v/%v/events/%v", owner, repo, event, diff --git a/vendor/github.com/google/go-github/v75/github/repos_hooks_configuration.go b/vendor/github.com/google/go-github/v84/github/repos_hooks_configuration.go similarity index 96% rename from vendor/github.com/google/go-github/v75/github/repos_hooks_configuration.go rename to vendor/github.com/google/go-github/v84/github/repos_hooks_configuration.go index 9560bd7a4..69d1f4060 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_hooks_configuration.go +++ b/vendor/github.com/google/go-github/v84/github/repos_hooks_configuration.go @@ -16,7 +16,7 @@ type HookConfig struct { // Possible values are `json` and `form`, the field is not specified the default is `form` ContentType *string `json:"content_type,omitempty"` // The possible values are 0 and 1. - // Setting it to 1 will allow skip certificate verification for the host, + // Setting it to 1 will allow skipping certificate verification for the host, // potentially exposing to MitM attacks: https://en.wikipedia.org/wiki/Man-in-the-middle_attack InsecureSSL *string `json:"insecure_ssl,omitempty"` URL *string `json:"url,omitempty"` diff --git a/vendor/github.com/google/go-github/v75/github/repos_hooks_deliveries.go b/vendor/github.com/google/go-github/v84/github/repos_hooks_deliveries.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/repos_hooks_deliveries.go rename to vendor/github.com/google/go-github/v84/github/repos_hooks_deliveries.go diff --git a/vendor/github.com/google/go-github/v75/github/repos_invitations.go b/vendor/github.com/google/go-github/v84/github/repos_invitations.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/repos_invitations.go rename to vendor/github.com/google/go-github/v84/github/repos_invitations.go diff --git a/vendor/github.com/google/go-github/v75/github/repos_keys.go b/vendor/github.com/google/go-github/v84/github/repos_keys.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/repos_keys.go rename to vendor/github.com/google/go-github/v84/github/repos_keys.go diff --git a/vendor/github.com/google/go-github/v75/github/repos_lfs.go b/vendor/github.com/google/go-github/v84/github/repos_lfs.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/repos_lfs.go rename to vendor/github.com/google/go-github/v84/github/repos_lfs.go diff --git a/vendor/github.com/google/go-github/v75/github/repos_merging.go b/vendor/github.com/google/go-github/v84/github/repos_merging.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/repos_merging.go rename to vendor/github.com/google/go-github/v84/github/repos_merging.go diff --git a/vendor/github.com/google/go-github/v75/github/repos_pages.go b/vendor/github.com/google/go-github/v84/github/repos_pages.go similarity index 99% rename from vendor/github.com/google/go-github/v75/github/repos_pages.go rename to vendor/github.com/google/go-github/v84/github/repos_pages.go index 5986fc01b..92110f598 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_pages.go +++ b/vendor/github.com/google/go-github/v84/github/repos_pages.go @@ -219,7 +219,6 @@ func (s *RepositoriesService) DisablePages(ctx context.Context, owner, repo stri return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeEnablePagesAPIPreview) return s.client.Do(ctx, req, nil) diff --git a/vendor/github.com/google/go-github/v75/github/repos_prereceive_hooks.go b/vendor/github.com/google/go-github/v84/github/repos_prereceive_hooks.go similarity index 82% rename from vendor/github.com/google/go-github/v75/github/repos_prereceive_hooks.go rename to vendor/github.com/google/go-github/v84/github/repos_prereceive_hooks.go index 144d2ec33..eec1360c8 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_prereceive_hooks.go +++ b/vendor/github.com/google/go-github/v84/github/repos_prereceive_hooks.go @@ -24,7 +24,7 @@ func (p PreReceiveHook) String() string { // ListPreReceiveHooks lists all pre-receive hooks for the specified repository. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/repo-pre-receive-hooks#list-pre-receive-hooks-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/repo-pre-receive-hooks#list-pre-receive-hooks-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/pre-receive-hooks func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*PreReceiveHook, *Response, error) { @@ -39,7 +39,6 @@ func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, re return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) var hooks []*PreReceiveHook @@ -53,17 +52,16 @@ func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, re // GetPreReceiveHook returns a single specified pre-receive hook. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/repo-pre-receive-hooks#get-a-pre-receive-hook-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/repo-pre-receive-hooks#get-a-pre-receive-hook-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} func (s *RepositoriesService) GetPreReceiveHook(ctx context.Context, owner, repo string, id int64) (*PreReceiveHook, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%v", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) h := new(PreReceiveHook) @@ -77,17 +75,16 @@ func (s *RepositoriesService) GetPreReceiveHook(ctx context.Context, owner, repo // UpdatePreReceiveHook updates a specified pre-receive hook. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/repo-pre-receive-hooks#update-pre-receive-hook-enforcement-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/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) { - u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%v", owner, repo, id) req, err := s.client.NewRequest("PATCH", u, hook) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) h := new(PreReceiveHook) @@ -101,17 +98,16 @@ func (s *RepositoriesService) UpdatePreReceiveHook(ctx context.Context, owner, r // DeletePreReceiveHook deletes a specified pre-receive hook. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/repo-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/repo-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-a-repository // //meta:operation DELETE /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} func (s *RepositoriesService) DeletePreReceiveHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%v", owner, repo, id) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) return s.client.Do(ctx, req, nil) diff --git a/vendor/github.com/google/go-github/v75/github/repos_properties.go b/vendor/github.com/google/go-github/v84/github/repos_properties.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/repos_properties.go rename to vendor/github.com/google/go-github/v84/github/repos_properties.go diff --git a/vendor/github.com/google/go-github/v75/github/repos_releases.go b/vendor/github.com/google/go-github/v84/github/repos_releases.go similarity index 82% rename from vendor/github.com/google/go-github/v75/github/repos_releases.go rename to vendor/github.com/google/go-github/v84/github/repos_releases.go index 87056071c..ba35d8041 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_releases.go +++ b/vendor/github.com/google/go-github/v84/github/repos_releases.go @@ -45,6 +45,7 @@ type RepositoryRelease struct { TarballURL *string `json:"tarball_url,omitempty"` Author *User `json:"author,omitempty"` NodeID *string `json:"node_id,omitempty"` + Immutable *bool `json:"immutable,omitempty"` } func (r RepositoryRelease) String() string { @@ -59,9 +60,10 @@ type RepositoryReleaseNotes struct { // GenerateNotesOptions represents the options to generate release notes. type GenerateNotesOptions struct { - TagName string `json:"tag_name"` - PreviousTagName *string `json:"previous_tag_name,omitempty"` - TargetCommitish *string `json:"target_commitish,omitempty"` + TagName string `json:"tag_name"` + PreviousTagName *string `json:"previous_tag_name,omitempty"` + TargetCommitish *string `json:"target_commitish,omitempty"` + ConfigurationFilePath *string `json:"configuration_file_path,omitempty"` } // ReleaseAsset represents a GitHub release asset in a repository. @@ -92,7 +94,7 @@ func (r ReleaseAsset) String() string { // //meta:operation GET /repos/{owner}/{repo}/releases func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases", owner, repo) + u := fmt.Sprintf("repos/%v/%v/releases", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -117,7 +119,7 @@ func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo stri // //meta:operation GET /repos/{owner}/{repo}/releases/{release_id} func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string, id int64) (*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/%v", owner, repo, id) return s.getSingleRelease(ctx, u) } @@ -127,7 +129,7 @@ func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string // //meta:operation GET /repos/{owner}/{repo}/releases/latest func (s *RepositoriesService) GetLatestRelease(ctx context.Context, owner, repo string) (*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/latest", owner, repo) + u := fmt.Sprintf("repos/%v/%v/releases/latest", owner, repo) return s.getSingleRelease(ctx, u) } @@ -137,7 +139,7 @@ func (s *RepositoriesService) GetLatestRelease(ctx context.Context, owner, repo // //meta:operation GET /repos/{owner}/{repo}/releases/tags/{tag} func (s *RepositoriesService) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/tags/%s", owner, repo, tag) + u := fmt.Sprintf("repos/%v/%v/releases/tags/%v", owner, repo, tag) return s.getSingleRelease(ctx, u) } @@ -147,7 +149,7 @@ func (s *RepositoriesService) GetReleaseByTag(ctx context.Context, owner, repo, // //meta:operation POST /repos/{owner}/{repo}/releases/generate-notes func (s *RepositoriesService) GenerateReleaseNotes(ctx context.Context, owner, repo string, opts *GenerateNotesOptions) (*RepositoryReleaseNotes, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/generate-notes", owner, repo) + u := fmt.Sprintf("repos/%v/%v/releases/generate-notes", owner, repo) req, err := s.client.NewRequest("POST", u, opts) if err != nil { return nil, nil, err @@ -207,7 +209,7 @@ func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo str return nil, nil, errors.New("release must be provided") } - u := fmt.Sprintf("repos/%s/%s/releases", owner, repo) + u := fmt.Sprintf("repos/%v/%v/releases", owner, repo) releaseReq := &repositoryReleaseRequest{ TagName: release.TagName, @@ -247,7 +249,7 @@ func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo strin return nil, nil, errors.New("release must be provided") } - u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/%v", owner, repo, id) releaseReq := &repositoryReleaseRequest{ TagName: release.TagName, @@ -279,7 +281,7 @@ func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo strin // //meta:operation DELETE /repos/{owner}/{repo}/releases/{release_id} func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/%v", owner, repo, id) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -294,7 +296,7 @@ func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo str // //meta:operation GET /repos/{owner}/{repo}/releases/{release_id}/assets func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*ReleaseAsset, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/%v/assets", owner, repo, id) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -319,7 +321,7 @@ func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo // //meta:operation GET /repos/{owner}/{repo}/releases/assets/{asset_id} func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo string, id int64) (*ReleaseAsset, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/assets/%v", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -351,7 +353,7 @@ func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo s // //meta:operation GET /repos/{owner}/{repo}/releases/assets/{asset_id} func (s *RepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, repo string, id int64, followRedirectsClient *http.Client) (rc io.ReadCloser, redirectURL string, err error) { - u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/assets/%v", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -415,7 +417,7 @@ func (s *RepositoriesService) downloadReleaseAssetFromURL(ctx context.Context, f // //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) { - u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/assets/%v", owner, repo, id) req, err := s.client.NewRequest("PATCH", u, release) if err != nil { @@ -436,7 +438,7 @@ func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo // //meta:operation DELETE /repos/{owner}/{repo}/releases/assets/{asset_id} func (s *RepositoriesService) DeleteReleaseAsset(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/assets/%v", owner, repo, id) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -456,7 +458,7 @@ func (s *RepositoriesService) UploadReleaseAsset(ctx context.Context, owner, rep return nil, nil, errors.New("file must be provided") } - u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/%v/assets", owner, repo, id) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -487,3 +489,76 @@ func (s *RepositoriesService) UploadReleaseAsset(ctx context.Context, owner, rep } return asset, resp, nil } + +// UploadReleaseAssetFromRelease uploads an asset using the UploadURL that's embedded +// in a RepositoryRelease object. +// +// This is a convenience wrapper that extracts the release.UploadURL (which is usually +// templated like "https://uploads.github.com/.../assets{?name,label}") and uploads +// the provided data (reader + size) using the existing upload helpers. +// +// GitHub API docs: https://docs.github.com/rest/releases/assets#upload-a-release-asset +// +//meta:operation POST /repos/{owner}/{repo}/releases/{release_id}/assets +func (s *RepositoriesService) UploadReleaseAssetFromRelease( + ctx context.Context, + release *RepositoryRelease, + opts *UploadOptions, + reader io.Reader, + size int64, +) (*ReleaseAsset, *Response, error) { + if release == nil || release.UploadURL == nil { + return nil, nil, errors.New("release UploadURL must be provided") + } + if reader == nil { + return nil, nil, errors.New("reader must be provided") + } + if size < 0 { + return nil, nil, errors.New("size must be >= 0") + } + + // Strip URI-template portion (e.g. "{?name,label}") if present. + uploadURL := *release.UploadURL + if idx := strings.Index(uploadURL, "{"); idx != -1 { + uploadURL = uploadURL[:idx] + } + + // If this is a *relative* URL (no scheme), normalize it by trimming a leading "/" + // so it works with Client.BaseURL path prefixes (e.g. "/api-v3/"). + if !strings.HasPrefix(uploadURL, "http://") && !strings.HasPrefix(uploadURL, "https://") { + uploadURL = strings.TrimPrefix(uploadURL, "/") + } + + // addOptions will append name/label query params (same behavior as UploadReleaseAsset). + u, err := addOptions(uploadURL, opts) + if err != nil { + return nil, nil, err + } + + // determine media type + mediaType := defaultMediaType + if opts != nil { + switch { + case opts.MediaType != "": + mediaType = opts.MediaType + case opts.Name != "": + if ext := filepath.Ext(opts.Name); ext != "" { + if mt := mime.TypeByExtension(ext); mt != "" { + mediaType = mt + } + } + } + } + + req, err := s.client.NewUploadRequest(u, reader, size, mediaType) + if err != nil { + return nil, nil, err + } + + asset := new(ReleaseAsset) + resp, err := s.client.Do(ctx, req, asset) + if err != nil { + return nil, resp, err + } + return asset, resp, nil +} diff --git a/vendor/github.com/google/go-github/v75/github/repos_rules.go b/vendor/github.com/google/go-github/v84/github/repos_rules.go similarity index 58% rename from vendor/github.com/google/go-github/v75/github/repos_rules.go rename to vendor/github.com/google/go-github/v84/github/repos_rules.go index 038cefd71..b02df3131 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_rules.go +++ b/vendor/github.com/google/go-github/v84/github/repos_rules.go @@ -10,29 +10,6 @@ import ( "fmt" ) -// rulesetNoOmitBypassActors represents a GitHub ruleset object. The struct does not omit bypassActors if the field is nil or an empty array is passed. -type rulesetNoOmitBypassActors struct { - ID *int64 `json:"id,omitempty"` - Name string `json:"name"` - Target *RulesetTarget `json:"target,omitempty"` - SourceType *RulesetSourceType `json:"source_type,omitempty"` - Source string `json:"source"` - Enforcement RulesetEnforcement `json:"enforcement"` - BypassActors []*BypassActor `json:"bypass_actors"` - CurrentUserCanBypass *BypassMode `json:"current_user_can_bypass,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Links *RepositoryRulesetLinks `json:"_links,omitempty"` - Conditions *RepositoryRulesetConditions `json:"conditions,omitempty"` - Rules *RepositoryRulesetRules `json:"rules,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` -} - -// rulesetClearBypassActors is used to clear the bypass actors when modifying a GitHub ruleset object. -type rulesetClearBypassActors struct { - BypassActors []*BypassActor `json:"bypass_actors"` -} - // GetRulesForBranch gets all the repository rules that apply to the specified branch. // // GitHub API docs: https://docs.github.com/rest/repos/rules#get-rules-for-a-branch @@ -164,71 +141,6 @@ func (s *RepositoriesService) UpdateRuleset(ctx context.Context, owner, repo str return rs, resp, nil } -// UpdateRulesetClearBypassActor clears the bypass actors for a repository ruleset for the specified repository. -// -// This function is necessary as the UpdateRuleset function does not marshal ByPassActor if passed as an empty array. -// -// GitHub API docs: https://docs.github.com/rest/repos/rules#update-a-repository-ruleset -// -//meta:operation PUT /repos/{owner}/{repo}/rulesets/{ruleset_id} -func (s *RepositoriesService) UpdateRulesetClearBypassActor(ctx context.Context, owner, repo string, rulesetID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/rulesets/%v", owner, repo, rulesetID) - - rsClearBypassActor := rulesetClearBypassActors{} - - req, err := s.client.NewRequest("PUT", u, rsClearBypassActor) - if err != nil { - return nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - - return resp, nil -} - -// UpdateRulesetNoBypassActor updates a repository ruleset for the specified repository. -// -// This function is necessary as the UpdateRuleset function does not marshal ByPassActor if passed as an empty array. -// -// Deprecated: Use UpdateRulesetClearBypassActor instead. -// -// GitHub API docs: https://docs.github.com/rest/repos/rules#update-a-repository-ruleset -// -//meta:operation PUT /repos/{owner}/{repo}/rulesets/{ruleset_id} -func (s *RepositoriesService) UpdateRulesetNoBypassActor(ctx context.Context, owner, repo string, rulesetID int64, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/rulesets/%v", owner, repo, rulesetID) - - rsNoBypassActor := rulesetNoOmitBypassActors{ - ID: ruleset.ID, - Name: ruleset.Name, - Target: ruleset.Target, - SourceType: ruleset.SourceType, - Source: ruleset.Source, - Enforcement: ruleset.Enforcement, - BypassActors: ruleset.BypassActors, - NodeID: ruleset.NodeID, - Links: ruleset.Links, - Conditions: ruleset.Conditions, - Rules: ruleset.Rules, - } - - req, err := s.client.NewRequest("PUT", u, rsNoBypassActor) - if err != nil { - return nil, nil, err - } - - var rs *RepositoryRuleset - resp, err := s.client.Do(ctx, req, &rs) - if err != nil { - return nil, resp, err - } - - return rs, resp, nil -} - // DeleteRuleset deletes a repository ruleset for the specified repository. // // GitHub API docs: https://docs.github.com/rest/repos/rules#delete-a-repository-ruleset diff --git a/vendor/github.com/google/go-github/v75/github/repos_stats.go b/vendor/github.com/google/go-github/v84/github/repos_stats.go similarity index 99% rename from vendor/github.com/google/go-github/v75/github/repos_stats.go rename to vendor/github.com/google/go-github/v84/github/repos_stats.go index a6ef9c0da..b05bae6da 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_stats.go +++ b/vendor/github.com/google/go-github/v84/github/repos_stats.go @@ -150,7 +150,7 @@ func (s *RepositoriesService) ListCodeFrequency(ctx context.Context, owner, repo // RepositoryParticipation is the number of commits by everyone // who has contributed to the repository (including the owner) -// as well as the number of commits by the owner themself. +// as well as the number of commits by the owner themselves. type RepositoryParticipation struct { All []int `json:"all,omitempty"` Owner []int `json:"owner,omitempty"` diff --git a/vendor/github.com/google/go-github/v75/github/repos_statuses.go b/vendor/github.com/google/go-github/v84/github/repos_statuses.go similarity index 97% rename from vendor/github.com/google/go-github/v75/github/repos_statuses.go rename to vendor/github.com/google/go-github/v84/github/repos_statuses.go index 21f2c4c1e..547cc1f12 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_statuses.go +++ b/vendor/github.com/google/go-github/v84/github/repos_statuses.go @@ -75,9 +75,9 @@ func (s *RepositoriesService) ListStatuses(ctx context.Context, owner, repo, ref // GitHub API docs: https://docs.github.com/rest/commits/statuses#create-a-commit-status // //meta:operation POST /repos/{owner}/{repo}/statuses/{sha} -func (s *RepositoriesService) CreateStatus(ctx context.Context, owner, repo, ref string, status *RepoStatus) (*RepoStatus, *Response, error) { +func (s *RepositoriesService) CreateStatus(ctx context.Context, owner, repo, ref string, status RepoStatus) (*RepoStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/statuses/%v", owner, repo, refURLEscape(ref)) - req, err := s.client.NewRequest("POST", u, status) + req, err := s.client.NewRequest("POST", u, &status) if err != nil { return nil, nil, err } diff --git a/vendor/github.com/google/go-github/v75/github/repos_tags.go b/vendor/github.com/google/go-github/v84/github/repos_tags.go similarity index 87% rename from vendor/github.com/google/go-github/v75/github/repos_tags.go rename to vendor/github.com/google/go-github/v84/github/repos_tags.go index 9c789cc82..07f9e3aa9 100644 --- a/vendor/github.com/google/go-github/v75/github/repos_tags.go +++ b/vendor/github.com/google/go-github/v84/github/repos_tags.go @@ -26,7 +26,7 @@ type tagProtectionRequest struct { // // Deprecated: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules#get-all-repository-rulesets // -// GitHub API docs: https://docs.github.com/rest/repos/tags#closing-down---list-tag-protection-states-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/repos/tags#closing-down---list-tag-protection-states-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/tags/protection func (s *RepositoriesService) ListTagProtection(ctx context.Context, owner, repo string) ([]*TagProtection, *Response, error) { @@ -50,7 +50,7 @@ func (s *RepositoriesService) ListTagProtection(ctx context.Context, owner, repo // // Deprecated: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules#create-a-repository-ruleset // -// GitHub API docs: https://docs.github.com/rest/repos/tags#closing-down---create-a-tag-protection-state-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/repos/tags#closing-down---create-a-tag-protection-state-for-a-repository // //meta:operation POST /repos/{owner}/{repo}/tags/protection func (s *RepositoriesService) CreateTagProtection(ctx context.Context, owner, repo, pattern string) (*TagProtection, *Response, error) { @@ -74,7 +74,7 @@ func (s *RepositoriesService) CreateTagProtection(ctx context.Context, owner, re // // Deprecated: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules#delete-a-repository-ruleset // -// GitHub API docs: https://docs.github.com/rest/repos/tags#closing-down---delete-a-tag-protection-state-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/repos/tags#closing-down---delete-a-tag-protection-state-for-a-repository // //meta:operation DELETE /repos/{owner}/{repo}/tags/protection/{tag_protection_id} func (s *RepositoriesService) DeleteTagProtection(ctx context.Context, owner, repo string, tagProtectionID int64) (*Response, error) { diff --git a/vendor/github.com/google/go-github/v75/github/repos_traffic.go b/vendor/github.com/google/go-github/v84/github/repos_traffic.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/repos_traffic.go rename to vendor/github.com/google/go-github/v84/github/repos_traffic.go diff --git a/vendor/github.com/google/go-github/v75/github/rules.go b/vendor/github.com/google/go-github/v84/github/rules.go similarity index 81% rename from vendor/github.com/google/go-github/v75/github/rules.go rename to vendor/github.com/google/go-github/v84/github/rules.go index 7b474f00e..d4e94edc2 100644 --- a/vendor/github.com/google/go-github/v75/github/rules.go +++ b/vendor/github.com/google/go-github/v84/github/rules.go @@ -7,7 +7,7 @@ package github import ( "encoding/json" - "reflect" + "fmt" ) // RulesetTarget represents a GitHub ruleset target. @@ -15,9 +15,10 @@ type RulesetTarget string // This is the set of GitHub ruleset targets. const ( - RulesetTargetBranch RulesetTarget = "branch" - RulesetTargetTag RulesetTarget = "tag" - RulesetTargetPush RulesetTarget = "push" + RulesetTargetBranch RulesetTarget = "branch" + RulesetTargetTag RulesetTarget = "tag" + RulesetTargetPush RulesetTarget = "push" + RulesetTargetRepository RulesetTarget = "repository" ) // RulesetSourceType represents a GitHub ruleset source type. @@ -68,27 +69,38 @@ type RepositoryRuleType string // This is the set of GitHub ruleset rule types. const ( + // Branch or tag target rules. + RulesetRuleTypeBranchNamePattern RepositoryRuleType = "branch_name_pattern" + RulesetRuleTypeCodeScanning RepositoryRuleType = "code_scanning" + RulesetRuleTypeCommitAuthorEmailPattern RepositoryRuleType = "commit_author_email_pattern" + RulesetRuleTypeCommitMessagePattern RepositoryRuleType = "commit_message_pattern" + RulesetRuleTypeCommitterEmailPattern RepositoryRuleType = "committer_email_pattern" + RulesetRuleTypeCopilotCodeReview RepositoryRuleType = "copilot_code_review" RulesetRuleTypeCreation RepositoryRuleType = "creation" - RulesetRuleTypeUpdate RepositoryRuleType = "update" RulesetRuleTypeDeletion RepositoryRuleType = "deletion" - RulesetRuleTypeRequiredLinearHistory RepositoryRuleType = "required_linear_history" RulesetRuleTypeMergeQueue RepositoryRuleType = "merge_queue" + RulesetRuleTypeNonFastForward RepositoryRuleType = "non_fast_forward" + RulesetRuleTypePullRequest RepositoryRuleType = "pull_request" RulesetRuleTypeRequiredDeployments RepositoryRuleType = "required_deployments" + RulesetRuleTypeRequiredLinearHistory RepositoryRuleType = "required_linear_history" RulesetRuleTypeRequiredSignatures RepositoryRuleType = "required_signatures" - RulesetRuleTypePullRequest RepositoryRuleType = "pull_request" RulesetRuleTypeRequiredStatusChecks RepositoryRuleType = "required_status_checks" - RulesetRuleTypeNonFastForward RepositoryRuleType = "non_fast_forward" - RulesetRuleTypeCommitMessagePattern RepositoryRuleType = "commit_message_pattern" - RulesetRuleTypeCommitAuthorEmailPattern RepositoryRuleType = "commit_author_email_pattern" - RulesetRuleTypeCommitterEmailPattern RepositoryRuleType = "committer_email_pattern" - RulesetRuleTypeBranchNamePattern RepositoryRuleType = "branch_name_pattern" RulesetRuleTypeTagNamePattern RepositoryRuleType = "tag_name_pattern" + RulesetRuleTypeUpdate RepositoryRuleType = "update" + RulesetRuleTypeWorkflows RepositoryRuleType = "workflows" + + // Push target rules. + RulesetRuleTypeFileExtensionRestriction RepositoryRuleType = "file_extension_restriction" RulesetRuleTypeFilePathRestriction RepositoryRuleType = "file_path_restriction" RulesetRuleTypeMaxFilePathLength RepositoryRuleType = "max_file_path_length" - RulesetRuleTypeFileExtensionRestriction RepositoryRuleType = "file_extension_restriction" RulesetRuleTypeMaxFileSize RepositoryRuleType = "max_file_size" - RulesetRuleTypeWorkflows RepositoryRuleType = "workflows" - RulesetRuleTypeCodeScanning RepositoryRuleType = "code_scanning" + + // Repository target rules. + RulesetRuleTypeRepositoryCreate RepositoryRuleType = "repository_create" + RulesetRuleTypeRepositoryDelete RepositoryRuleType = "repository_delete" + RulesetRuleTypeRepositoryName RepositoryRuleType = "repository_name" + RulesetRuleTypeRepositoryTransfer RepositoryRuleType = "repository_transfer" + RulesetRuleTypeRepositoryVisibility RepositoryRuleType = "repository_visibility" ) // MergeGroupingStrategy models a GitHub merge grouping strategy. @@ -130,6 +142,14 @@ const ( MergeQueueMergeMethodSquash MergeQueueMergeMethod = "SQUASH" ) +// RulesetReviewerType represents the type of reviewer in a ruleset required reviewer. +type RulesetReviewerType string + +// This is the set of GitHub ruleset reviewer types. +const ( + RulesetReviewerTypeTeam RulesetReviewerType = "Team" +) + // PatternRuleOperator models a GitHub pattern rule operator. type PatternRuleOperator string @@ -172,7 +192,7 @@ type RepositoryRuleset struct { SourceType *RulesetSourceType `json:"source_type,omitempty"` Source string `json:"source"` Enforcement RulesetEnforcement `json:"enforcement"` - BypassActors []*BypassActor `json:"bypass_actors,omitempty"` + BypassActors []*BypassActor `json:"bypass_actors,omitzero"` CurrentUserCanBypass *BypassMode `json:"current_user_can_bypass,omitempty"` NodeID *string `json:"node_id,omitempty"` Links *RepositoryRulesetLinks `json:"_links,omitempty"` @@ -203,12 +223,13 @@ type RepositoryRulesetLink struct { // RepositoryRulesetConditions represents the conditions object in a ruleset. // Set either RepositoryName or RepositoryID or RepositoryProperty, not more than one. type RepositoryRulesetConditions struct { - RefName *RepositoryRulesetRefConditionParameters `json:"ref_name,omitempty"` - RepositoryID *RepositoryRulesetRepositoryIDsConditionParameters `json:"repository_id,omitempty"` - RepositoryName *RepositoryRulesetRepositoryNamesConditionParameters `json:"repository_name,omitempty"` - RepositoryProperty *RepositoryRulesetRepositoryPropertyConditionParameters `json:"repository_property,omitempty"` - OrganizationID *RepositoryRulesetOrganizationIDsConditionParameters `json:"organization_id,omitempty"` - OrganizationName *RepositoryRulesetOrganizationNamesConditionParameters `json:"organization_name,omitempty"` + RefName *RepositoryRulesetRefConditionParameters `json:"ref_name,omitempty"` + RepositoryID *RepositoryRulesetRepositoryIDsConditionParameters `json:"repository_id,omitempty"` + RepositoryName *RepositoryRulesetRepositoryNamesConditionParameters `json:"repository_name,omitempty"` + RepositoryProperty *RepositoryRulesetRepositoryPropertyConditionParameters `json:"repository_property,omitempty"` + OrganizationID *RepositoryRulesetOrganizationIDsConditionParameters `json:"organization_id,omitempty"` + OrganizationName *RepositoryRulesetOrganizationNamesConditionParameters `json:"organization_name,omitempty"` + OrganizationProperty *RepositoryRulesetOrganizationPropertyConditionParameters `json:"organization_property,omitempty"` } // RepositoryRulesetRefConditionParameters represents the conditions object for ref_names. @@ -217,6 +238,12 @@ type RepositoryRulesetRefConditionParameters struct { Exclude []string `json:"exclude"` } +// RepositoryRulesetOrganizationPropertyConditionParameters represents the conditions object for an organization property selector. +type RepositoryRulesetOrganizationPropertyConditionParameters struct { + Include []*RepositoryRulesetRepositoryPropertyTargetParameters `json:"include"` + Exclude []*RepositoryRulesetRepositoryPropertyTargetParameters `json:"exclude"` +} + // RepositoryRulesetRepositoryIDsConditionParameters represents the conditions object for repository_id. type RepositoryRulesetRepositoryIDsConditionParameters struct { RepositoryIDs []int64 `json:"repository_ids,omitempty"` @@ -262,6 +289,7 @@ type RepositoryRule struct { // RepositoryRulesetRules represents a GitHub ruleset rules object. // This type doesn't have JSON annotations as it uses custom marshaling. type RepositoryRulesetRules struct { + // Branch or tag target rules. Creation *EmptyRuleParameters Update *UpdateRuleParameters Deletion *EmptyRuleParameters @@ -277,17 +305,28 @@ type RepositoryRulesetRules struct { CommitterEmailPattern *PatternRuleParameters BranchNamePattern *PatternRuleParameters TagNamePattern *PatternRuleParameters + Workflows *WorkflowsRuleParameters + CodeScanning *CodeScanningRuleParameters + CopilotCodeReview *CopilotCodeReviewRuleParameters + + // Push target rules. + FileExtensionRestriction *FileExtensionRestrictionRuleParameters FilePathRestriction *FilePathRestrictionRuleParameters MaxFilePathLength *MaxFilePathLengthRuleParameters - FileExtensionRestriction *FileExtensionRestrictionRuleParameters MaxFileSize *MaxFileSizeRuleParameters - Workflows *WorkflowsRuleParameters - CodeScanning *CodeScanningRuleParameters + + // Repository target rules. + RepositoryCreate *EmptyRuleParameters + RepositoryDelete *EmptyRuleParameters + RepositoryName *SimplePatternRuleParameters + RepositoryTransfer *EmptyRuleParameters + RepositoryVisibility *RepositoryVisibilityRuleParameters } // BranchRules represents the rules active for a GitHub repository branch. // This type doesn't have JSON annotations as it uses custom marshaling. type BranchRules struct { + // Branch or tag target rules. Creation []*BranchRuleMetadata Update []*UpdateBranchRule Deletion []*BranchRuleMetadata @@ -303,12 +342,15 @@ type BranchRules struct { CommitterEmailPattern []*PatternBranchRule BranchNamePattern []*PatternBranchRule TagNamePattern []*PatternBranchRule + Workflows []*WorkflowsBranchRule + CodeScanning []*CodeScanningBranchRule + CopilotCodeReview []*CopilotCodeReviewBranchRule + + // Push target rules. + FileExtensionRestriction []*FileExtensionRestrictionBranchRule FilePathRestriction []*FilePathRestrictionBranchRule MaxFilePathLength []*MaxFilePathLengthBranchRule - FileExtensionRestriction []*FileExtensionRestrictionBranchRule MaxFileSize []*MaxFileSizeBranchRule - Workflows []*WorkflowsBranchRule - CodeScanning []*CodeScanningBranchRule } // BranchRuleMetadata represents the metadata for a branch rule. @@ -390,6 +432,12 @@ type CodeScanningBranchRule struct { Parameters CodeScanningRuleParameters `json:"parameters"` } +// CopilotCodeReviewBranchRule represents a copilot code review branch rule. +type CopilotCodeReviewBranchRule struct { + BranchRuleMetadata + Parameters CopilotCodeReviewRuleParameters `json:"parameters"` +} + // EmptyRuleParameters represents the parameters for a rule with no options. type EmptyRuleParameters struct{} @@ -416,13 +464,26 @@ type RequiredDeploymentsRuleParameters struct { // PullRequestRuleParameters represents the pull_request rule parameters. type PullRequestRuleParameters struct { - AllowedMergeMethods []PullRequestMergeMethod `json:"allowed_merge_methods"` - AutomaticCopilotCodeReviewEnabled *bool `json:"automatic_copilot_code_review_enabled,omitempty"` - DismissStaleReviewsOnPush bool `json:"dismiss_stale_reviews_on_push"` - RequireCodeOwnerReview bool `json:"require_code_owner_review"` - RequireLastPushApproval bool `json:"require_last_push_approval"` - RequiredApprovingReviewCount int `json:"required_approving_review_count"` - RequiredReviewThreadResolution bool `json:"required_review_thread_resolution"` + AllowedMergeMethods []PullRequestMergeMethod `json:"allowed_merge_methods,omitempty"` + DismissStaleReviewsOnPush bool `json:"dismiss_stale_reviews_on_push"` + RequireCodeOwnerReview bool `json:"require_code_owner_review"` + RequireLastPushApproval bool `json:"require_last_push_approval"` + RequiredApprovingReviewCount int `json:"required_approving_review_count"` + RequiredReviewers []*RulesetRequiredReviewer `json:"required_reviewers,omitempty"` + RequiredReviewThreadResolution bool `json:"required_review_thread_resolution"` +} + +// RulesetRequiredReviewer represents required reviewer parameters for pull requests in rulesets. +type RulesetRequiredReviewer struct { + MinimumApprovals *int `json:"minimum_approvals,omitempty"` + FilePatterns []string `json:"file_patterns,omitempty"` + Reviewer *RulesetReviewer `json:"reviewer,omitempty"` +} + +// RulesetReviewer represents a reviewer in a ruleset required reviewer rule. +type RulesetReviewer struct { + ID *int64 `json:"id,omitempty"` + Type *RulesetReviewerType `json:"type,omitempty"` } // RequiredStatusChecksRuleParameters represents the required status checks rule parameters. @@ -486,6 +547,12 @@ type CodeScanningRuleParameters struct { CodeScanningTools []*RuleCodeScanningTool `json:"code_scanning_tools"` } +// CopilotCodeReviewRuleParameters represents the copilot_code_review rule parameters. +type CopilotCodeReviewRuleParameters struct { + ReviewOnPush bool `json:"review_on_push"` + ReviewDraftPullRequests bool `json:"review_draft_pull_requests"` +} + // RuleCodeScanningTool represents a single code scanning tool for the code scanning parameters. type RuleCodeScanningTool struct { AlertsThreshold CodeScanningAlertsThreshold `json:"alerts_threshold"` @@ -493,6 +560,18 @@ type RuleCodeScanningTool struct { Tool string `json:"tool"` } +// SimplePatternRuleParameters represents the parameters for a simple pattern rule. +type SimplePatternRuleParameters struct { + Negate bool `json:"negate"` + Pattern string `json:"pattern"` +} + +// RepositoryVisibilityRuleParameters represents the repository visibility rule parameters. +type RepositoryVisibilityRuleParameters struct { + Internal bool `json:"internal"` + Private bool `json:"private"` +} + // repositoryRulesetRuleWrapper is a helper type to marshal & unmarshal a ruleset rule. type repositoryRulesetRuleWrapper struct { Type RepositoryRuleType `json:"type"` @@ -501,9 +580,7 @@ type repositoryRulesetRuleWrapper struct { // MarshalJSON is a custom JSON marshaler for RulesetRules. func (r *RepositoryRulesetRules) MarshalJSON() ([]byte, error) { - // The RepositoryRulesetRules type marshals to between 1 and 21 rules. - // If new rules are added to RepositoryRulesetRules the capacity below needs increasing - rawRules := make([]json.RawMessage, 0, 21) + var rawRules []json.RawMessage if r.Creation != nil { bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeCreation, r.Creation) @@ -673,17 +750,86 @@ func (r *RepositoryRulesetRules) MarshalJSON() ([]byte, error) { rawRules = append(rawRules, json.RawMessage(bytes)) } + if r.CopilotCodeReview != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeCopilotCodeReview, r.CopilotCodeReview) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.RepositoryCreate != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeRepositoryCreate, r.RepositoryCreate) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.RepositoryDelete != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeRepositoryDelete, r.RepositoryDelete) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.RepositoryName != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeRepositoryName, r.RepositoryName) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.RepositoryTransfer != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeRepositoryTransfer, r.RepositoryTransfer) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.RepositoryVisibility != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeRepositoryVisibility, r.RepositoryVisibility) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if len(rawRules) == 0 { + return []byte("[]"), nil + } + return json.Marshal(rawRules) } // marshalRepositoryRulesetRule is a helper function to marshal a ruleset rule. -// -// TODO: Benchmark the code that uses reflection. -// TODO: Use a generator here instead of reflection if there is a significant performance hit. func marshalRepositoryRulesetRule[T any](t RepositoryRuleType, params T) ([]byte, error) { - paramsType := reflect.TypeFor[T]() + hasParams := true + + switch t { + case RulesetRuleTypeCreation, + RulesetRuleTypeDeletion, + RulesetRuleTypeRequiredLinearHistory, + RulesetRuleTypeRequiredSignatures, + RulesetRuleTypeNonFastForward, + RulesetRuleTypeRepositoryCreate, + RulesetRuleTypeRepositoryDelete, + RulesetRuleTypeRepositoryTransfer: + hasParams = false + case RulesetRuleTypeUpdate: + paramsTyped, ok := any(params).(*UpdateRuleParameters) + if !ok { + return nil, fmt.Errorf("expected UpdateRuleParameters for rule type %v", t) + } + if paramsTyped == nil || *paramsTyped == (UpdateRuleParameters{}) { + hasParams = false + } + } - if paramsType.Kind() == reflect.Pointer && (reflect.ValueOf(params).IsNil() || reflect.ValueOf(params).Elem().IsZero()) { + if !hasParams { return json.Marshal(repositoryRulesetRuleWrapper{Type: t}) } @@ -843,6 +989,36 @@ func (r *RepositoryRulesetRules) UnmarshalJSON(data []byte) error { return err } } + case RulesetRuleTypeCopilotCodeReview: + r.CopilotCodeReview = &CopilotCodeReviewRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.CopilotCodeReview); err != nil { + return err + } + } + case RulesetRuleTypeRepositoryCreate: + r.RepositoryCreate = &EmptyRuleParameters{} + case RulesetRuleTypeRepositoryDelete: + r.RepositoryDelete = &EmptyRuleParameters{} + case RulesetRuleTypeRepositoryName: + r.RepositoryName = &SimplePatternRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.RepositoryName); err != nil { + return err + } + } + case RulesetRuleTypeRepositoryTransfer: + r.RepositoryTransfer = &EmptyRuleParameters{} + case RulesetRuleTypeRepositoryVisibility: + r.RepositoryVisibility = &RepositoryVisibilityRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.RepositoryVisibility); err != nil { + return err + } + } } } @@ -1036,6 +1212,16 @@ func (r *BranchRules) UnmarshalJSON(data []byte) error { } r.CodeScanning = append(r.CodeScanning, &CodeScanningBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) + case RulesetRuleTypeCopilotCodeReview: + params := &CopilotCodeReviewRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, params); err != nil { + return err + } + } + + r.CopilotCodeReview = append(r.CopilotCodeReview, &CopilotCodeReviewBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) } } @@ -1053,7 +1239,14 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { r.Type = w.Type switch r.Type { - case RulesetRuleTypeCreation: + case RulesetRuleTypeCreation, + RulesetRuleTypeDeletion, + RulesetRuleTypeRequiredLinearHistory, + RulesetRuleTypeRequiredSignatures, + RulesetRuleTypeNonFastForward, + RulesetRuleTypeRepositoryCreate, + RulesetRuleTypeRepositoryDelete, + RulesetRuleTypeRepositoryTransfer: r.Parameters = nil case RulesetRuleTypeUpdate: p := &UpdateRuleParameters{} @@ -1065,10 +1258,6 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeDeletion: - r.Parameters = nil - case RulesetRuleTypeRequiredLinearHistory: - r.Parameters = nil case RulesetRuleTypeMergeQueue: p := &MergeQueueRuleParameters{} @@ -1089,8 +1278,6 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeRequiredSignatures: - r.Parameters = nil case RulesetRuleTypePullRequest: p := &PullRequestRuleParameters{} @@ -1111,9 +1298,11 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeNonFastForward: - r.Parameters = nil - case RulesetRuleTypeCommitMessagePattern: + case RulesetRuleTypeCommitMessagePattern, + RulesetRuleTypeCommitAuthorEmailPattern, + RulesetRuleTypeCommitterEmailPattern, + RulesetRuleTypeBranchNamePattern, + RulesetRuleTypeTagNamePattern: p := &PatternRuleParameters{} if w.Parameters != nil { @@ -1123,18 +1312,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeCommitAuthorEmailPattern: - p := &PatternRuleParameters{} - - if w.Parameters != nil { - if err := json.Unmarshal(w.Parameters, p); err != nil { - return err - } - } - - r.Parameters = p - case RulesetRuleTypeCommitterEmailPattern: - p := &PatternRuleParameters{} + case RulesetRuleTypeFilePathRestriction: + p := &FilePathRestrictionRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1143,8 +1322,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeBranchNamePattern: - p := &PatternRuleParameters{} + case RulesetRuleTypeMaxFilePathLength: + p := &MaxFilePathLengthRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1153,8 +1332,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeTagNamePattern: - p := &PatternRuleParameters{} + case RulesetRuleTypeFileExtensionRestriction: + p := &FileExtensionRestrictionRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1163,8 +1342,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeFilePathRestriction: - p := &FilePathRestrictionRuleParameters{} + case RulesetRuleTypeMaxFileSize: + p := &MaxFileSizeRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1173,8 +1352,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeMaxFilePathLength: - p := &MaxFilePathLengthRuleParameters{} + case RulesetRuleTypeWorkflows: + p := &WorkflowsRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1183,8 +1362,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeFileExtensionRestriction: - p := &FileExtensionRestrictionRuleParameters{} + case RulesetRuleTypeCodeScanning: + p := &CodeScanningRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1193,8 +1372,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeMaxFileSize: - p := &MaxFileSizeRuleParameters{} + case RulesetRuleTypeCopilotCodeReview: + p := &CopilotCodeReviewRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1203,8 +1382,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeWorkflows: - p := &WorkflowsRuleParameters{} + case RulesetRuleTypeRepositoryName: + p := &SimplePatternRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1213,15 +1392,14 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeCodeScanning: - p := &CodeScanningRuleParameters{} + case RulesetRuleTypeRepositoryVisibility: + p := &RepositoryVisibilityRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { return err } } - r.Parameters = p } diff --git a/vendor/github.com/google/go-github/v75/github/scim.go b/vendor/github.com/google/go-github/v84/github/scim.go similarity index 71% rename from vendor/github.com/google/go-github/v75/github/scim.go rename to vendor/github.com/google/go-github/v84/github/scim.go index 8b3c1c4ee..8e89796a4 100644 --- a/vendor/github.com/google/go-github/v75/github/scim.go +++ b/vendor/github.com/google/go-github/v84/github/scim.go @@ -17,29 +17,10 @@ import ( // GitHub API docs: https://docs.github.com/rest/scim type SCIMService service -// SCIMGroupAttributes represents supported SCIM Group attributes. -// -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/scim#list-provisioned-scim-groups-for-an-enterprise -type SCIMGroupAttributes struct { - DisplayName *string `json:"displayName,omitempty"` // The name of the group, suitable for display to end-users. (Optional.) - Members []*SCIMDisplayReference `json:"members,omitempty"` // (Optional.) - Schemas []string `json:"schemas,omitempty"` // (Optional.) - ExternalID *string `json:"externalId,omitempty"` // (Optional.) - // Only populated as a result of calling ListSCIMProvisionedIdentitiesOptions: - ID *string `json:"id,omitempty"` - Meta *SCIMMeta `json:"meta,omitempty"` -} - -// SCIMDisplayReference represents a JSON SCIM (System for Cross-domain Identity Management) resource. -type SCIMDisplayReference struct { - Value string `json:"value"` // (Required.) - Ref string `json:"$ref"` // (Required.) - Display *string `json:"display,omitempty"` // (Optional.) -} - // SCIMUserAttributes represents supported SCIM User attributes. // -// GitHub API docs: https://docs.github.com/rest/scim#supported-scim-user-attributes +// GitHub Enterprise Cloud API docs: https://docs.github.com/rest/scim#supported-scim-user-attributes +// GitHub Enterprise Server API docs: https://docs.github.com/en/enterprise-server@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#supported-scim-user-attributes type SCIMUserAttributes struct { UserName string `json:"userName"` // Configured by the admin. Could be an email, login, or username. (Required.) Name SCIMUserName `json:"name"` // (Required.) @@ -48,6 +29,7 @@ type SCIMUserAttributes struct { Schemas []string `json:"schemas,omitempty"` // (Optional.) ExternalID *string `json:"externalId,omitempty"` // (Optional.) Groups []string `json:"groups,omitempty"` // (Optional.) + Roles []*SCIMUserRole `json:"roles,omitempty"` // (Optional, GHES only.) Active *bool `json:"active,omitempty"` // (Optional.) // Only populated as a result of calling ListSCIMProvisionedIdentitiesOptions or GetSCIMProvisioningInfoForUser: ID *string `json:"id,omitempty"` @@ -68,6 +50,18 @@ type SCIMUserEmail struct { Type *string `json:"type,omitempty"` // (Optional.) } +// SCIMUserRole is an enterprise-wide role granted to the user. This is only +// supported in GitHub Enterprise Server, and not GitHub Enterprise Cloud. +// See the docs for allowed role names. +// +// https://docs.github.com/en/enterprise-server@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#provision-a-scim-enterprise-user +type SCIMUserRole struct { + Value string `json:"value"` // (Required.) + Display *string `json:"display,omitempty"` // (Optional.) + Type *string `json:"type,omitempty"` // (Optional.) + Primary *bool `json:"primary,omitempty"` // (Optional.) +} + // SCIMMeta represents metadata about the SCIM resource. type SCIMMeta struct { ResourceType *string `json:"resourceType,omitempty"` @@ -76,15 +70,6 @@ type SCIMMeta struct { Location *string `json:"location,omitempty"` } -// SCIMProvisionedGroups represents the result of calling ListSCIMProvisionedGroupsForEnterprise. -type SCIMProvisionedGroups struct { - Schemas []string `json:"schemas,omitempty"` - TotalResults *int `json:"totalResults,omitempty"` - ItemsPerPage *int `json:"itemsPerPage,omitempty"` - StartIndex *int `json:"startIndex,omitempty"` - Resources []*SCIMGroupAttributes `json:"Resources,omitempty"` -} - // SCIMProvisionedIdentities represents the result of calling ListSCIMProvisionedIdentities. type SCIMProvisionedIdentities struct { Schemas []string `json:"schemas,omitempty"` @@ -108,26 +93,6 @@ type ListSCIMProvisionedIdentitiesOptions struct { Filter *string `url:"filter,omitempty"` } -// ListSCIMProvisionedGroupsForEnterpriseOptions represents options for ListSCIMProvisionedGroupsForEnterprise. -// -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/scim#list-provisioned-scim-groups-for-an-enterprise--parameters -type ListSCIMProvisionedGroupsForEnterpriseOptions struct { - // Filter specifies the matching results to return. - // Multiple filters are not supported. Possible filters are externalId, id, and displayName. - // For example: ?filter=externalId eq "9138790-10932-109120392-12321". - // (Optional.) - Filter *string `url:"filter,omitempty"` - // ExcludedAttributes excludes the specified attribute from being returned in the results. - // Using this parameter can speed up response time. (Optional.) - ExcludedAttributes *string `url:"excludedAttributes,omitempty"` - // StartIndex used for pagination: the starting index of the first result to return when paginating through values. (Optional.) - // Default: 1. - StartIndex *int `url:"startIndex,omitempty"` - // Count used for pagination: the number of results to return per page. (Optional.) - // Default: 30. - Count *int `url:"count,omitempty"` -} - // ListSCIMProvisionedIdentities lists SCIM provisioned identities. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#list-scim-provisioned-identities @@ -266,29 +231,3 @@ func (s *SCIMService) DeleteSCIMUserFromOrg(ctx context.Context, org, scimUserID return s.client.Do(ctx, req, nil) } - -// ListSCIMProvisionedGroupsForEnterprise lists SCIM provisioned groups for an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#list-provisioned-scim-groups-for-an-enterprise -// -//meta:operation GET /scim/v2/enterprises/{enterprise}/Groups -func (s *SCIMService) ListSCIMProvisionedGroupsForEnterprise(ctx context.Context, enterprise string, opts *ListSCIMProvisionedGroupsForEnterpriseOptions) (*SCIMProvisionedGroups, *Response, error) { - u := fmt.Sprintf("scim/v2/enterprises/%v/Groups", enterprise) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - groups := new(SCIMProvisionedGroups) - resp, err := s.client.Do(ctx, req, groups) - if err != nil { - return nil, resp, err - } - - return groups, resp, nil -} diff --git a/vendor/github.com/google/go-github/v75/github/search.go b/vendor/github.com/google/go-github/v84/github/search.go similarity index 95% rename from vendor/github.com/google/go-github/v75/github/search.go rename to vendor/github.com/google/go-github/v84/github/search.go index a8d8a62cd..eb8ea2236 100644 --- a/vendor/github.com/google/go-github/v75/github/search.go +++ b/vendor/github.com/google/go-github/v84/github/search.go @@ -54,6 +54,9 @@ type SearchOptions struct { // Whether to retrieve text match metadata with a query TextMatch bool `url:"-"` + // Whether to enable advanced search for issues + AdvancedSearch *bool `url:"advanced_search,omitempty"` + ListOptions } @@ -311,7 +314,7 @@ func (s *SearchService) search(ctx context.Context, searchType string, parameter params.Set("repository_id", strconv.FormatInt(*parameters.RepositoryID, 10)) } params.Set("q", parameters.Query) - u := fmt.Sprintf("search/%s?%s", searchType, params.Encode()) + u := fmt.Sprintf("search/%v?%v", searchType, params.Encode()) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -321,19 +324,12 @@ func (s *SearchService) search(ctx context.Context, searchType string, parameter switch searchType { case "commits": // Accept header for search commits preview endpoint - // TODO: remove custom Accept header when this API fully launches. acceptHeaders = append(acceptHeaders, mediaTypeCommitSearchPreview) - case "topics": - // Accept header for search repositories based on topics preview endpoint - // TODO: remove custom Accept header when this API fully launches. - acceptHeaders = append(acceptHeaders, mediaTypeTopicsPreview) - case "repositories": + case "topics", "repositories": // Accept header for search repositories based on topics preview endpoint - // TODO: remove custom Accept header when this API fully launches. acceptHeaders = append(acceptHeaders, mediaTypeTopicsPreview) case "issues": // Accept header for search issues based on reactions preview endpoint - // TODO: remove custom Accept header when this API fully launches. acceptHeaders = append(acceptHeaders, mediaTypeReactionsPreview) } // https://docs.github.com/rest/search#search-repositories diff --git a/vendor/github.com/google/go-github/v75/github/secret_scanning.go b/vendor/github.com/google/go-github/v84/github/secret_scanning.go similarity index 76% rename from vendor/github.com/google/go-github/v75/github/secret_scanning.go rename to vendor/github.com/google/go-github/v84/github/secret_scanning.go index f75800f6e..248abadc6 100644 --- a/vendor/github.com/google/go-github/v75/github/secret_scanning.go +++ b/vendor/github.com/google/go-github/v84/github/secret_scanning.go @@ -120,12 +120,59 @@ type SecretScanningAlertUpdateOptions struct { ResolutionComment *string `json:"resolution_comment,omitempty"` } +// PushProtectionBypassRequest represents the parameters for CreatePushProtectionBypass. +type PushProtectionBypassRequest struct { + // The reason for bypassing push protection. + // Can be one of: false_positive, used_in_tests, will_fix_later + Reason string `json:"reason"` + // PlaceholderID is an identifier used for the bypass request. + // GitHub Secret Scanning provides you with a unique PlaceholderID associated with that specific blocked push. + PlaceholderID string `json:"placeholder_id"` +} + +// PushProtectionBypass represents the response from CreatePushProtectionBypass. +type PushProtectionBypass struct { + // The reason for bypassing push protection. + Reason string `json:"reason"` + // The time that the bypass will expire in ISO 8601 format. + ExpireAt *Timestamp `json:"expire_at"` + // The token type this bypass is for. + TokenType string `json:"token_type"` +} + +// SecretsScan represents the common fields for a secret scanning scan. +type SecretsScan struct { + Type string `json:"type"` + Status string `json:"status"` + CompletedAt *Timestamp `json:"completed_at,omitempty"` + StartedAt *Timestamp `json:"started_at,omitempty"` +} + +// CustomPatternBackfillScan represents a scan with an associated custom pattern. +type CustomPatternBackfillScan struct { + SecretsScan + PatternSlug *string `json:"pattern_slug,omitempty"` + PatternScope *string `json:"pattern_scope,omitempty"` +} + +// SecretScanningScanHistory is the top-level struct for the secret scanning API response. +type SecretScanningScanHistory struct { + // Information on incremental scan performed by secret scanning on the repository. + IncrementalScans []*SecretsScan `json:"incremental_scans,omitempty"` + // Information on backfill scan performed by secret scanning on the repository. + BackfillScans []*SecretsScan `json:"backfill_scans,omitempty"` + // Information on pattern update scan performed by secret scanning on the repository. + PatternUpdateScans []*SecretsScan `json:"pattern_update_scans,omitempty"` + // Information on custom pattern backfill scan performed by secret scanning on the repository. + CustomPatternBackfillScans []*CustomPatternBackfillScan `json:"custom_pattern_backfill_scans,omitempty"` +} + // ListAlertsForEnterprise lists secret scanning alerts for eligible repositories in an enterprise, from newest to oldest. // // To use this endpoint, you must be a member of the enterprise, and you must use an access token with the repo scope or // security_events scope. Alerts are only returned for organizations in the enterprise for which you are an organization owner or a security manager. // -// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/secret-scanning/alerts func (s *SecretScanningService) ListAlertsForEnterprise(ctx context.Context, enterprise string, opts *SecretScanningAlertListOptions) ([]*SecretScanningAlert, *Response, error) { @@ -285,3 +332,52 @@ func (s *SecretScanningService) ListLocationsForAlert(ctx context.Context, owner return locations, resp, nil } + +// CreatePushProtectionBypass creates a push protection bypass for a given repository. +// +// To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with +// the repo scope or security_events scope. +// +// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#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) { + u := fmt.Sprintf("repos/%v/%v/secret-scanning/push-protection-bypasses", owner, repo) + + req, err := s.client.NewRequest("POST", u, request) + if err != nil { + return nil, nil, err + } + + var pushProtectionBypass *PushProtectionBypass + resp, err := s.client.Do(ctx, req, &pushProtectionBypass) + if err != nil { + return nil, resp, err + } + return pushProtectionBypass, resp, nil +} + +// GetScanHistory fetches the secret scanning history for a given repository. +// +// To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with +// the repo scope or security_events scope and gitHub advanced security or secret scanning must be enabled. +// +// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#get-secret-scanning-scan-history-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/secret-scanning/scan-history +func (s *SecretScanningService) GetScanHistory(ctx context.Context, owner, repo string) (*SecretScanningScanHistory, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/secret-scanning/scan-history", owner, repo) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var secretScanningHistory *SecretScanningScanHistory + resp, err := s.client.Do(ctx, req, &secretScanningHistory) + if err != nil { + return nil, resp, err + } + + return secretScanningHistory, resp, nil +} diff --git a/vendor/github.com/google/go-github/v75/github/secret_scanning_pattern_configs.go b/vendor/github.com/google/go-github/v84/github/secret_scanning_pattern_configs.go similarity index 98% rename from vendor/github.com/google/go-github/v75/github/secret_scanning_pattern_configs.go rename to vendor/github.com/google/go-github/v84/github/secret_scanning_pattern_configs.go index c2d51f7d8..5eb51c459 100644 --- a/vendor/github.com/google/go-github/v75/github/secret_scanning_pattern_configs.go +++ b/vendor/github.com/google/go-github/v84/github/secret_scanning_pattern_configs.go @@ -18,7 +18,7 @@ type SecretScanningPatternConfigs struct { CustomPatternOverrides []*SecretScanningPatternOverride `json:"custom_pattern_overrides,omitempty"` } -// SecretScanningPatternOverride respresents an override for provider partner or custom organization patterns. +// SecretScanningPatternOverride represents an override for provider partner or custom organization patterns. type SecretScanningPatternOverride struct { TokenType *string `json:"token_type,omitempty"` CustomPatternVersion *string `json:"custom_pattern_version,omitempty"` diff --git a/vendor/github.com/google/go-github/v75/github/security_advisories.go b/vendor/github.com/google/go-github/v84/github/security_advisories.go similarity index 95% rename from vendor/github.com/google/go-github/v75/github/security_advisories.go rename to vendor/github.com/google/go-github/v84/github/security_advisories.go index d783345de..5c7b8fd4e 100644 --- a/vendor/github.com/google/go-github/v75/github/security_advisories.go +++ b/vendor/github.com/google/go-github/v84/github/security_advisories.go @@ -8,6 +8,7 @@ package github import ( "context" "encoding/json" + "errors" "fmt" ) @@ -143,7 +144,7 @@ func (s *SecurityAdvisoriesService) RequestCVE(ctx context.Context, owner, repo, resp, err := s.client.Do(ctx, req, nil) if err != nil { - if _, ok := err.(*AcceptedError); ok { + if errors.As(err, new(*AcceptedError)) { return resp, nil } @@ -170,7 +171,8 @@ func (s *SecurityAdvisoriesService) CreateTemporaryPrivateFork(ctx context.Conte fork := new(Repository) resp, err := s.client.Do(ctx, req, fork) if err != nil { - if aerr, ok := err.(*AcceptedError); ok { + var aerr *AcceptedError + if errors.As(err, &aerr) { if err := json.Unmarshal(aerr.Raw, fork); err != nil { return fork, resp, err } @@ -188,9 +190,9 @@ func (s *SecurityAdvisoriesService) CreateTemporaryPrivateFork(ctx context.Conte // GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories-for-an-organization // //meta:operation GET /orgs/{org}/security-advisories -func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesForOrg(ctx context.Context, org string, opt *ListRepositorySecurityAdvisoriesOptions) ([]*SecurityAdvisory, *Response, error) { +func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesForOrg(ctx context.Context, org string, opts *ListRepositorySecurityAdvisoriesOptions) ([]*SecurityAdvisory, *Response, error) { url := fmt.Sprintf("orgs/%v/security-advisories", org) - url, err := addOptions(url, opt) + url, err := addOptions(url, opts) if err != nil { return nil, nil, err } @@ -214,9 +216,9 @@ func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesForOrg(ctx c // GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories // //meta:operation GET /repos/{owner}/{repo}/security-advisories -func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisories(ctx context.Context, owner, repo string, opt *ListRepositorySecurityAdvisoriesOptions) ([]*SecurityAdvisory, *Response, error) { +func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisories(ctx context.Context, owner, repo string, opts *ListRepositorySecurityAdvisoriesOptions) ([]*SecurityAdvisory, *Response, error) { url := fmt.Sprintf("repos/%v/%v/security-advisories", owner, repo) - url, err := addOptions(url, opt) + url, err := addOptions(url, opts) if err != nil { return nil, nil, err } @@ -267,7 +269,7 @@ func (s *SecurityAdvisoriesService) ListGlobalSecurityAdvisories(ctx context.Con // //meta:operation GET /advisories/{ghsa_id} func (s *SecurityAdvisoriesService) GetGlobalSecurityAdvisories(ctx context.Context, ghsaID string) (*GlobalSecurityAdvisory, *Response, error) { - url := fmt.Sprintf("advisories/%s", ghsaID) + url := fmt.Sprintf("advisories/%v", ghsaID) req, err := s.client.NewRequest("GET", url, nil) if err != nil { return nil, nil, err diff --git a/vendor/github.com/google/go-github/v75/github/strings.go b/vendor/github.com/google/go-github/v84/github/strings.go similarity index 57% rename from vendor/github.com/google/go-github/v75/github/strings.go rename to vendor/github.com/google/go-github/v84/github/strings.go index 46fd55ad1..dfbe3c685 100644 --- a/vendor/github.com/google/go-github/v75/github/strings.go +++ b/vendor/github.com/google/go-github/v84/github/strings.go @@ -9,24 +9,37 @@ import ( "bytes" "fmt" "reflect" + "strconv" + "sync" ) -var timestampType = reflect.TypeOf(Timestamp{}) +var timestampType = reflect.TypeFor[Timestamp]() + +var bufferPool = sync.Pool{ + New: func() any { + return new(bytes.Buffer) + }, +} // Stringify attempts to create a reasonable string representation of types in // the GitHub library. It does things like resolve pointers to their values // and omits struct fields with nil values. func Stringify(message any) string { - var buf bytes.Buffer + buf := bufferPool.Get().(*bytes.Buffer) + defer func() { + buf.Reset() + bufferPool.Put(buf) + }() + v := reflect.ValueOf(message) - stringifyValue(&buf, v) + stringifyValue(buf, v) return buf.String() } // stringifyValue was heavily inspired by the goprotobuf library. func stringifyValue(w *bytes.Buffer, val reflect.Value) { - if val.Kind() == reflect.Ptr && val.IsNil() { + if val.Kind() == reflect.Pointer && val.IsNil() { w.WriteString("") return } @@ -34,11 +47,23 @@ func stringifyValue(w *bytes.Buffer, val reflect.Value) { v := reflect.Indirect(val) switch v.Kind() { + case reflect.Bool: + w.Write(strconv.AppendBool(w.Bytes(), v.Bool())[w.Len():]) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + w.Write(strconv.AppendInt(w.Bytes(), v.Int(), 10)[w.Len():]) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + w.Write(strconv.AppendUint(w.Bytes(), v.Uint(), 10)[w.Len():]) + case reflect.Float32: + w.Write(strconv.AppendFloat(w.Bytes(), v.Float(), 'g', -1, 32)[w.Len():]) + case reflect.Float64: + w.Write(strconv.AppendFloat(w.Bytes(), v.Float(), 'g', -1, 64)[w.Len():]) case reflect.String: - fmt.Fprintf(w, `"%s"`, v) + w.WriteByte('"') + w.WriteString(v.String()) + w.WriteByte('"') case reflect.Slice: w.WriteByte('[') - for i := 0; i < v.Len(); i++ { + for i := range v.Len() { if i > 0 { w.WriteByte(' ') } @@ -55,16 +80,16 @@ func stringifyValue(w *bytes.Buffer, val reflect.Value) { // special handling of Timestamp values if v.Type() == timestampType { - fmt.Fprintf(w, "{%s}", v.Interface()) + fmt.Fprintf(w, "{%v}", v.Interface()) return } w.WriteByte('{') var sep bool - for i := 0; i < v.NumField(); i++ { + for i := range v.NumField() { fv := v.Field(i) - if fv.Kind() == reflect.Ptr && fv.IsNil() { + if fv.Kind() == reflect.Pointer && fv.IsNil() { continue } if fv.Kind() == reflect.Slice && fv.IsNil() { diff --git a/vendor/github.com/google/go-github/v75/github/sub_issue.go b/vendor/github.com/google/go-github/v84/github/sub_issue.go similarity index 98% rename from vendor/github.com/google/go-github/v75/github/sub_issue.go rename to vendor/github.com/google/go-github/v84/github/sub_issue.go index 2effcc5af..02f7f505c 100644 --- a/vendor/github.com/google/go-github/v75/github/sub_issue.go +++ b/vendor/github.com/google/go-github/v84/github/sub_issue.go @@ -71,7 +71,7 @@ func (s *SubIssueService) Remove(ctx context.Context, owner, repo string, issueN // GitHub API docs: https://docs.github.com/rest/issues/sub-issues#list-sub-issues // //meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/sub_issues -func (s *SubIssueService) ListByIssue(ctx context.Context, owner, repo string, issueNumber int64, opts *IssueListOptions) ([]*SubIssue, *Response, error) { +func (s *SubIssueService) ListByIssue(ctx context.Context, owner, repo string, issueNumber int64, opts *ListOptions) ([]*SubIssue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/sub_issues", owner, repo, issueNumber) u, err := addOptions(u, opts) if err != nil { diff --git a/vendor/github.com/google/go-github/v75/github/teams.go b/vendor/github.com/google/go-github/v84/github/teams.go similarity index 95% rename from vendor/github.com/google/go-github/v75/github/teams.go rename to vendor/github.com/google/go-github/v84/github/teams.go index d334110f4..cf9a616d3 100644 --- a/vendor/github.com/google/go-github/v75/github/teams.go +++ b/vendor/github.com/google/go-github/v84/github/teams.go @@ -60,6 +60,10 @@ type Team struct { // possible values are: "direct", "indirect", "mixed". This is only populated when // calling the ListTeamsAssignedToOrgRole method. Assignment *string `json:"assignment,omitempty"` + + // Type identifies the ownership type of the team + // Possible values are: "organization", "enterprise". + Type *string `json:"type,omitempty"` } func (t Team) String() string { @@ -405,7 +409,6 @@ func (s *TeamsService) ListTeamReposByID(ctx context.Context, orgID, teamID int6 return nil, nil, err } - // TODO: remove custom Accept header when topics API fully launches. req.Header.Set("Accept", mediaTypeTopicsPreview) var repos []*Repository @@ -434,7 +437,6 @@ func (s *TeamsService) ListTeamReposBySlug(ctx context.Context, org, slug string return nil, nil, err } - // TODO: remove custom Accept header when topics API fully launches. req.Header.Set("Accept", mediaTypeTopicsPreview) var repos []*Repository @@ -504,7 +506,7 @@ type TeamAddTeamRepoOptions struct { // Permission specifies the permission to grant the team on this repository. // Possible values are: // pull - team members can pull, but not push to or administer this repository - // push - team members can pull and push, but not administer this repository + // push - team members can push and pull, but not administer this repository // admin - team members can pull, push and administer this repository // maintain - team members can manage the repository without access to sensitive or destructive actions. // triage - team members can proactively manage issues and pull requests without write access. @@ -615,7 +617,7 @@ func (s *TeamsService) ListUserTeams(ctx context.Context, opts *ListOptions) ([] // // Deprecated: Use ListTeamProjectsBySlug instead. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#list-team-projects +// GitHub API docs: https://docs.github.com/enterprise-server@3.16/rest/teams/teams#list-team-projects // //meta:operation GET /orgs/{org}/teams/{team_slug}/projects func (s *TeamsService) ListTeamProjectsByID(ctx context.Context, orgID, teamID int64) ([]*ProjectV2, *Response, error) { @@ -626,7 +628,6 @@ func (s *TeamsService) ListTeamProjectsByID(ctx context.Context, orgID, teamID i return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) var projects []*ProjectV2 @@ -640,7 +641,7 @@ func (s *TeamsService) ListTeamProjectsByID(ctx context.Context, orgID, teamID i // ListTeamProjectsBySlug lists the organization projects for a team given the team slug. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#list-team-projects +// GitHub API docs: https://docs.github.com/enterprise-server@3.16/rest/teams/teams#list-team-projects // //meta:operation GET /orgs/{org}/teams/{team_slug}/projects func (s *TeamsService) ListTeamProjectsBySlug(ctx context.Context, org, slug string) ([]*ProjectV2, *Response, error) { @@ -651,7 +652,6 @@ func (s *TeamsService) ListTeamProjectsBySlug(ctx context.Context, org, slug str return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) var projects []*ProjectV2 @@ -668,7 +668,7 @@ func (s *TeamsService) ListTeamProjectsBySlug(ctx context.Context, org, slug str // // Deprecated: Use ReviewTeamProjectsBySlug instead. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-project +// GitHub API docs: https://docs.github.com/enterprise-server@3.16/rest/teams/teams#check-team-permissions-for-a-project // //meta:operation GET /orgs/{org}/teams/{team_slug}/projects/{project_id} func (s *TeamsService) ReviewTeamProjectsByID(ctx context.Context, orgID, teamID, projectID int64) (*ProjectV2, *Response, error) { @@ -678,7 +678,6 @@ func (s *TeamsService) ReviewTeamProjectsByID(ctx context.Context, orgID, teamID return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) projects := &ProjectV2{} @@ -693,7 +692,7 @@ func (s *TeamsService) ReviewTeamProjectsByID(ctx context.Context, orgID, teamID // ReviewTeamProjectsBySlug checks whether a team, given its slug, has read, write, or admin // permissions for an organization project. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-project +// GitHub API docs: https://docs.github.com/enterprise-server@3.16/rest/teams/teams#check-team-permissions-for-a-project // //meta:operation GET /orgs/{org}/teams/{team_slug}/projects/{project_id} func (s *TeamsService) ReviewTeamProjectsBySlug(ctx context.Context, org, slug string, projectID int64) (*ProjectV2, *Response, error) { @@ -703,7 +702,6 @@ func (s *TeamsService) ReviewTeamProjectsBySlug(ctx context.Context, org, slug s return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) projects := &ProjectV2{} @@ -733,7 +731,7 @@ type TeamProjectOptions struct { // // Deprecated: Use AddTeamProjectBySlug instead. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#add-or-update-team-project-permissions +// 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) { @@ -743,7 +741,6 @@ func (s *TeamsService) AddTeamProjectByID(ctx context.Context, orgID, teamID, pr return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) return s.client.Do(ctx, req, nil) @@ -753,7 +750,7 @@ func (s *TeamsService) AddTeamProjectByID(ctx context.Context, orgID, teamID, pr // To add a project to a team or update the team's permission on a project, the // authenticated user must have admin permissions for the project. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#add-or-update-team-project-permissions +// 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) { @@ -763,7 +760,6 @@ func (s *TeamsService) AddTeamProjectBySlug(ctx context.Context, org, slug strin return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) return s.client.Do(ctx, req, nil) @@ -778,7 +774,7 @@ func (s *TeamsService) AddTeamProjectBySlug(ctx context.Context, org, slug strin // // Deprecated: Use RemoveTeamProjectBySlug instead. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#remove-a-project-from-a-team +// GitHub API docs: https://docs.github.com/enterprise-server@3.16/rest/teams/teams#remove-a-project-from-a-team // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/projects/{project_id} func (s *TeamsService) RemoveTeamProjectByID(ctx context.Context, orgID, teamID, projectID int64) (*Response, error) { @@ -788,7 +784,6 @@ func (s *TeamsService) RemoveTeamProjectByID(ctx context.Context, orgID, teamID, return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) return s.client.Do(ctx, req, nil) @@ -801,7 +796,7 @@ func (s *TeamsService) RemoveTeamProjectByID(ctx context.Context, orgID, teamID, // or project. // Note: This endpoint removes the project from the team, but does not delete it. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#remove-a-project-from-a-team +// GitHub API docs: https://docs.github.com/enterprise-server@3.16/rest/teams/teams#remove-a-project-from-a-team // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/projects/{project_id} func (s *TeamsService) RemoveTeamProjectBySlug(ctx context.Context, org, slug string, projectID int64) (*Response, error) { @@ -811,7 +806,6 @@ func (s *TeamsService) RemoveTeamProjectBySlug(ctx context.Context, org, slug st return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) return s.client.Do(ctx, req, nil) @@ -1018,7 +1012,7 @@ type ListExternalGroupsOptions struct { // ListExternalGroups lists external groups in an organization on GitHub. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups#list-external-groups-in-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups#list-external-groups-available-to-an-organization // //meta:operation GET /orgs/{org}/external-groups func (s *TeamsService) ListExternalGroups(ctx context.Context, org string, opts *ListExternalGroupsOptions) (*ExternalGroupList, *Response, error) { diff --git a/vendor/github.com/google/go-github/v75/github/teams_discussion_comments.go b/vendor/github.com/google/go-github/v84/github/teams_discussion_comments.go similarity index 88% rename from vendor/github.com/google/go-github/v75/github/teams_discussion_comments.go rename to vendor/github.com/google/go-github/v84/github/teams_discussion_comments.go index 70bcbbc95..0080dac18 100644 --- a/vendor/github.com/google/go-github/v75/github/teams_discussion_comments.go +++ b/vendor/github.com/google/go-github/v84/github/teams_discussion_comments.go @@ -43,7 +43,7 @@ type DiscussionCommentListOptions struct { // ListCommentsByID lists all comments on a team discussion by team ID. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#list-discussion-comments +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#list-discussion-comments // //meta:operation GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments func (s *TeamsService) ListCommentsByID(ctx context.Context, orgID, teamID int64, discussionNumber int, options *DiscussionCommentListOptions) ([]*DiscussionComment, *Response, error) { @@ -70,7 +70,7 @@ func (s *TeamsService) ListCommentsByID(ctx context.Context, orgID, teamID int64 // ListCommentsBySlug lists all comments on a team discussion by team slug. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#list-discussion-comments +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#list-discussion-comments // //meta:operation GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments func (s *TeamsService) ListCommentsBySlug(ctx context.Context, org, slug string, discussionNumber int, options *DiscussionCommentListOptions) ([]*DiscussionComment, *Response, error) { @@ -97,7 +97,7 @@ func (s *TeamsService) ListCommentsBySlug(ctx context.Context, org, slug string, // GetCommentByID gets a specific comment on a team discussion by team ID. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#get-a-discussion-comment +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#get-a-discussion-comment // //meta:operation GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} func (s *TeamsService) GetCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int) (*DiscussionComment, *Response, error) { @@ -119,7 +119,7 @@ func (s *TeamsService) GetCommentByID(ctx context.Context, orgID, teamID int64, // GetCommentBySlug gets a specific comment on a team discussion by team slug. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#get-a-discussion-comment +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#get-a-discussion-comment // //meta:operation GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} func (s *TeamsService) GetCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int) (*DiscussionComment, *Response, error) { @@ -142,7 +142,7 @@ func (s *TeamsService) GetCommentBySlug(ctx context.Context, org, slug string, d // CreateCommentByID creates a new comment on a team discussion by team ID. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#create-a-discussion-comment +// 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) { @@ -164,7 +164,7 @@ func (s *TeamsService) CreateCommentByID(ctx context.Context, orgID, teamID int6 // CreateCommentBySlug creates a new comment on a team discussion by team slug. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#create-a-discussion-comment +// 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) { @@ -187,7 +187,7 @@ func (s *TeamsService) CreateCommentBySlug(ctx context.Context, org, slug string // Authenticated user must grant write:discussion scope. // User is allowed to edit body of a comment only. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#update-a-discussion-comment +// 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) { @@ -210,7 +210,7 @@ func (s *TeamsService) EditCommentByID(ctx context.Context, orgID, teamID int64, // Authenticated user must grant write:discussion scope. // User is allowed to edit body of a comment only. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#update-a-discussion-comment +// 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) { @@ -232,7 +232,7 @@ func (s *TeamsService) EditCommentBySlug(ctx context.Context, org, slug string, // DeleteCommentByID deletes a comment on a team discussion by team ID. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#delete-a-discussion-comment +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#delete-a-discussion-comment // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} func (s *TeamsService) DeleteCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int) (*Response, error) { @@ -248,7 +248,7 @@ func (s *TeamsService) DeleteCommentByID(ctx context.Context, orgID, teamID int6 // DeleteCommentBySlug deletes a comment on a team discussion by team slug. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#delete-a-discussion-comment +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#delete-a-discussion-comment // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} func (s *TeamsService) DeleteCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int) (*Response, error) { diff --git a/vendor/github.com/google/go-github/v75/github/teams_discussions.go b/vendor/github.com/google/go-github/v84/github/teams_discussions.go similarity index 89% rename from vendor/github.com/google/go-github/v75/github/teams_discussions.go rename to vendor/github.com/google/go-github/v84/github/teams_discussions.go index b056525f4..a06adecf5 100644 --- a/vendor/github.com/google/go-github/v75/github/teams_discussions.go +++ b/vendor/github.com/google/go-github/v84/github/teams_discussions.go @@ -49,7 +49,7 @@ type DiscussionListOptions struct { // ListDiscussionsByID lists all discussions on team's page given Organization and Team ID. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#list-discussions +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#list-discussions // //meta:operation GET /orgs/{org}/teams/{team_slug}/discussions func (s *TeamsService) ListDiscussionsByID(ctx context.Context, orgID, teamID int64, opts *DiscussionListOptions) ([]*TeamDiscussion, *Response, error) { @@ -76,7 +76,7 @@ func (s *TeamsService) ListDiscussionsByID(ctx context.Context, orgID, teamID in // ListDiscussionsBySlug lists all discussions on team's page given Organization name and Team's slug. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#list-discussions +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#list-discussions // //meta:operation GET /orgs/{org}/teams/{team_slug}/discussions func (s *TeamsService) ListDiscussionsBySlug(ctx context.Context, org, slug string, opts *DiscussionListOptions) ([]*TeamDiscussion, *Response, error) { @@ -103,7 +103,7 @@ func (s *TeamsService) ListDiscussionsBySlug(ctx context.Context, org, slug stri // GetDiscussionByID gets a specific discussion on a team's page given Organization and Team ID. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#get-a-discussion +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#get-a-discussion // //meta:operation GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} func (s *TeamsService) GetDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int) (*TeamDiscussion, *Response, error) { @@ -125,7 +125,7 @@ func (s *TeamsService) GetDiscussionByID(ctx context.Context, orgID, teamID int6 // GetDiscussionBySlug gets a specific discussion on a team's page given Organization name and Team's slug. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#get-a-discussion +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#get-a-discussion // //meta:operation GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} func (s *TeamsService) GetDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int) (*TeamDiscussion, *Response, error) { @@ -147,7 +147,7 @@ func (s *TeamsService) GetDiscussionBySlug(ctx context.Context, org, slug string // CreateDiscussionByID creates a new discussion post on a team's page given Organization and Team ID. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#create-a-discussion +// 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) { @@ -169,7 +169,7 @@ func (s *TeamsService) CreateDiscussionByID(ctx context.Context, orgID, teamID i // CreateDiscussionBySlug creates a new discussion post on a team's page given Organization name and Team's slug. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#create-a-discussion +// 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) { @@ -192,7 +192,7 @@ func (s *TeamsService) CreateDiscussionBySlug(ctx context.Context, org, slug str // Authenticated user must grant write:discussion scope. // User is allowed to change Title and Body of a discussion only. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#update-a-discussion +// 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) { @@ -215,7 +215,7 @@ func (s *TeamsService) EditDiscussionByID(ctx context.Context, orgID, teamID int // Authenticated user must grant write:discussion scope. // User is allowed to change Title and Body of a discussion only. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#update-a-discussion +// 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) { @@ -237,7 +237,7 @@ func (s *TeamsService) EditDiscussionBySlug(ctx context.Context, org, slug strin // DeleteDiscussionByID deletes a discussion from team's page given Organization and Team ID. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#delete-a-discussion +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#delete-a-discussion // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} func (s *TeamsService) DeleteDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int) (*Response, error) { @@ -253,7 +253,7 @@ func (s *TeamsService) DeleteDiscussionByID(ctx context.Context, orgID, teamID i // DeleteDiscussionBySlug deletes a discussion from team's page given Organization name and Team's slug. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/rest/teams/discussions#delete-a-discussion +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#delete-a-discussion // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} func (s *TeamsService) DeleteDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int) (*Response, error) { diff --git a/vendor/github.com/google/go-github/v75/github/teams_members.go b/vendor/github.com/google/go-github/v84/github/teams_members.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/teams_members.go rename to vendor/github.com/google/go-github/v84/github/teams_members.go diff --git a/vendor/github.com/google/go-github/v75/github/timestamp.go b/vendor/github.com/google/go-github/v84/github/timestamp.go similarity index 99% rename from vendor/github.com/google/go-github/v75/github/timestamp.go rename to vendor/github.com/google/go-github/v84/github/timestamp.go index 71660193b..a26077da2 100644 --- a/vendor/github.com/google/go-github/v75/github/timestamp.go +++ b/vendor/github.com/google/go-github/v84/github/timestamp.go @@ -43,7 +43,7 @@ func (t *Timestamp) UnmarshalJSON(data []byte) (err error) { } else { t.Time, err = time.Parse(`"`+time.RFC3339+`"`, str) } - return + return err } // Equal reports whether t and u are equal based on time.Equal. diff --git a/vendor/github.com/google/go-github/v75/github/users.go b/vendor/github.com/google/go-github/v84/github/users.go similarity index 96% rename from vendor/github.com/google/go-github/v75/github/users.go rename to vendor/github.com/google/go-github/v84/github/users.go index 28db59c5e..ae5027d31 100644 --- a/vendor/github.com/google/go-github/v75/github/users.go +++ b/vendor/github.com/google/go-github/v84/github/users.go @@ -68,8 +68,8 @@ type User struct { // Permissions and RoleName identify the permissions and role that a user has on a given // repository. These are only populated when calling Repositories.ListCollaborators. - Permissions map[string]bool `json:"permissions,omitempty"` - RoleName *string `json:"role_name,omitempty"` + Permissions *RepositoryPermissions `json:"permissions,omitempty"` + RoleName *string `json:"role_name,omitempty"` // Assignment identifies how a user was assigned to an organization role. Its // possible values are: "direct", "indirect", "mixed". This is only populated when @@ -88,6 +88,7 @@ func (u User) String() string { // user. // // GitHub API docs: https://docs.github.com/rest/users/users#get-a-user +// // GitHub API docs: https://docs.github.com/rest/users/users#get-the-authenticated-user // //meta:operation GET /user @@ -119,7 +120,7 @@ func (s *UsersService) Get(ctx context.Context, user string) (*User, *Response, // //meta:operation GET /user/{account_id} func (s *UsersService) GetByID(ctx context.Context, id int64) (*User, *Response, error) { - u := fmt.Sprintf("user/%d", id) + u := fmt.Sprintf("user/%v", id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -207,13 +208,9 @@ func (s *UsersService) GetHovercard(ctx context.Context, user string, opts *Hove // UserListOptions specifies optional parameters to the UsersService.ListAll // method. type UserListOptions struct { - // ID of the last user seen - Since int64 `url:"since,omitempty"` - - // Note: Pagination is powered exclusively by the Since parameter, - // ListOptions.Page has no effect. - // ListOptions.PerPage controls an undocumented GitHub API parameter. - ListOptions + // A user ID. Only return users with an ID greater than this ID. + Since int64 `url:"since,omitempty"` + PerPage int `url:"per_page,omitempty"` } // ListAll lists all GitHub users. diff --git a/vendor/github.com/google/go-github/v75/github/users_administration.go b/vendor/github.com/google/go-github/v84/github/users_administration.go similarity index 88% rename from vendor/github.com/google/go-github/v75/github/users_administration.go rename to vendor/github.com/google/go-github/v84/github/users_administration.go index 5d0d4c15e..83da04ece 100644 --- a/vendor/github.com/google/go-github/v75/github/users_administration.go +++ b/vendor/github.com/google/go-github/v84/github/users_administration.go @@ -12,7 +12,7 @@ import ( // PromoteSiteAdmin promotes a user to a site administrator of a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#promote-a-user-to-be-a-site-administrator +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/users#promote-a-user-to-be-a-site-administrator // //meta:operation PUT /users/{username}/site_admin func (s *UsersService) PromoteSiteAdmin(ctx context.Context, user string) (*Response, error) { @@ -28,7 +28,7 @@ func (s *UsersService) PromoteSiteAdmin(ctx context.Context, user string) (*Resp // DemoteSiteAdmin demotes a user from site administrator of a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#demote-a-site-administrator +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/users#demote-a-site-administrator // //meta:operation DELETE /users/{username}/site_admin func (s *UsersService) DemoteSiteAdmin(ctx context.Context, user string) (*Response, error) { @@ -42,14 +42,14 @@ func (s *UsersService) DemoteSiteAdmin(ctx context.Context, user string) (*Respo return s.client.Do(ctx, req, nil) } -// UserSuspendOptions represents the reason a user is being suspended. +// UserSuspendOptions represents the reason to suspend a user. type UserSuspendOptions struct { Reason *string `json:"reason,omitempty"` } // Suspend a user on a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#suspend-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/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) { @@ -65,7 +65,7 @@ func (s *UsersService) Suspend(ctx context.Context, user string, opts *UserSuspe // Unsuspend a user on a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.17/rest/enterprise-admin/users#unsuspend-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.20/rest/enterprise-admin/users#unsuspend-a-user // //meta:operation DELETE /users/{username}/suspended func (s *UsersService) Unsuspend(ctx context.Context, user string) (*Response, error) { diff --git a/vendor/github.com/google/go-github/v75/github/users_attestations.go b/vendor/github.com/google/go-github/v84/github/users_attestations.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/users_attestations.go rename to vendor/github.com/google/go-github/v84/github/users_attestations.go diff --git a/vendor/github.com/google/go-github/v75/github/users_blocking.go b/vendor/github.com/google/go-github/v84/github/users_blocking.go similarity index 90% rename from vendor/github.com/google/go-github/v75/github/users_blocking.go rename to vendor/github.com/google/go-github/v84/github/users_blocking.go index 3f2af38f6..39d89d34c 100644 --- a/vendor/github.com/google/go-github/v75/github/users_blocking.go +++ b/vendor/github.com/google/go-github/v84/github/users_blocking.go @@ -27,7 +27,6 @@ func (s *UsersService) ListBlockedUsers(ctx context.Context, opts *ListOptions) return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) var blockedUsers []*User @@ -52,7 +51,6 @@ func (s *UsersService) IsBlocked(ctx context.Context, user string) (bool, *Respo return false, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) resp, err := s.client.Do(ctx, req, nil) @@ -73,7 +71,6 @@ func (s *UsersService) BlockUser(ctx context.Context, user string) (*Response, e return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) return s.client.Do(ctx, req, nil) @@ -92,7 +89,6 @@ func (s *UsersService) UnblockUser(ctx context.Context, user string) (*Response, return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) return s.client.Do(ctx, req, nil) diff --git a/vendor/github.com/google/go-github/v75/github/users_emails.go b/vendor/github.com/google/go-github/v84/github/users_emails.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/users_emails.go rename to vendor/github.com/google/go-github/v84/github/users_emails.go diff --git a/vendor/github.com/google/go-github/v75/github/users_followers.go b/vendor/github.com/google/go-github/v84/github/users_followers.go similarity index 99% rename from vendor/github.com/google/go-github/v75/github/users_followers.go rename to vendor/github.com/google/go-github/v84/github/users_followers.go index ec6f531ea..6833d8df6 100644 --- a/vendor/github.com/google/go-github/v75/github/users_followers.go +++ b/vendor/github.com/google/go-github/v84/github/users_followers.go @@ -14,6 +14,7 @@ import ( // fetch followers for the authenticated user. // // GitHub API docs: https://docs.github.com/rest/users/followers#list-followers-of-a-user +// // GitHub API docs: https://docs.github.com/rest/users/followers#list-followers-of-the-authenticated-user // //meta:operation GET /user/followers @@ -48,6 +49,7 @@ func (s *UsersService) ListFollowers(ctx context.Context, user string, opts *Lis // string will list people the authenticated user is following. // // GitHub API docs: https://docs.github.com/rest/users/followers#list-the-people-a-user-follows +// // GitHub API docs: https://docs.github.com/rest/users/followers#list-the-people-the-authenticated-user-follows // //meta:operation GET /user/following @@ -82,6 +84,7 @@ func (s *UsersService) ListFollowing(ctx context.Context, user string, opts *Lis // string for "user" will check if the authenticated user is following "target". // // GitHub API docs: https://docs.github.com/rest/users/followers#check-if-a-person-is-followed-by-the-authenticated-user +// // GitHub API docs: https://docs.github.com/rest/users/followers#check-if-a-user-follows-another-user // //meta:operation GET /user/following/{username} diff --git a/vendor/github.com/google/go-github/v75/github/users_gpg_keys.go b/vendor/github.com/google/go-github/v84/github/users_gpg_keys.go similarity index 99% rename from vendor/github.com/google/go-github/v75/github/users_gpg_keys.go rename to vendor/github.com/google/go-github/v84/github/users_gpg_keys.go index 2f296a1ef..d33564cab 100644 --- a/vendor/github.com/google/go-github/v75/github/users_gpg_keys.go +++ b/vendor/github.com/google/go-github/v84/github/users_gpg_keys.go @@ -45,6 +45,7 @@ type GPGEmail struct { // via Basic Auth or via OAuth with at least read:gpg_key scope. // // GitHub API docs: https://docs.github.com/rest/users/gpg-keys#list-gpg-keys-for-a-user +// // GitHub API docs: https://docs.github.com/rest/users/gpg-keys#list-gpg-keys-for-the-authenticated-user // //meta:operation GET /user/gpg_keys diff --git a/vendor/github.com/google/go-github/v75/github/users_keys.go b/vendor/github.com/google/go-github/v84/github/users_keys.go similarity index 99% rename from vendor/github.com/google/go-github/v75/github/users_keys.go rename to vendor/github.com/google/go-github/v84/github/users_keys.go index 4d42986ed..350a684b7 100644 --- a/vendor/github.com/google/go-github/v75/github/users_keys.go +++ b/vendor/github.com/google/go-github/v84/github/users_keys.go @@ -31,6 +31,7 @@ func (k Key) String() string { // string will fetch keys for the authenticated user. // // GitHub API docs: https://docs.github.com/rest/users/keys#list-public-keys-for-a-user +// // GitHub API docs: https://docs.github.com/rest/users/keys#list-public-ssh-keys-for-the-authenticated-user // //meta:operation GET /user/keys diff --git a/vendor/github.com/google/go-github/v75/github/users_packages.go b/vendor/github.com/google/go-github/v84/github/users_packages.go similarity index 88% rename from vendor/github.com/google/go-github/v75/github/users_packages.go rename to vendor/github.com/google/go-github/v84/github/users_packages.go index b813dd9d1..f0c152dd5 100644 --- a/vendor/github.com/google/go-github/v75/github/users_packages.go +++ b/vendor/github.com/google/go-github/v84/github/users_packages.go @@ -15,6 +15,7 @@ import ( // list packages for the authenticated user. // // GitHub API docs: https://docs.github.com/rest/packages/packages#list-packages-for-a-user +// // GitHub API docs: https://docs.github.com/rest/packages/packages#list-packages-for-the-authenticated-users-namespace // //meta:operation GET /user/packages @@ -49,6 +50,7 @@ func (s *UsersService) ListPackages(ctx context.Context, user string, opts *Pack // get the package for the authenticated user. // // GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-for-a-user +// // GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-for-the-authenticated-user // //meta:operation GET /user/packages/{package_type}/{package_name} @@ -79,6 +81,7 @@ func (s *UsersService) GetPackage(ctx context.Context, user, packageType, packag // delete the package for the authenticated user. // // GitHub API docs: https://docs.github.com/rest/packages/packages#delete-a-package-for-a-user +// // GitHub API docs: https://docs.github.com/rest/packages/packages#delete-a-package-for-the-authenticated-user // //meta:operation DELETE /user/packages/{package_type}/{package_name} @@ -103,6 +106,7 @@ func (s *UsersService) DeletePackage(ctx context.Context, user, packageType, pac // restore the package for the authenticated user. // // GitHub API docs: https://docs.github.com/rest/packages/packages#restore-a-package-for-a-user +// // GitHub API docs: https://docs.github.com/rest/packages/packages#restore-a-package-for-the-authenticated-user // //meta:operation POST /user/packages/{package_type}/{package_name}/restore @@ -123,21 +127,21 @@ func (s *UsersService) RestorePackage(ctx context.Context, user, packageType, pa return s.client.Do(ctx, req, nil) } -// PackageGetAllVersions gets all versions of a package for a user. Passing the empty string for "user" will -// get versions for the authenticated user. +// ListPackageVersionsOptions specifies the optional parameters to the UsersService.ListPackageVersions. +type ListPackageVersionsOptions struct { + // State of package either "active" or "deleted". + State string `url:"state,omitempty"` + + ListOptions +} + +// ListPackageVersions gets all versions of a package for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-a-user // GitHub API docs: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-the-authenticated-user // //meta:operation GET /user/packages/{package_type}/{package_name}/versions -//meta:operation GET /users/{username}/packages/{package_type}/{package_name}/versions -func (s *UsersService) PackageGetAllVersions(ctx context.Context, user, packageType, packageName string, opts *PackageListOptions) ([]*PackageVersion, *Response, error) { - var u string - if user != "" { - u = fmt.Sprintf("users/%v/packages/%v/%v/versions", user, packageType, packageName) - } else { - u = fmt.Sprintf("user/packages/%v/%v/versions", packageType, packageName) - } +func (s *UsersService) ListPackageVersions(ctx context.Context, packageType, packageName string, opts *ListPackageVersionsOptions) ([]*PackageVersion, *Response, error) { + u := fmt.Sprintf("user/packages/%v/%v/versions", packageType, packageName) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -157,10 +161,33 @@ func (s *UsersService) PackageGetAllVersions(ctx context.Context, user, packageT return versions, resp, nil } +// ListUserPackageVersions returns package versions for a public package owned by a specified user. +// +// GitHub API docs: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-a-user +// +//meta:operation GET /users/{username}/packages/{package_type}/{package_name}/versions +func (s *UsersService) ListUserPackageVersions(ctx context.Context, user, packageType, packageName string) ([]*PackageVersion, *Response, error) { + u := fmt.Sprintf("users/%v/packages/%v/%v/versions", user, packageType, packageName) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var versions []*PackageVersion + resp, err := s.client.Do(ctx, req, &versions) + if err != nil { + return nil, resp, err + } + + return versions, resp, nil +} + // PackageGetVersion gets a specific version of a package for a user. Passing the empty string for "user" will // get the version for the authenticated user. // // GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-version-for-a-user +// // GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-version-for-the-authenticated-user // //meta:operation GET /user/packages/{package_type}/{package_name}/versions/{package_version_id} @@ -191,6 +218,7 @@ func (s *UsersService) PackageGetVersion(ctx context.Context, user, packageType, // delete the version for the authenticated user. // // GitHub API docs: https://docs.github.com/rest/packages/packages#delete-a-package-version-for-the-authenticated-user +// // GitHub API docs: https://docs.github.com/rest/packages/packages#delete-package-version-for-a-user // //meta:operation DELETE /user/packages/{package_type}/{package_name}/versions/{package_version_id} @@ -215,6 +243,7 @@ func (s *UsersService) PackageDeleteVersion(ctx context.Context, user, packageTy // restore the version for the authenticated user. // // GitHub API docs: https://docs.github.com/rest/packages/packages#restore-a-package-version-for-the-authenticated-user +// // GitHub API docs: https://docs.github.com/rest/packages/packages#restore-package-version-for-a-user // //meta:operation POST /user/packages/{package_type}/{package_name}/versions/{package_version_id}/restore diff --git a/vendor/github.com/google/go-github/v75/github/users_social_accounts.go b/vendor/github.com/google/go-github/v84/github/users_social_accounts.go similarity index 88% rename from vendor/github.com/google/go-github/v75/github/users_social_accounts.go rename to vendor/github.com/google/go-github/v84/github/users_social_accounts.go index 30927cd8d..e7642c6d6 100644 --- a/vendor/github.com/google/go-github/v75/github/users_social_accounts.go +++ b/vendor/github.com/google/go-github/v84/github/users_social_accounts.go @@ -16,6 +16,11 @@ type SocialAccount struct { URL *string `json:"url,omitempty"` } +// socialAccountsRequest represents the request body for adding or deleting social accounts. +type socialAccountsRequest struct { + AccountURLs []string `json:"account_urls"` +} + // ListSocialAccounts lists all social accounts for the authenticated user. // // GitHub API docs: https://docs.github.com/rest/users/social-accounts#list-social-accounts-for-the-authenticated-user @@ -49,7 +54,7 @@ func (s *UsersService) ListSocialAccounts(ctx context.Context, opts *ListOptions //meta:operation POST /user/social_accounts func (s *UsersService) AddSocialAccounts(ctx context.Context, accountURLs []string) ([]*SocialAccount, *Response, error) { u := "user/social_accounts" - req, err := s.client.NewRequest("POST", u, accountURLs) + req, err := s.client.NewRequest("POST", u, &socialAccountsRequest{AccountURLs: accountURLs}) if err != nil { return nil, nil, err } @@ -70,7 +75,7 @@ func (s *UsersService) AddSocialAccounts(ctx context.Context, accountURLs []stri //meta:operation DELETE /user/social_accounts func (s *UsersService) DeleteSocialAccounts(ctx context.Context, accountURLs []string) (*Response, error) { u := "user/social_accounts" - req, err := s.client.NewRequest("DELETE", u, accountURLs) + req, err := s.client.NewRequest("DELETE", u, &socialAccountsRequest{AccountURLs: accountURLs}) if err != nil { return nil, err } diff --git a/vendor/github.com/google/go-github/v75/github/users_ssh_signing_keys.go b/vendor/github.com/google/go-github/v84/github/users_ssh_signing_keys.go similarity index 99% rename from vendor/github.com/google/go-github/v75/github/users_ssh_signing_keys.go rename to vendor/github.com/google/go-github/v84/github/users_ssh_signing_keys.go index fcc930be6..968401f02 100644 --- a/vendor/github.com/google/go-github/v75/github/users_ssh_signing_keys.go +++ b/vendor/github.com/google/go-github/v84/github/users_ssh_signing_keys.go @@ -26,6 +26,7 @@ func (k SSHSigningKey) String() string { // username string will fetch SSH signing keys for the authenticated user. // // GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#list-ssh-signing-keys-for-a-user +// // GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#list-ssh-signing-keys-for-the-authenticated-user // //meta:operation GET /user/ssh_signing_keys diff --git a/vendor/github.com/google/go-github/v75/github/with_appengine.go b/vendor/github.com/google/go-github/v84/github/with_appengine.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/with_appengine.go rename to vendor/github.com/google/go-github/v84/github/with_appengine.go diff --git a/vendor/github.com/google/go-github/v75/github/without_appengine.go b/vendor/github.com/google/go-github/v84/github/without_appengine.go similarity index 100% rename from vendor/github.com/google/go-github/v75/github/without_appengine.go rename to vendor/github.com/google/go-github/v84/github/without_appengine.go diff --git a/vendor/modules.txt b/vendor/modules.txt index 4099378a0..23d93cc34 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -9,8 +9,8 @@ github.com/BurntSushi/toml/internal # github.com/beorn7/perks v1.0.1 ## explicit; go 1.11 github.com/beorn7/perks/quantile -# github.com/bradleyfalzon/ghinstallation/v2 v2.17.0 -## explicit; go 1.24.0 +# github.com/bradleyfalzon/ghinstallation/v2 v2.18.0 +## explicit; go 1.25.0 github.com/bradleyfalzon/ghinstallation/v2 # github.com/cespare/xxhash/v2 v2.3.0 ## explicit; go 1.11 @@ -179,9 +179,9 @@ github.com/golang-jwt/jwt/v5 # github.com/google/go-github/v72 v72.0.0 ## explicit; go 1.23.0 github.com/google/go-github/v72/github -# github.com/google/go-github/v75 v75.0.0 -## explicit; go 1.24.0 -github.com/google/go-github/v75/github +# github.com/google/go-github/v84 v84.0.0 +## explicit; go 1.25.0 +github.com/google/go-github/v84/github # github.com/google/go-querystring v1.2.0 ## explicit; go 1.13 github.com/google/go-querystring/query